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

Re: /bin/sh == bash?



On Fri, Aug 06, 2004 at 10:43:18PM +0200, Jérôme Marant wrote:
> Selon David Weinehall <tao@debian.org>:
> 
> > On Fri, Aug 06, 2004 at 10:14:55PM +0200, Jérôme Marant wrote:
> > > Selon Roland Stigge <stigge@antcom.de>:
> > >
> > > > Hi,
> > > >
> > > > I recently encountered some packages (e.g.
> > > > fhist: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=263997
> > > > userv: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=263979
> > > > ) that FTBFS when /bin/sh is not bash, but instead a more POSIX like
> > > > shell, e.g. dash. See also Policy, 10.4. Scripts.
> >
> > Note that even if things work with dash, it doesn't really say too much
> > about POSIX (and hence policy 10.4) compliance, dash has quite a lot of
> > extensions.  posh is probably the closest thing to POSIX we have in
> > Debian.  It'll cause quite a lot of scripts to fail though, since it
> > doesn't support `command -v', which is something we even recommend in
> > policy.  Imho `command -v' should be explicitly added to Policy 10.4,
> > alongside the extension we already have there, `echo -n'.
> 
> 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".


Regards: David Weinehall
-- 
 /) David Weinehall <tao@acc.umu.se> /) Northern lights wander      (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/    (/   Full colour fire           (/



Reply to: