On 2016-02-11 10:56, Didier Kryn wrote:
Le 10/02/2016 23:37, Rainer Weikusat a écrit :
Didier Kryn <k...@in2p3.fr> writes:
Le 10/02/2016 18:50, Rainer Weikusat a écrit :
Didier Kryn <k...@in2p3.fr> writes:

[...]

2) At the time of this test campaign, the shebang line of vdev scripts was #!/bin/dash, which doesn't work in Busybox. It should be
replaced by #!/bin/sh which works in all cases.
This isn't necessarily true. Both dash and the usual busybox sh are
forks of the Amquist shell (ash) which is supposed to be enable to
execute scripts written in the Bourne shell language/ for the
standardized /bin/sh but they also provide extensions of their own (eg,
like bash, dash supports lexically scoped function variables but the
Bourne/ standard shell doesn't). The busybox ash can also compiled w/o
certain features, eg, arithmetic expansion.

'Replacing /bin/dash with /bin/sh' will only work if the author of the
script use the non-standard name because he doesn't knew any better
instead of because the script actually uses dash features.

There's no theory behind that. It's just practical and the result
of experimenting.

     The way Busybox works is all applications are links to
/bin/busybox. When invoqued, /bin/busybox
... looks at argv[0] and invokes the corresponding embedded
program. "Everybody knows that" (well, not everybody but everybody who
ever worked with busybox) .

On the other hand, the default shell in Debian, the one invoked by
/bin/sh, is dash. I guess in every distro /bin/sh points to the
~POSIX-compliant shell. Therefore '#!/bin/sh' should just work
everywhere.
It should be the name of a shell capable of running Bourne/ standard
shell scripts. But this may not work if the /bin/dash in the original
script was there for a reason, ie, it was using dash features.

    As I already wrote, vdev was working well with busybox's ash.,
replacing 'dash' with 'sh' in the shebang.

    If the question is why Jude replaced /bin/sh with /bin/dash in the
middle of the development, I think it was to make sure to not invoke
bash.

In my setup /usr/bin/dash is a symlink to /usr/bin/bash

It works!

 I don't think that's why Jude chose dash?


But (sorry for the repetition) I used to modify the shebang
everytime I tested a new version, and there was never any issue with
the shell.

    Another possibility would be to write a wrapper script called
/bin/dash, like
#! /bin/sh
exec /bin/sh $@

                                Didier


_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to