[Portland] Scripts Are Written for Bash But Run With #!/bin/sh --Broken on Ubuntu 7.04 (And 6.10?)

Wichmann, Mats D mats.d.wichmann at intel.com
Fri Apr 27 12:25:13 PDT 2007


portland-bounces at lists.freedesktop.org wrote:
> On Freitag, 27. April 2007 +0100, Nathan Kidd wrote:
>> Hi,
>> 
>> I just discovered yesterday that xdk-utils is broken on X/K/Ubuntu
>> 7.04 (and it seems 6.10, though I only tried 7.04) because they
>> switched to using Dash as the /bin/sh symlink, instead of Bash. 
>> Like many other scripts (my own xdk-utils wrapper included), the
>> xdk-utils scripts execute with #!/bin/sh but actually use bashisms
>> (e.g. pushd/popd). 
>> 
>> I believe we need to change the xdk-utils scripts to either A) use
>> strict POSIX shell commands only (more work, but more portable), or
>> B) change to #!/bin/bash explicitly (easy to do, potentially less
>> portable). 
> 
> I think, if possible, we should try to keep /bin/sh and fix
> the problems.
> 
>> Why they changed from bash to dash:
> https://wiki.ubuntu.com/DashAsBinSh
>> 
>> Several long discussions, the summary of which is: "Yes we know
>> changing to dash as /bin/sh is going to break stuff.  No, we won't
>> change back because we get serious performance benefits from dash.
>> Any script that requires bash but only asks for /bin/sh is broken."
> 
> I wish them good luck. A friend of mine is the maintianer of "grml"
> [1], which is also a Debian based distribution, and at one point they
> tried to use zsh
> as the default shell because it is more powerful than bash,
> but they had to
> give up after some time because there are just too much such /bin/sh
> == /bin/bash assumptions in Debian's (and other's) scripts.
> 
> Nevertheless, we should try to make our scripts work correctly.
> Would it possible for you to compile a list of  breakages?

The two I run into all the time battling this stuff are:

* pushd/popd (as mentioned)
* use of the word 'function' in defining functions


More information about the Portland mailing list