Bug#291107: kernel-patch-debian-2.6.9: bashism in apply/debian file
On Tue, Jan 18, 2005 at 08:37:21PM +0100, Roberto Suarez Soto wrote:
> Package: kernel-patch-debian-2.6.9
> Version: 2.6.9-5
> Severity: normal
>
> The file apply/debian (/usr/src/kernel-patches/all/2.6.9/apply/debian
> in my system) has a bashism in line 160:
>
> for base in $((cd $home/series/ && ls -d *) | sort -rnt- -k 2); do
>
> I have dash as /bin/sh. So, when I try to apply the patch with
> "make-kpkg --added-patches debian", it goes like this:
>
> /usr/src/kernel-patches/all/2.6.9/apply/debian: 160: Syntax error: Missing '))'
>
> I think the solution would be to change the "$(...)" stuff for a
> backquote block (i.e., "`...`") or to specify /bin/bash as the shell
> to use with this script. I've opted for the latter, but the former
> looks prettier :-)
Wow, nobody notices this for months then two in one day.
I just made a fix for this and sent it to #291039. Could you
please test out the attached patch and see if it works for you.
I agree that this is not a good state for things to be in.
--
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: