Package: qemu-user-static
Severity: normal
Tags: experimental patch

pbuilder passes arguments to qemu-debootstrap which it doesn't parse
correctly:

| # pbuilder --create --distribution sid --debootstrapopts --arch=armel 
--debootstrap qemu-debootstrap
|...
| I: running qemu-debootstrap
| /usr/bin/qemu-debootstrap
| I: Running command: debootstrap --arch armel --foreign --include=apt 
--variant=buildd --keyring /usr/share/keyrings/debian-archive-keyring.gpg sid . 
http://cdn.debian.net/debian
|...
| I: Running command: chroot sid /debootstrap/debootstrap --second-stage
| chroot: failed to run command `/debootstrap/debootstrap': No such file or 
directory
| E: qemu-debootstrap failed
| W: Aborting with an error

The bug is qemu-debootstrap can parse --keyring=foo but not --keyring foo. It
shifts all the arguments up by one, and thinks "sid" is the target, rather than
the distribution.

Patch attached.

SR

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_ZA.utf8, LC_CTYPE=en_ZA.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- old/qemu-debootstrap
+++ new/qemu-debootstrap
@@ -90,6 +90,14 @@
             die "option %s requires an argument" "$1"
         fi
       ;;
+      --keyring)
+        if [ $# -ge 2 -a -n "$2" ]; then
+            opts="$opts $(escape "$1") $(escape "$2")"
+            shift 2
+        else
+            die "option %s requires an argument" "$1"
+        fi
+      ;;
       --*)
         opts="$opts $(escape "$1")"
         shift
@@ -157,6 +165,6 @@
 
 eval run debootstrap --arch "$deb_arch" --foreign $opts $args
 mkdir -p "$target/usr/bin"
-cp $(which "qemu-$qemu_arch-static") "$target/usr/bin"
+run cp $(which "qemu-$qemu_arch-static") "$target/usr/bin"
 run chroot "$target" /debootstrap/debootstrap --second-stage
 

Reply via email to