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 calls a dispatcher function which determines which applet to call (there is one applet per supported application) from the name of the link. And there is no applet named 'dash' in Busybox. But Busybox knows 'ash' and 'sh', which point to the same applet.

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.

    Didier

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

Reply via email to