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

Re: POSIX shell; bash ash pdksh & /bin/sh

> >  Marcus> Why can't we easily do away with it?
> > 
> > 	Because I have gotten used to the fact that if I say
> >  #!/bin/bash; I shall find something. Not only I, but packages, and
> >  doubtless other users have too. Do we really want to go rooting
> >  thorough packages and forcing packages that use /bin/bash to declare
> >  explicit dependencies? Is this effort justified? 
> I think if you request bash as your shell, you should only do it when you
> use bash features that are non-posix. And then, yes, I think you should be
> aware of it and only do it when it is really necessary. One shouldn't just
> put #!/bin/bash at the top of a script without thinking.

Actually, that is -exactly- what I do.  My reasons:

Unlike Manoj and Herbert, I don't have the POSIX standard sitting on my 
desk.  My experience is based on a limited number of shells, none of 
which claimed to be purely POSIX.  Some shells I've used allow "export 
VARIABLE=value", some don't.  Is "read" allowed, or do I need "read 
ignore"?  These specific examples aren't the real issue, but the dozens 
of other constructs that may or may not be allowed in any given shell, 
be it bash, POSIX, Sun sh, ash, pdksh, etc.

So I stick with what I know.  I -know- that bash works, so I use 
#!/bin/bash.  POSIX-compliance is great.  When you buy the manuals for 
me, I'll think about it.  In the mean time, I'll use what I know works.

 And I think that so
> few packages really need a dependency on bash, that they should declare a
> dependency on bash and that action is taken to make bash non-essential in
> the long run, and make a dependency on a virtual posix-shell in the
> dependency field of an essential package. bash should be the default posix
> shell shipped in Debian.
> I would not go through scripts and tell maintainers to declare explicit
> dependency on bash. I would ask them to seek posix compliance and use
> /bin/sh. Do the example scripts I posted in my mail really need bash?

No, they don't.  But the maintainer chose to use bash.

I'm not a maintainer, but if I were, I wouldn't want to have to deal 
with a bug report that read "Your script uses only POSIX features.  It 
should call /bin/sh instead of /bin/bash", and then three months later, 
after I've made that change, and then added (for unrelated reasons) a 
"read" command, get "Your script uses bashisms. It should call 
/bin/bash instead of /bin/sh -- and declare a dependency on Bash, as 
well".  At that point, I'd be tempted to switch to perl instead of a 
shell script.  Then I wouldn't have to worry about the changing shell 
situation.  But is:

   exec "ldconfig"

any better than the equivilant Bash script?

     Buddha Buck                      bmbuck@acsu.buffalo.edu
"Just as the strength of the Internet is chaos, so the strength of our
liberty depends upon the chaos and cacaphony of the unfettered speech
the First Amendment protects."  -- A.L.A. v. U.S. Dept. of Justice

To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: