* Question regarding shebang /bin/sh
@ 2020-04-07 15:24 Peter Müller
2020-04-07 15:27 ` Michael Tremer
2020-04-07 16:06 ` Tapani Tarvainen
0 siblings, 2 replies; 3+ messages in thread
From: Peter Müller @ 2020-04-07 15:24 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
Hello *,
quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter
in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense
to rewrite them to /bin/bash accordingly.
That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide
additional information so tools like shellcheck know what they are actually dealing with.
Opinions?
Thanks, and best regards,
Peter Müller
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regarding shebang /bin/sh
2020-04-07 15:24 Question regarding shebang /bin/sh Peter Müller
@ 2020-04-07 15:27 ` Michael Tremer
2020-04-07 16:06 ` Tapani Tarvainen
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2020-04-07 15:27 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]
Hi,
I normally use /bin/bash, because I use “bashisms” and I have not a clue what is compatible with what shell.
I do not think that there is a single distribution who is linking /bin/sh to anything else than a GNU bash apart from Debian and everything that is using busybox.
The latter is totally irrelevant for us. Dash - the Debian shell is becoming less popular. People who are using fancy shells like ZSH or fish only use that for the user accounts, but the /bin/sh symlink remains untouched.
There is probably no collateral damage from changing our scripts from /bin/sh to /bin/bash. The other way round would definitely cause problems.
Hope this helps.
-Michael
> On 7 Apr 2020, at 16:24, Peter Müller <peter.mueller(a)ipfire.org> wrote:
>
> Hello *,
>
> quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter
> in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense
> to rewrite them to /bin/bash accordingly.
>
> That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide
> additional information so tools like shellcheck know what they are actually dealing with.
>
> Opinions?
>
> Thanks, and best regards,
> Peter Müller
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regarding shebang /bin/sh
2020-04-07 15:24 Question regarding shebang /bin/sh Peter Müller
2020-04-07 15:27 ` Michael Tremer
@ 2020-04-07 16:06 ` Tapani Tarvainen
1 sibling, 0 replies; 3+ messages in thread
From: Tapani Tarvainen @ 2020-04-07 16:06 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
On Tue, Apr 07, 2020 at 05:24:27PM +0200, Peter Müller (peter.mueller(a)ipfire.org) wrote:
>
> Hello *,
>
> quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter
> in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense
> to rewrite them to /bin/bash accordingly.
>
> That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide
> additional information so tools like shellcheck know what they are actually dealing with.
>
> Opinions?
In principle I like the idea. But it would take some care:
bash behaves differently when invoked as sh, so you can't simply
change #/bin/sh to #/bin/bash without also checking the scripts
one by one to make sure they still work as they should. Most
probably would as the differences are small but some might need
small adjustment.
--
Tapani Tarvainen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-07 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 15:24 Question regarding shebang /bin/sh Peter Müller
2020-04-07 15:27 ` Michael Tremer
2020-04-07 16:06 ` Tapani Tarvainen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox