Bug#256100: XSI:isms in debian/update-grub and util/mkbimage

David Weinehall David Weinehall <tao@debian.org>, 256100-maintonly@bugs.debian.org
Fri, 25 Jun 2004 02:17:59 +0200


Package: grub
Version: 0.94+cvs20040511-1
Severity: minor
Tags: patch upstream

debian/update-grub and util/mkbimage contains use of XSI:isms `-a' and
`-o'.  The included patch fixes this.  Note that the extra ()'s in the
new version is because of the strict left-to-right precedence in
shell-scripts.


Regards: David Weinehall

diff -ur grub-0.94+cvs20040511-old/debian/update-grub grub-0.94+cvs20040511/debian/update-grub
--- grub-0.94+cvs20040511-old/debian/update-grub	2004-06-24 12:55:30.000000000 +0300
+++ grub-0.94+cvs20040511/debian/update-grub	2004-06-25 03:10:15.000000000 +0300
@@ -397,15 +397,15 @@
 
 	# this code only works if you stay only with kernel-image kernels.
 
-	if [ ! $v1words -eq 6 -a $v1smp -eq 0 -o ! $v1words -eq 7 -a $v1smp -eq 1 ]; then 
+	if ( [ ! $v1words -eq 6 ] && [ $v1smp -eq 0 ] ) || ( [ ! $v1words -eq 7 ] && [ $v1smp -eq 1 ] ); then 
 		v1=$(echo $v1| cut -d" " -f1-4)" 0 "$(echo $v1| cut -d" " -f5-)
 	fi
-	if [ ! $v2words -eq 6 -a $v2smp -eq 0 -o ! $v2words -eq 7 -a $v2smp -eq 1 ]; then 
+	if ( [ ! $v2words -eq 6 ] && [ $v2smp -eq 0 ] ) || ( [ ! $v2words -eq 7 ] && [ $v2smp -eq 1 ] ); then 
 		v2=$(echo $v2| cut -d" " -f1-4)" 0 "$(echo $v2| cut -d" " -f5-)
 	fi
 
 	result=0; v1finished=0; v2finished=0;
-	while [ $result -eq 0 -a $v1finished -eq 0 -a $v2finished -eq 0 ];
+	while [ $result -eq 0 ] && [ $v1finished -eq 0 ] && [ $v2finished -eq 0 ];
 	do
 		if [ "$v1" = "" ]; then
 			v1comp=0; v1finished=1
@@ -645,7 +645,7 @@
 	newerKernels=""
 	for i in $sortedKernels ; do
 		res=$(CompareVersions "$kern" "$i")
-		if [ "$kern" != "" -a "$res" -gt 0 ] ; then
+		if [ "$kern" != "" ] && [ "$res" -gt 0 ] ; then
 			newerKernels="$newerKernels $kern $i"
 			kern=""
 		else
diff -ur grub-0.94+cvs20040511-old/util/mkbimage grub-0.94+cvs20040511/util/mkbimage
--- grub-0.94+cvs20040511-old/util/mkbimage	2004-04-29 22:45:11.000000000 +0300
+++ grub-0.94+cvs20040511/util/mkbimage	2004-06-25 03:11:01.000000000 +0300
@@ -232,10 +232,10 @@
 
 if [ ! "$image_type" ]; then
 	image_type=hd;
-elif [ "$image_type" != "1.20" -a "$image_type" != "1.44" \
-  -a "$image_type" != "1.60" -a "$image_type" != "1.68" \
-  -a "$image_type" != "2.88" -a "$image_type" != "1.74" \
-  -a "$image_type" != "hd" -a "$image_type" != "1.60" ] ; then
+elif [ "$image_type" != "1.20" ] && [ "$image_type" != "1.44" ] \
+  && [ "$image_type" != "1.60" ] && [ "$image_type" != "1.68" ] \
+  && [ "$image_type" != "2.88" ] && [ "$image_type" != "1.74" ] \
+  && [ "$image_type" != "hd" ] && [ "$image_type" != "1.60" ] ; then
   error wrong_type ;
 fi