/bin/sh is linked to Dash instead of Bash in Edgy

Asked by askrieger

In Edgy, /bin/sh is linked to dash. In Hoary, Breezy, and Dapper, /bin/sh was linked to bash. Unfortunately, this breaks a number of shell scripts. In particular, many of those provided by third parties for hardware and or software installation purposes. Neither of the two obvious fixes, either link /bin/sh to bash, or change the #! line in the script is easily accomplished by new users. Even at this early stage in Edgy deployment this problem has been noticed on the forums. Pesonally, I would have thought that having developers, who know what they are doing, changing the #! line in the init.d scripts (and the scripts called by those scripts) would have been a more friendly way to implement the change.

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Luca Falavigna (dktrkranz) said :
#1

A specification has been written and implemented. See https://launchpad.net/distros/ubuntu/+spec/dash-as-bin-sh for further reference.

Revision history for this message
Danny Staple (danny-orionrobots) said :
#2

I have to say I agree here with askrieger. Although I understand the speed and binary size rationale, since most scripts may have been designed with the understanding that /bin/sh is linked to bash, they will be broken.

A far better way would have been to use #! and started migrating (and thoroughly testing) scripts to use it. To be fair, it is definately true that any script that made assumptions about /bin/sh actually being bash should have specified /bin/bash as it may not even have run properly on a real /bin/sh. Had this been done, then maybe the migration to dash would be as painless as expected.

Its a good idea, but maybe needs to go back to the drawing board a bit longer to be thought upon and have the kinks worked out.

In the spec it suggests:
"Fortunately a 'POSIX compliance' audit of shell scripts has already taken place in Debian some time ago, mostly as a result of Nokia using dash on their Internet Tablet device. We expect very few breakages as a result of changing the default shell, and those we find can be trivially patched or the script changed to use /bin/bash."

Maybe we need to start filing bugs on packages which dont work with this if that is the case. Askreiger, which ones are you having trouble with?

Revision history for this message
Luca Falavigna (dktrkranz) said :
#3

I noticed some bugs have already been filed. As stated in the specification, it is a trivial task to solve such issues, so we should consider to provide a quick triage of them.

Revision history for this message
Luca Falavigna (dktrkranz) said :
#4

In order to get this issue fixed, I don't think it is a good solution replace /bin/sh with /bin/bash as I initially thought. Ubuntu developers (and Debian ones) rightly chose to improve overall performance with this choice, so we shouldn't use s/\/bin\/sh/\/bin\/bash in each case, but it would be much better to modify the script so that it will be able to run under dash without worries.

Revision history for this message
Ubuntu User (anotherubuntuuser) said :
#5

I don't think this is a feature to be hashed out in the support requests.

Scripts that make assumptions are bound to break. If they are using features of bash they should denote bash in the shebang (#!) line or #!/bin/bash.

This sounds like something that can be fixed on a script by script basis and should probably be filed as bugs with the appropriate packages.

Can we have this support request closed as answered?

Thanks

Jim Jones

Revision history for this message
askrieger (askrieger) said :
#6

The problem originally arose when a NEW USER (who probably shouldn't
have been using the Edgy beta, but new users are like that) reported
to Kubuntu Forums that he couldn't get his ADSL modem, which had
worked properly in Dapper, to work in Edgy because the setup script
crashed. After a lot of back and forth, it eventually transpired that
the script was crashing because it included a function call that was
unacceptable to Dash.

A quick look at a random sample of hardware installation scripts,
commercial software installation scripts, and random task scripts from
the net, showed that (a) virtually all start with "#! /bin/sh" and
(b) most of these use function calls that would be rejected by Dash,
e.g.
"function whatever() { # no space between the name and the '(' ".
The people most likely to find themselves facing this problem are the
people who are least capable of solving it on their own, namely new
users.

You are certainly within your rights to say that it is the people who
wrote the scripts who are at fault and that it is not your problem.
However, you have introduced a fault into the system by switching from
Bash to Dash. The problem is now known to active users of both the
Kubuntu Forums and the Ubuntu Forums so we can now add that knowledge
to the standard list of debugging tricks. However, this fault will
cause trouble for new users and repeated explanations for those of us
who try to contribute to the Ubuntu community by helping them.

Thank you,
A. S. Krieger

On 10/3/06, Jim Jones <email address hidden> wrote:
> Support request #1932 on Ubuntu changed:
> https://launchpad.net/distros/ubuntu/+ticket/1932
>
> Comment:
> I don't think this is a feature to be hashed out in the support requests.
>
> Scripts that make assumptions are bound to break. If they are using features of bash they should denote bash in the shebang (#!) line or #!/bin/bash.
>
> This sounds like something that can be fixed on a script by script basis and should probably be filed as bugs with the appropriate packages.
>
> Can we have this support request closed as answered?
>
> Thanks
>
> Jim Jones
>

Revision history for this message
Ubuntu User (anotherubuntuuser) said :
#7

A. S. Krieger-

Sorry if I didn't come off as supportive as I meant to. It appears that this is more of a bug issue than a support request issue. I guess that was my only point.

Honestly, thank you very much for opening the support request so that the issue could be explained and appropriate materials could be linked. As this appears to be a design specification issue, I would suggest contacting that specs maintainer (Scott James Remnant in this case... https://launchpad.net/people/keybuk). I guess an official bug could be logged as well.

After that, there isn't much that the support request system can do than link to those resources and explain that this behavior is known and these are the causes and resources to work through the issue (which does sound pretty nasty, I admit).

I was trying to suggest that this request has probably served its purpose as such and should be closed as answered. Perhaps bugs in individual scripts can be logged in the bug system as well as the actual change from bash to dash and then linked to this support request to give one more vector for people to find an answer to their problems.

I apologize if I didn't come off better. I was writing in a hurry.

Jim Jones

Revision history for this message
askrieger (askrieger) said :
#8

Thank you for your reply. I will try to contact Mr. Remnant. When I
filed the support request, I wasn't sure what the appropriate avenue
for this problem really was. I'm confident that the Ubuntu developers
will handle breakage of Ubuntu scripts. I couldn't have been more
pleased by the response of the Ubuntu development team to the install
log glitch.

The problem is that the offending scripts are NOT part of the Ubuntu
distro. The script that started the issue at KubuntuForums.net was a
manufacturer provided install script for an ADSL modem. Once the
cause of the problem was known, I searched the web looking for other
installation scripts for unusual peripherals and non-free software,
and found several that appeared to assume that /bin/sh was Bash. I
wish I had saved the list so that I could communicate the problem to
the authors. Having failed to do so, I felt that the problem should
be brought to the attention of someone at Ubuntu

Thank you,
A. S. Krieger

Revision history for this message
askrieger (askrieger) said :
#9

LinkedIn
------------

Jim,

I'd like to add you to my professional network on LinkedIn.

- Allen

Allen Krieger
President
Greater Boston Area

Confirm that you know Allen Krieger:
https://www.linkedin.com/e/2qkzc3-h6dtyh23-3u/isd/8386163242/D9fBoyYz/?hs=false&tok=3-xsclNtjJkRo1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/2qkzc3-h6dtyh23-3u/M98NJ23uKyJWvKiBWlKyW2OoKEVeAtbl5xvyYiIqeiL2niuY/goo/ticket1932%40support%2Elaunchpad%2Enet/20061/I2819879840_1/?hs=false&tok=2BvOJB5IbJkRo1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

Revision history for this message
Launchpad Janitor (janitor) said :
#10

This question was expired because it remained in the 'Open' state without activity for the last 15 days.