Package: autopkgtest
Version: 1.2.0
Severity: normal
Tags: patch

*** Please type your report below this line ***
dt-virt-chroot fails to work in "chroot" mode due to how
it passes arguments to chroot(8).

I was trying to verify package by following command:

  # piuparts -v -d sid --adt-virt "adt-virt-chroot -d
/d/lib/ve/sid64-pb-1" <mypackage>.deb

However, because of following code in adt-virt-chroot and
VirtSubproc.py, it fails with following errors:

  === CODE #1: adt-virt-chroot ===
  53 chroot_arg = args[0]
  54 if not chroot_arg: pe("chroot specification may not be empty")
  55 if chroot_arg == '=': down = ['dchroot','-q']
  56 elif chroot_arg == '=': down = ['dchroot','-q']
  57 elif chroot_arg[0] == '=': down = ['dchroot','-q','-c',chroot_arg[1:]]
  58 elif chroot_arg[0] == '/': down = ['chroot',chroot_arg,'--']
  59 else: pe("chroot spec must be =[DCHROOT] or /PATH/TO/CHROOT")

  === ERR #1: chroot errors with invalid "--" arg ===
  <VirtSubproc>: debug: executing open
  <VirtSubproc>: debug:  ++ chroot /d/lib/ve/sid64-pb-1 -- true
  chroot: cannot run command `--': No such file or directory
  <VirtSubproc>: debug: cleanup...

As error message shows, chroot(8) does not handle "--" as
end-of-option string. The fix is simply remove "--" from line #58.

  === CODE #2: VirtSubproc.py ===
  105 def execute(cmd_string, cmd_list=[], downp=False, outp=False,
timeout=0):
  106 cmdl = cmd_string.split()
  ...
  114 cmd = cmdl + cmd_list
  115 if len(perhaps_down): cmd = perhaps_down + [' '.join(cmd)]
  116
  117 (status, out) = execute_raw(cmdl[0], None, timeout,
  118                             cmd, stdout=stdout)

  === ERR #2: Error trying to run file named "mktemp<SPC>-t<SPC>-d" ===
  <VirtSubproc>: debug: executing open
  <VirtSubproc>: debug:  ++ chroot /d/lib/ve/sid64-pb-1 true
  <VirtSubproc>: debug:  ++ chroot /d/lib/ve/sid64-pb-1 mktemp -t -d
  chroot: cannot run command `mktemp -t -d': No such file or directory
  <VirtSubproc>: debug: cleanup...

Because "mktemp -t -d" is joined as single filename instead of as
an array of cmd+args, chroot fails to find such file. The fix is
to cut "join"ing in line #115. Note this BUG #2 happens only after
ERR #1 is fixed.

By fixing above two, adt-virt-chroot should now be able to work with
piuparts for chroot-based autopkgtest-ing. However, due to different
issue in piuparts, this fix is not self-complete - additional fix is
needed for piuparts to change how piuparts (wrongly?) expects adt-run
to behave.

# For example, piuparts hardcodes path "/ADT-VIRT" as chroot tree,
# and it also refuses to accept "--keep-source-list" option because
# it believes it is NOT using chroot when "--adt-virt" mode is selected.

Best Regards,
Taisuke Yamada (http://labs.aobac.net/debian/)

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

Kernel: Linux 2.6.26-1-openvz-amd64 (SMP w/4 CPU cores)
Locale: LANG=ja_JP.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages autopkgtest depends on:
ii  python2.4                     2.4.6-1    An interactive high-level
object-o

Versions of packages autopkgtest recommends:
ii  apt-utils                     0.7.19     APT utility programs

Versions of packages autopkgtest suggests:
pn  autopkgtest-xenlvm            <none>     (no description available)
ii  curl                          7.18.2-5   Get a file from an HTTP,
HTTPS or

-- no debconf information
--- adt-virt-chroot.org 2009-03-17 13:24:23.000000000 +0900
+++ adt-virt-chroot     2009-03-17 15:22:58.000000000 +0900
@@ -55,7 +55,7 @@
        if chroot_arg == '=': down = ['dchroot','-q']
        elif chroot_arg == '=': down = ['dchroot','-q']
        elif chroot_arg[0] == '=': down = ['dchroot','-q','-c',chroot_arg[1:]]
-       elif chroot_arg[0] == '/': down = ['chroot',chroot_arg,'--']
+       elif chroot_arg[0] == '/': down = ['chroot',chroot_arg]
        else: pe("chroot spec must be =[DCHROOT] or /PATH/TO/CHROOT")
 
        if opts.gain_root != None:
--- VirtSubproc.py.org  2009-03-17 13:38:17.000000000 +0900
+++ VirtSubproc.py      2009-03-17 15:22:27.000000000 +0900
@@ -112,7 +112,7 @@
        else: stdout = None
 
        cmd = cmdl + cmd_list
-       if len(perhaps_down): cmd = perhaps_down + [' '.join(cmd)]
+       if len(perhaps_down): cmd = perhaps_down + cmd
 
        (status, out) = execute_raw(cmdl[0], None, timeout,
                                cmd, stdout=stdout)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to