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

Bug#291039: kernel-patch-debian-2.6.10: bashism in apply file



On Tue, Jan 18, 2005 at 07:48:38PM +0900, Kenshi Muto wrote:
> Package: kernel-patch-debian-2.6.10
> Severity: normal
> Version: 2.6.10-3
> 
> When I tried to build kernel 2.6.10 from debian source, I got following message.
> 
> /usr/src/kernel-patches/all/2.6.10/apply/debian 2.6.10-3
> /usr/src/kernel-patches/all/2.6.10/apply/debian: 160: Syntax error: Missing '))'
> 
> I'm using dash as sh.
> I think patch-code should use #!/bin/bash or be fixed for plain bourne shell.

Agreed, could you take a moment to see if the
attached patch resolves your problem.

-- 
Horms
Index: apply
===================================================================
--- apply	(revision 2324)
+++ apply	(working copy)
@@ -38,7 +38,7 @@
 }
 		
 apply_patch() {
-	patch=$(find_patch $home/$1)
+	patch=`find_patch $home/$1`
 	base=$1
 	if uncompress_patch "$patch" | patch -p1 -f -s -t --no-backup-if-mismatch; then
 		printf "%-${length}s\tOK (+)\n" "$base"
@@ -49,7 +49,7 @@
 }
 
 deapply_patch() {
-	patch=$(find_patch $home/$1)
+	patch=`find_patch $home/$1`
 	base=$1
 	if uncompress_patch "$patch" | patch -p1 -f -s -t -R --no-backup-if-mismatch; then
 		printf "%-${length}s\tOK (-)\n" "$base"
@@ -68,7 +68,7 @@
 			+) deapply_patch $patch ;;
 			-) apply_patch $patch ;;
 			X)
-				bakfile="$(dirname $patch)/.$(basename $patch).bak"
+				bakfile="`dirname $patch`/.`basename $patch`.bak"
 				if [ -f "$bakfile" ]; then
 					mv -f "$bakfile" "$patch"
 					printf "%-${length}s\tRESTORED (X)\n" "$patch"
@@ -78,7 +78,7 @@
 			;;
 		esac
 	done 
-	echo "--> $(basename $series) fully unapplied."
+	echo "--> `basename $series` fully unapplied."
 }
 
 patch_series() {
@@ -90,7 +90,7 @@
 			+) apply_patch $patch ;;
 			-) deapply_patch $patch ;;
 			X)
-				bakfile="$(dirname $patch)/.$(basename $patch).bak"
+				bakfile="`dirname $patch`/.`basename $patch`.bak"
 				if [ -f "$patch" ]; then
 					mv -f "$patch" "$bakfile"
 					printf "%-${length}s\tREMOVED (X)\n" "$patch"
@@ -100,7 +100,7 @@
 			;;
 		esac
 	done < $series
-	echo "--> $(basename $series) fully applied."
+	echo "--> `basename $series` fully applied."
 }
 
 if ! [ -d Documentation ] || ! [ -d kernel ]; then
@@ -116,7 +116,7 @@
 home=${home:-/usr/src/kernel-patches/all/$upstream/debian}
 
 if [ -f version.Debian ]; then
-	current=$(cat version.Debian)
+	current=`cat version.Debian`
 	current_rev=${current#*-}
 	current_up=${current%-*}
 
@@ -139,8 +139,7 @@
 	die "Upstream $target_up doesn't match $upstream!"
 # We don't have that version out yet!
 elif [ ! -n "$target_rev" ] || ( [ "$target_rev" != "$target" ] && [ $target_rev -gt $revision ] ); then
-	year=$(($(date +%Y) + 1))
-	die "Can't patch to nonexistent revision $target_rev (wait until $year)"
+	die "Can't patch to nonexistent revision $target_rev"
 fi
 
 # At this point, we must handle three cases.
@@ -157,7 +156,7 @@
 		exit 0
 	fi
 
-	for base in $((cd $home/series/ && ls -d *) | sort -rnt- -k 2); do
+	for base in `(cd $home/series/ && ls -d *) | sort -rnt- -k 2` do
 		srev=${base#*-}
 		if [ -n "$srev" ]; then
 			if [ $srev -le $current_rev ]; then
@@ -168,7 +167,7 @@
 		fi
 	done
 elif [ "$current_rev" = "$upstream" ] || [ $target_rev -gt $current_rev ]; then
-	for base in $((cd $home/series/ && ls -d *) | sort -nt- -k 2); do
+	for base in `(cd $home/series/ && ls -d *) | sort -nt- -k 2`; do
 		srev=${base#*-}
 		if [ -n "$srev" ]; then
 			if [ $srev -gt $current_rev ] && [ $srev -le $target_rev ]; then
@@ -182,7 +181,7 @@
 	echo "Nothing to do, exiting."
 	exit 0
 elif [ $target_rev -lt $current_rev ]; then
-	for base in $((cd $home/series/ && ls -d *) | sort -rnt- -k 2); do
+	for base in `(cd $home/series/ && ls -d *) | sort -rnt- -k 2`; do
 		srev=${base#*-}
 		if [ -n "$srev" ]; then
 			# -gt because you don't want to unapply the target series

Reply to: