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

Re: curly brackets a bashism?



begin  Glenn Maynard  quotation:
> On Tue, Feb 12, 2002 at 07:34:14AM +0900, Junichi Uekawa wrote:
> > Craig Dickson <crdic@yahoo.com> cum veritate scripsit:
> > 
> > > The Debian boot floppies have ash, but not bash, because of size
> > > concerns, so any package that might need to be installed from that
> > > environment cannot use bashisms in its installation scripts. It seems
> > > simpler to just say "no bashisms in package scripts" rather than
> > > distinguish between those that might need to install when bash is not
> > > available, and those that can depend on it. It would seem like asking
> > > for trouble to say "no bashisms in base packages, but other than that
> > > it's okay" -- people would tend to forget.
> 
> That would mean "you can't make package scripts *anything* but sh scripts"
> (and any other shells/scripts available in the boot floppies, which are
> probably few).

Which would be okay with me, but as Junichi points out, policy already
has a more complete solution.

> > Read policy section 11.4., and relax.
> > 
> > It is already documented as "/bin/sh can be any POSIX-compliant shell".
> > 
> > Not /bin/bash, not /bin/ash.
> 
> The point is that people are using "#!/bin/sh" and using bash-specific
> features, which happens to work if your /bin/sh happens to be bash, but
> not if it's anything else.  For people testing these, it'd help if /bin/sh
> pointed to a shell with no extentions (or with them all disabled), so
> this is enforced.
> 
> I'm not saying that people should never use bash features; just that the
> bangline should be /bin/bash, not /bin/sh.
>
> Aside: bash, bison, cvs, libc6, menu, postgresql, postgresql-client,
> postgresql-doc, and libpgsql2.1 have scripts with #!/bin/bash,
> but none of them depend on bash; is this a bug, or are essential
> dependencies normally omitted?  (What about pre-deps for packages using
> bash in preinst?)

All this is answered in policy 11.4:

   ...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).

Craig

Attachment: pgp8E5yhT8oyy.pgp
Description: PGP signature


Reply to: