Package: devscripts
Version: 2.11.5
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu precise ubuntu-patch

Dear Maintainer,

-- Package-specific info:

--- /etc/devscripts.conf ---

--- ~/.devscripts ---
DEBSIGN_KEYID=005E81F4


*** /home/steve/tmp/tmpH4sM5n/bug_body

(From https://bugs.launchpad.net/ubuntu/+source/devscripts/+bug/966867)

debsign from devscripts has broken the --debs-dir option:

  $ ls -ld ../source
  drwxrwxr-x 2 steve steve 4096 Mar 27 23:12 ../source
  $ debsign --debs-dir ../source -S
  debsign: could not find directory "../source"!

strace'ing debsign shows it trying to do:

  15372 stat("\"../source\"", 0x7fffbbc3bba0) = -1 ENOENT (No such file or 
directory)

(notice the extra \" in there.)

Looking at the source, when handling the option, it does the following:

        --debs-dir)
            shift
            opt_debsdir="$(echo \"${1%/}\" | sed -e 's%/\+%/%g')"

note that this is slightly different than how the default directory is
generated

  DEBRELEASE_DEBS_DIR="`echo \"$DEBRELEASE_DEBS_DIR\" | sed -e 's%/\+%/%g; 
s%\(.\)/$%\1%;'`"

in that the latter uses shell backticks rather than $() to run
subcommands. This will behave differently, at least under dash:

$ cat dash.sh
#!/bin/sh

FOO="$(echo \"foo bar\")"
BAR="`echo \"foo bar\"`"

$ sh -xe dash.sh
+ echo "foo bar"
+ FOO="foo bar"
+ echo foo bar
+ BAR=foo bar

Bash behaves similarly. Changing the opt_debsdir definition line to the
following:

  opt_debsdir="$(echo "${1%/}" | sed -e 's%/\+%/%g')"

(i.e. removing the backslash escaping of ") causes things to work as
expected.

Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise-proposed'), (500, 'precise')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-18-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru devscripts-2.11.5/scripts/debsign.sh devscripts-2.11.5ubuntu1/scripts/debsign.sh
--- devscripts-2.11.5/scripts/debsign.sh	2011-09-26 01:38:05.000000000 -0700
+++ devscripts-2.11.5ubuntu1/scripts/debsign.sh	2012-03-28 00:00:03.000000000 -0700
@@ -341,7 +341,7 @@
 		;;
 	--debs-dir)
 	    shift
-	    opt_debsdir="$(echo \"${1%/}\" | sed -e 's%/\+%/%g')"
+	    opt_debsdir="$(echo "${1%/}" | sed -e 's%/\+%/%g')"
 	    ;;
 	--no-conf|--noconf)
 		echo "$PROGNAME: $1 is only acceptable as the first command-line option!" >&2

Reply via email to