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

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

On Tue, Aug 04, 1998 at 02:27:36AM -0500, Manoj Srivastava wrote:
> >>"Marcus" == Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:
>  Marcus> I think if you request bash as your shell, you should only do
>  Marcus> it when you use bash features that are non-posix.  And then,
>  Marcus> yes, I think you should be aware of it and only do it when it
>  Marcus> is really necessary.
> 	Why? Why should I only do it if only necesary? Why am I free
>  to choose lesstif or slang or newt or whiptail, but when it comes to
>  a shell, the proprietary police shall jump on me?

Policy indeed recommends so already. Quote:
     Restrict your script to POSIX features when possible so that it may
     use /bin/sh' as its interpreter. If your script works with ash, it's
     probably POSIX compliant, but if you are in doubt, use /bin/bash'.

> 	Give me one technical reason for asking me to do so.

Debian scripts should use #!/bin/sh whereever possible to get more aware of
bashisms and how they can be avoided. You said that we should be very strict
in what we output and be liberal in what we accept. You said that you want
that it is possible to point #!/bin/sh to other shells, but this makes only
sense if this shell is used by the Debian scripts.

The technical advantage will be that #!/bin/sh can be replaced with a
smaller, faster posix compliant shell and the system speed will improve.
This is only possible if all scripts that are posix compliant point at

>  Marcus> One shouldn't just put #!/bin/bash at the top of a script
>  Marcus> without thinking.
> 	Why ot? Why can I choose between C and C++ and java, and not
>  have the freedom to choose bash? 

You are changing the words in my mouth. I don't want to restrict your
freedom to choose whatever shell you like. I think Debian maintainers should
write posix compliant scripts whenever possible (in accordance to policy, 
see above). The next step would be, much later, to make packages that really
use bash scripts (scripts that work with bash but are not posix), declare an
explicit dependency on bash. This would make bash de-facto non-essential.
>  Marcus> And I think that so few packages really need a dependency on
>  Marcus> bash, that they should declare a dependency on bash and that
>  Marcus> action is taken to make bash non-essential in the long run,
> 	Why are we doing this? I think I agree with Guy. This is a
>  misguided attempt to create busy work, and I have seen no technical
>  justification for doing so.

Busy work? I think you are exaggerating here. Not very much scripts really
need bash to work, even if they say "#!/bin/bash" (I already posted some
examples). There are some scripts that use "#!/bin/sh", although they use
bashisms. The first one is covered by the above quote of the policy, the
second really is a bug.

After this has been fixed, the transition would be really easy.

Technical justification is that we can run our system on any posix shell,
not only bash. This is useful, for example, when bash breaks (see
libreadline tragedy.
>  Marcus> I would not go through scripts and tell maintainers to
>  Marcus> declare explicit dependency on bash. I would ask them to seek
>  Marcus> posix compliance and use /bin/sh. 
> 	Personally, I see no real reason for doing so. I have bash on
>  all machines I am interested in. Bash scripts that I write are quite
>  protable. Why should I go with POSIX? POSIX shells are not that
>  widely available, and I find Bash portable enough for me.

You are surprising me, as this is contradictionary to what you said before.

> 	It is one thing to ask Debian packaging scripts be portable,
>  but asking authors and users to eschew bash for no reason is not
>  good. 

I smell personal preferences here. You fail to provide technical
reasons why it is absolutely necessary to stay with bash.

Nobody is talking about the users here. Everyone can install the Bash shell,
and it should be the default posix shell anyway. I already said this.
>  Marcus> 1) Make all shell scripts either posix clean or call
>  Marcus> "#!/bin/bash"
>  >> I think you are confused. If I call /bin/bash, and no such
>  >> thing exists, is it a bug? 
>  Marcus> I think I'm not confused but very aware of your opinion that
>  Marcus> bash should be installed in every Debian system.
> 	You do not make sense so far. Look at what you have said
>  above. You say "Make all shell scripts either posix clean or call
>  #!/bin/bash". Cool . I shall do so. Satisfied? That works since Bash
>  is essential. How does your proposal solve the problem of Bash not
>  being present? 

Bash will be present as you would declare an explicit dependency on bash. If
you choose C++, you have a dependency on libstdc++. If you choose C, you have a
dependency on libc. If you choose posix shell scripts, no dependecy would be
needed (as posix shell is essential). If you choose bash, csh or whatever, a
dependency on the shell would be needed.
>  Marcus> This is not convincing to me, sorry.
> 	You are the one advicating change, and on you is the burden of
>  convincing people that change is good. Random change for the sake of
>  change is not a reason. 

I'm not doing religion here. I was not trying to convince people. With my
postings I was hoping that you or someone else would provide technical
reasons why bash needs to be essential. Maybe there is a misunderstanding in
this thread. Let me try to summarize a few statements, maybe we can sort it out.

(1) #!/bin/sh should ever be a shell that is posix compliant.
Rationale: Conforming to posix standard.

(2) Scripts that are POSIX compliant should express this using "#!/bin/sh"
    at the top.
Rationale: * Debian policy (see quote above)
           * The sysadmin can point #!/bin/sh to whatever posix shell he likes.

(3) Scripts should "#!/bin/<shell>" when they use non-posix features of the
    shell <shell>. Then the package has to declare an explicit dependency on
    this shell (exception: bash is currently essential and so you don't need
    to declare a dependency on bash)
Rationale: #!/bin/sh is only guaranteed to provide posix features.

(4) Debian scripts should use "#!/bin/sh" whenever possible, and small
    bashisms should be replaced by posix shell features when it is easy to do.
Rationale: * Debian policy (see quote above)
           * Be strict at what you output.
           * The sysadmin can control what shell is used for Debians script
             by changing /bin/sh to another shell. This shell can for
             example be faster and smaller than bash.
             This also is useful when the shell /bin/sh points to breaks for
             some reason or another.

All what I say is that *under these circumstances*, removing the exception
in point (3) above, and introducing a virtual package posix-shell,
and making bash providing it, and making some essential package depend on
posix-shell, and removing the essential flag on bash, would be possible
without breaking the system. And it would not be too hard or difficult or

At what point do you disagree?

"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09

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

Reply to: