[Slackbuilds-users] Patch proposal to remove bashisms from some scripts

Eric Hameleers eha at alienbase.nl
Mon Nov 1 11:24:07 UTC 2010


On Mon, 1 Nov 2010, Ben Mendis wrote:

> On Sun, Oct 31, 2010 at 10:15 AM, B Kirkpatrick <bkirkp at gmail.com> wrote:
>
>> I do not want to start a flame war here, but I would like an explanation of
>> why the large majority of Slackware users, those who have & use bash, have
>> to write ash-compliant scripts for those who are using that shell. I know
>> that it has been done that way forever, I know that ash is run during
>> install, I know that it is run in BusyBox, but when the system is installed,
>> why can't I write any bash-compliant code & not get "bashed" by other users?
>> Regards,
>> Bill
>>
>>
> My personal feeling has always been that if the script begins with #!/bin/sh
> then it should be written to work with _any_ Bourne-compatible shell. If you
> want/need to use features specific to a particular implementation such as
> Bash or Ksh, then state that explicitly in your shebang. If you're unsure,
> put #!/bin/bash or whatever shell you tested in.
>
> Demanding to use Bash-specific features in Bourne shell is like demanding a
> garbage collector in C.

The SlackBuild scripts hosted by http://slackbuilds.org have to be 
executed by the root user. Slackware assumes that the root user uses the 
bash shell. I agree though that /bin/sh can point to any shell the local 
computer administrator likes best. So, bashisms should be kept to a 
minimum in SlackBuild scripts, and if anything is used that works only 
with bash, the shebang line should read "#!/bin/bash" explicitly.

However!
I do not want a "bash test" to be mandatory for the SlackBuild maintainer. 
Rather, I would like to leave it to the users of the script to report 
incompatibilities.

If any user of a script finds that the script actually requires bash, he 
or she can communicate this to the maintainer who can then update the 
SlackBuild with an explicit "#!/bin/bash" line.

Note that this is my personal opinion, not discussed with the other 
admins.

Cheers, Eric
-- 
Eric Hameleers
Email: alien at slackware.com
Jabber: alien at jabber.xs4all.nl
Gpg fingerprint: F2CE 1B92 EE1F 2C0C E97E  581E 5E56 AAAF A75C BDA0

The two basic principles of Windows system administration:
* For minor problems, reboot
* For major problems, reinstall


More information about the SlackBuilds-users mailing list