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

Max Miorim miorimmax at gmail.com
Sat Oct 30 10:28:35 UTC 2010


Hello folks,

Recently I have been tinkering with one of my boxes to use ash as
/bin/sh and noticed that doing so some SlackBuilds aren't working as
intended anymore.

After some debugging (ol' good "set -x"), I have noticed some
"bashisms" such as the use of [[ ]] instead of [ ] or test and the use
of == instead of = in either [ ] or test and so I'm proposing
modifications (see attached patch) to remove the bashisms of the
following scripts (whose maintainers are CC'ed):

./development/cppcheck/cppcheck.SlackBuild
./libraries/Jinja2/Jinja2.SlackBuild
./libraries/gdal/gdal.SlackBuild
./libraries/python-musicbrainz2/python-musicbrainz2.SlackBuild
./office/go_openoffice/go_openoffice.SlackBuild
./office/adobe-reader-fontpacks/adobe-reader-fontpacks.SlackBuild
./network/skype/skype.SlackBuild
./network/ekiga/ekiga.SlackBuild
./network/ngrep/ngrep.SlackBuild
./desktop/openbox/openbox.SlackBuild
./desktop/synergy-plus/synergy-plus.SlackBuild
./desktop/vwm/vwm.SlackBuild
./misc/ophcrack/ophcrack.SlackBuild
./misc/dwdiff/dwdiff.SlackBuild
./multimedia/xbmc/xbmc.SlackBuild
./audio/herrie/herrie.SlackBuild
./games/jag/jag.SlackBuild
./games/openttd/openttd.SlackBuild
./games/yabause/yabause.SlackBuild
./games/worldofgoo/worldofgoo.SlackBuild
./graphics/yafaray/yafaray.SlackBuild
./graphics/fontmatrix/fontmatrix.SlackBuild
./graphics/djview4/djview4.SlackBuild
./graphics/mtpaint/mtpaint.SlackBuild
./graphics/tesseract/tesseract.SlackBuild
./academic/itex2mml/itex2mml.SlackBuild
./academic/grass/grass.SlackBuild
./academic/GMT/GMT.SlackBuild
./system/vice/vice.SlackBuild
./system/ksh/ksh.SlackBuild
./system/xen/xen.SlackBuild
./system/truecrypt/truecrypt.SlackBuild
./system/gpsd/gpsd.SlackBuild
./system/pdksh/pdksh.SlackBuild
./system/xf86-input-evtouch/xf86-input-evtouch.SlackBuild


By the way, I think it's worth nothing that the attached patch is a
result of a sed looking for the aforementioned inconsistencies with
test and the equals (see bellow) and that most of my tests were
limited to building the packages with set -x and looking for errors in
the output.


Sed used to "fix" the bashisms:
for f in `find . -type f -name *.SlackBuild | xargs egrep -l
"\[.*==.*\]|\[\[.*\]\]"`; do
  sed -i -e "s#\[\(.*\)==\(.*\)\]#\[\1=\2\]#g; s#if \[\[\(.*\)\]\]#if
\[\1\]#g; s#\[\[\(.*\)\]\]\([[:blank:]]\)\(&&|\|\|\)#\[\1\]\2#g" $f
done



Regards,

Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Remove-some-bashisms.patch.gz
Type: application/x-gzip
Size: 6434 bytes
Desc: not available
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20101030/a004d918/attachment-0001.bin>


More information about the SlackBuilds-users mailing list