[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /bin/sh == bash?



Selon David Weinehall <tao@debian.org>:

> > After rereading 10.4, it is clear that POSIX compliance is not mandatory
> > at all.
>
> ``The standard shell interpreter `/bin/sh' can be a symbolic link to
>   any POSIX compatible shell, if `echo -n' does not generate a newline.[1]
>   Thus, shell scripts specifying `/bin/sh' as interpreter should only use
>   POSIX features.  If a script requires non-POSIX features from the shell
>   interpreter, the appropriate shell must be specified in the first line
>   of the script (e.g., `#!/bin/bash') and the package must depend on the
>   package providing the shell (unless the shell package is marked
>   "Essential", as in the case of `bash').''
>
> Well, you have the option of _either_ using only POSIX features, _or_
> specifying the appropriate shell.  Hence the ``should'' in
> "Thus, shell scripts specifying `/bin/sh' as interpreter should
>  only use POSIX features." really only makes any sense if replaced
> with a must.  Of course, there is a third option -- having a script that
> fails to work when using a strict POSIX shell, but that implies FTBFS or
> runtime failures, which really isn't an option either.
>
> Hence I cannot really see how you can say that it's "clear that POSIX
> compliance is not mandatory at all".

I stand correct: POSIX compliance is only necessary when using /bin/sh.
It doesn't force anyone to use a POSIX-compliant shell. In that case,
you need to give the precise name of the shell.

So, two ways of fixing: fixing the script for POSIX-compliance *OR*
SHELL=/bin/bash at the beginning of debian/rules (or /bin/bash in
shell scripts). Both solutions are valid.

--
Jérôme Marant



Reply to: