Summary: | ASTERISK-08166: sh doesn't like the == operator [PATCH] | ||
Reporter: | Jose Pablo Fernandez (pupeno) | Labels: | |
Date Opened: | 2006-11-21 09:05:23.000-0600 | Date Closed: | 2006-11-29 18:28:21.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) bash.patch | |
Description: | The helper script build_tools/genmodconf has the following shebang line #!/bin/sh which means it gets interpreted by sh, the primitive shell. Maybe in some setups it runs bash, but here it doesn't. And although bash doesn't have any problem with the == operator, sh does, leading to the errors: build_tools/genmodconf linux26 "" "pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp wcte11xp wcusb ztd-eth ztd-loc ztdummy ztdynamic zttranscode" [: 66: ==: unexpected operator [: 66: ==: unexpected operator I've created a trivial patch which replaces it with a proper call to bash. The patch is attached. | ||
Comments: | By: Jason Parker (jparker) 2006-11-21 10:31:41.000-0600 This patch isn't portable. I discussed it with the reporter, and he'll be testing other ideas. By: Jose Pablo Fernandez (pupeno) 2006-11-21 16:13:58.000-0600 Using '=' instead of '==' works and seems to be portable, have you made that change ? if you did you can close this bug. By: Tilghman Lesher (tilghman) 2006-11-21 22:27:44.000-0600 On what Linux platform is /bin/sh not /bin/bash ? By: Jason Parker (jparker) 2006-11-21 23:22:30.000-0600 Ubuntu Edgy uses dash by default. I have no further comment. By: Tilghman Lesher (tilghman) 2006-11-27 10:30:57.000-0600 Please complain to the Ubuntu developers: https://launchpad.net/distros/ubuntu/+source/dash/+bug/61463 By: Jose Pablo Fernandez (pupeno) 2006-11-29 14:31:24.000-0600 I am not trying to start a flame here and feel free to close this bug again, but I believe the other side should be heard, so I am copying and pasting the justification for using dash: > Complain to the script authors who are making the mistake. Dash has been a viable provider of /bin/sh (by way of debconf on the dash package) for a long time. There are other shells that provide 'sh' functionality too. If a script really requires /bin/bash then it needs to start with #!/bin/bash. > Analogy: If I needed a square, I would not ask you for a rectangle. Although you might give me the square that I need, since that would fulfill my stated rectangle requirements, it is not guaranteed. > People who need /bin/bash should not ask for /bin/sh and hope that the result they get just happens to be /bin/bash. I have used dash as my /bin/sh for over a year now. It is insanely faster, especially for huge shell scripts such as 'configure' in large projects. I think that Asterisk scripts should either just use Bash, like #!/bin/bash (Ubuntu ships Bash) or be Posix-friendly (I believe /bin/sh should not be expected to provide anything that Posix doesn't ask for). If there's still a problem it would be a bug in Dash not being Posix colpliant. By: Jason Parker (jparker) 2006-11-29 18:28:21.000-0600 Fixed in svn revisions 1.2 - 1663, 1.4 - 1664, trunk - 1665. |