Archaic wrote: > On Fri, Mar 20, 2009 at 01:41:53PM -0500, Bruce Dubbs wrote: >> I would really go the other way and make all the scripts start with >> #!/bin/bash >> and use the features of bash. When we use the lowest common denominator, we >> prevent progress. If someone wants to use dash or another incomplete shell >> as a >> default, then they should customize the startup scripts too. > > Wow, I didn't mean to open a hornet's nest.
It's not a hornet's next, but a discussion. Tushar points out that we've had this discussion before. Sometimes it's useful to revisit some discussions. For instance, I came across this: http://elliotth.blogspot.com/2007/12/dash-helps-bash-users-relive-bad-old.html It claims that an old system boots 2 (out of 45) seconds faster with dash. I just don't see any speed issue with different shells during boot. My LFS laptop boots quite nicely with bash in 20 seconds (without X, but with sshd, apache, nfs, and samba). Once the shell is loaded, it stays in memory and then the small scripts used during the boot cycle will all run at the same speed. About the only thing I've seen that is a significant script during boot is from Oracle and that is a monster. Of course, that's not open source. > But this does raise a > question. Is there any feature of bash that is commonly used that cannot > be done in some fashion with POSIX sh? I'm not talking about the need to > do things with different syntax, but the need to use non-sh utilities to > match the functionality. If there is such a common use of bash, then I > would agree with Bruce, otherwise, I don't see any loss of progress and > would prefer portability. That's a reasonable position to take, but then again, dash is an NP-complete language -- that means that anything you can do with one language, you can do with another. There is nothing magic about *sh. You could make the default shell python if you wanted. The issue would be compatibility with other scripts. > Unfortunately, this problem creeps up in the packages LFS installs, too, > where #!/bin/sh is used, but bash-specific code is found. We've caught > some in the past (probably from previous ash-only enthusiasts). There > may be others. Yes, that's the issue. We would like to be POSIX complaint, but what does that mean? Does POSIX define what is needed? I found http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html, but that doesn't specify what shells are complaint. AFAICT, what is does not prohibit is a superset. According to Wikipedia, dash omits a POSIX required $LINENO variable. When checking scripts, what about ash? korn? posh? zsh? What about the original Bourne sh? How far do we go? My thought would be to use #!/bin/bash for our scripts since that is what we install, but make the scripts not intentionally use any capabilities not in POSIX. If a user wants to change to sh, then that's his distro. I did find this pdf on the web that presents some differences between bash and dash: http://princessleia.com/plug/2008-JP_bash_vs_dash.pdf For instance, you can't do: somecommand &> /dev/null in dash. Of course it can be worked around. The real issue to me is to answer the question: Are there scripts that are run using dash (or ash) that *won't* run properly with bash? -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
