Skip to contentSkip to conversation

scripts/dev-needs: depend on bash in shebang

PATCH Saravana Kannan 1 participant 1 message Mar 14, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Adding LKML

Quoted 6 lines · Dirk Müller

This script uses bash specific syntax. make it more specific by declaring it to be used via bash rather than /bin/sh which could be non-bash.

Technically this is targeted towards toybox because that's what I deal with everyday while I work on Android devices. But toybox seems to follow bash conventions. Would this shebang be considered valid in that instance?

Btw, I've been meaning to add (for more than year) the following to the top of the script:
shopt -s expand_aliases

Geert pointed out that the script doesn't work with some setups because this flag isn't default enabled. I also remember this being a deprecated option, but until someone wants to rewrite this script in a way that it'll work on toybox (this is what Android uses) with zero setup and also not depend on the aliases, we might as well set the flag to match with reality.

Wanna pull that shopt into your patch?

-Saravana

Quoted 17 lines
---
 scripts/dev-needs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/dev-needs.sh +1 -2
index 454cc304fb44..c324f0737f6b 100755
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2020, Google LLC. All rights reserved.
 # Author: Saravana Kannan <[email protected]>
--

2.35.1

Quoted 23 lines · Dirk Müller

This script uses bash specific syntax. make it more specific by declaring it to be used via bash rather than /bin/sh which could be non-bash.

---
 scripts/dev-needs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/dev-needs.sh +1 -2
index 454cc304fb44..c324f0737f6b 100755
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2020, Google LLC. All rights reserved.
 # Author: Saravana Kannan <[email protected]>
--

2.35.1