Skip to contentSkip to conversation

kbuild: deb-pkg fix install scripts for posix sh

PATCH In review maximilian attems 4 participants 4 messages Jul 5, 2009 – Jul 17, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: deb-pkg fix install scripts for posix sh

bash versus dash and posh disagree on expanding $@ within double quotes:
export x="$@"
see http://bugs.debian.org/381091 for details
just use the arglist with $*.

dpkg: error processing linux-image-2.6.31-rc1_2.6.31-rc1-18_i386.deb (--install):
subprocess pre-installation script returned error exit status 2
export: 6: 2.6.31-rc1-18: bad variable name
fixes http://bugzilla.kernel.org/show_bug.cgi?id=13567

seen on Ubuntu as there dash is the default sh, versus bash on Debian.

---
 scripts/package/builddeb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/package/builddeb +1 -1
index b19f1f4..8b357b0 100644
@@ -89,7 +89,7 @@ for script in postinst postrm preinst prerm ; do
 set -e
 
 # Pass maintainer script parameters to hook scripts
-export DEB_MAINT_PARAMS="\$@"
+export DEB_MAINT_PARAMS="\$*"
 
 test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d
 exit 0
Signature · 1 line
1.5.6.5
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · maximilian attems

bash versus dash and posh disagree on expanding $@ within double
quotes: export x="$@"
see http://bugs.debian.org/381091 for details
just use the arglist with $*.

[...]

scripts/package/builddeb for script in postinst postrm preinst prerm ; do · line 92

Quoted 10 lines
scripts/package/builddeb +1 -1
index b19f1f4..8b357b0 100644
@@ -89,7 +89,7 @@ for script in postinst postrm preinst prerm ; do
 set -e
 
 # Pass maintainer script parameters to hook scripts
-export DEB_MAINT_PARAMS="\$@"
+export DEB_MAINT_PARAMS="\$*"

Although blindly replacing "$@" by "$*" can cause regressions because they *do* expand differently [1], I do not see a problem in this case given that AFAIK Debian maintainer scripts only pass parameters without whitespace in them.

[1] $@ preserves quoting; try the following:
cat <<EOF >test.fjp
#! /bin/bash
for i in "$*"; do echo $i; done
for i in "$@"; do echo $i; done
EOF
chmod +x test.fjp
./test.fjp This "is a" test

Acked-by on v1 1/1
#2 lore raw
In reply to maximilian attems
Quoted 5 lines · On Sun, 5 Jul 2009 20:17:34 +0200 maximilian attems <[email protected]> wrote:

bash versus dash and posh disagree on expanding $@ within double
quotes: export x="$@"
see http://bugs.debian.org/381091 for details
just use the arglist with $*.

Quoted 8 lines

dpkg: error processing linux-image-2.6.31-rc1_2.6.31-rc1-18_i386.deb (--install): subprocess pre-installation script returned error exit status 2 export: 6: 2.6.31-rc1-18: bad variable name fixes http://bugzilla.kernel.org/show_bug.cgi?id=13567

seen on Ubuntu as there dash is the default sh,
versus bash on Debian.

This should be applied ASAP, as it breaks things for every ubuntu user who attempts to use 'make deb-pkg'.

Quoted 21 lines
---
 scripts/package/builddeb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/package/builddeb +1 -1
index b19f1f4..8b357b0 100644
@@ -89,7 +89,7 @@ for script in postinst postrm preinst prerm ; do
 set -e
 
 # Pass maintainer script parameters to hook scripts
-export DEB_MAINT_PARAMS="\$@"
+export DEB_MAINT_PARAMS="\$*"
 
 test -d $debhookdir/$script.d && run-parts --arg="$version"

$debhookdir/$script.d exit 0

#3 lore raw
In reply to maximilian attems
Quoted 10 lines · maximilian attems

bash versus dash and posh disagree on expanding $@ within double quotes:
export x="$@"
see http://bugs.debian.org/381091 for details
just use the arglist with $*.

dpkg: error processing linux-image-2.6.31-rc1_2.6.31-rc1-18_i386.deb (--install):
subprocess pre-installation script returned error exit status 2
export: 6: 2.6.31-rc1-18: bad variable name
fixes http://bugzilla.kernel.org/show_bug.cgi?id=13567

Quoted 7 lines

seen on Ubuntu as there dash is the default sh, versus bash on Debian.

Applied to kbuild-fixes.git

Sam