[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Call for help: please read (bashisms)



Dear sponsors, mentors, maintainers,

Introduction:

Please be aware that although bash is currently the default /bin/sh there's a 
release goal for Lenny to make dash the default /bin/sh[1].
This release goal affects every single /bin/sh script and every single 
makefile not defining a different SHELL. Although they are 'affected', 
everything is ok unless 'bashisms'[2] are used.

There is a tool called 'checkbashisms' which is shipped by the 'devscripts' 
package, which is able to find several kind of bashisms in /bin/sh scripts 
and makefiles (since version 2.0.26 and above when using -f, but version from 
SVN[3] is recommended). This is the tool being used to generate reports for 
the goal's mass bug filing.

With the recent improvements made to checkbashisms a lot of bashisms were 
found in makefiles such as debian/rules. Based on the last archive wide check 
there are about 312 (spread between 306 packages) bashisms in debian/rules.

Although the number of false positives when using checkbashisms on makefiles 
is higher than the number of false positives when checking /bin/sh scripts, 
there are still way too many bashisms around.


Request:

I would like to request everybody to check for bashisms in the packages they: 
prepare, review, and upload.
lintian is currently not able to check for bashisms in files other than 
maintainer scripts (debian/rules excluded), so it is not as easy as 
saying 'just check with the latest lintian'.


How to do it:

I've written a script called checkbashisms-in-package.sh[4] which can be used 
to easily check for bashisms in a .deb once checkbashisms is in $PATH.
Please be aware that this script only looks for bashisms in some directories 
and not _everywhere_, which means there might be some bashisms left in other 
places (suggestions and patches welcome!).


Examples:

Running checkbashisms-in-package.sh without any argument will display:
$ ./checkbashisms-in-package.sh
checkbashisms-in-package.sh foo.deb [bar.deb [...]]
Simple script to run checkbashisms on files inside a .deb, v0.0.1
Copyright 2008 Raphael Geissert <atomo64@gmail.com>

To check for bashisms in a give .deb (or several .debs):
$ ./checkbashisms-in-package.sh kopete_3.5.9-1_i386.deb

Processing kopete_3.5.9-1_i386.deb...
possible bashism in ./usr/bin/kopete_latexconvert.sh line 225 (let ...):
let OPTIND=$OPTIND+1
done

To check for bashisms in debian/rules use:
$ checkbashisms -f -debian/rules
possible bashism in debian/rules line 740 (brace expansion):
                builddir-$(TARGET) {configure,build,install}-$(TARGET)-stamp

*Note* that --force/-f is required for checkbashisms to check for bashisms in 
makefiles.


I hope that this will make people more aware of bashisms and help the release 
goal.

If you want more information about dash as /bin/sh, you can read:
http://lists.debian.org/debian-release/2008/01/msg00189.html

Fixing bashisms is pretty simple, you can get some ideas at:
https://wiki.ubuntu.com/DashAsBinSh
If the bashism you found is not there you can always ask in d-devel@l.d.o, or 
even here in -mentors.

Other ways to help include:
 * Providing patches for the goal-dash bugs[5].
 * Switching your /bin/sh to dash!
    (apt-get install dash && dpkg-reconfigure dash))
 * Helping others to fix their bashisms
 * Spread the word! bashisms are not allowed by policy.

[1]
http://release.debian.org/lenny/goals.txt
[2]
'bashism': in the context of the release goal a bashism is any kind of shell 
feature not required by the Debian Policy section 10.4.
[3]
svn://svn.debian.org/svn/devscripts/trunk/scripts/checkbashisms.pl
[4]
http://git.debian.org/?p=users/atomo64-guest/misc-devscripts.git;a=blob_plain;f=checkbashisms-in-package.sh;hb=master
[5] 
http://bugs.debian.org/cgi-bin/pkgreport.cgi?users=debian-release@lists.debian.org&tag=goal-dash

Thanks in advance.

Sincerely,
-- 
Atomo64 - Raphael

Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: