[oe] Use of == in shell scripts
Andreas Oberritter
obi at opendreambox.org
Tue Oct 26 15:31:12 UTC 2010
Dear all,
I noticed a common mistake in various OE recipes, classes and contrib
scripts: Instead of =, == is used as equality operator, in at least 91
places in 64 files (without recipes/obsolete: 83 in 60 files). This
isn't a problem with bash, but it isn't the standard syntax and at least
dash does not support it.
I used the following command line to find the occurences:
git grep 'if\s*\[.*==.*\]'
This command fixes all occurences:
for i in `git grep -l 'if\s*\[.*==.*\]'`; do
sed -i $i -e 's,\(if\s*\[.*\)==\(.*\]\),\1=\2,';
done
One of the matches is a false positive:
recipes/uclibc/uclibc-0.9.29/uClibc-0.9.29-nonposix_bashisms.patch
How do I submit such a patch? 60 patches may be too much for such a
relatively simple change, but, on the other hand, everything in a single
patch may be unhandy as well.
How about splitting it into 5 patches?
- classes (7 files)
- contrib (4 files)
- recipes/*/*.bb (24 files)
- recipes/*/*.inc (14 files)
- other files in recipes except recipes/obsolete (11 files)
Any opinions?
Regards,
Andreas
More information about the Openembedded-devel
mailing list