Package: fakechroot
Version: 2.5-1.1.20070227-1
Severity: normal

(again, that's a local build version, but it is based on 2.5-1.1 with
patches from other current bugs.)

The execve wrapper, correctly, expands the actual-filename argument
because the kernel needs an unfake name.  It then looks for a #! line,
and if it finds one, expands the interpreter name.  However, it then
re-expands actual-filename when it adds it to the constructed command
line... which is wrong on two counts:
  1. It's already been expanded once already by that point
  2. It shouldn't *get* expanded, since the interpreter will be calling
     wrapped-open on it anyway...

Test case:

   $ fakeroot fakechroot debootstrap --variant=fakechroot sarge /tmp/testroot
   $ fakeroot fakechroot chroot /tmp/testroot
   # cat >> /tmp/foo.sh
   #!/bin/sh
   echo $0
   dirname "$0"
   dir=`dirname "$0"`
   echo `cd "$dir"; pwd`
   # chmod +x /tmp/foo.sh
   # /tmp/foo.sh
   /tmp/testroot/tmp/foo.sh
   /tmp/testroot/tmp
   /tmp/testroot/tmp
   # exit

(It's only the "echo $0" that matters, the test is just cooked down
from what tomcat's jasper.sh actually does.)

The fixed version, which is basically

+    const char *fake_filename = filename;
-    expand_chroot_path(filename, fakechroot_path, fakechroot_ptr, 
fakechroot_buf);
-    newargv[n++] = filename;
+    newargv[n++] = fake_filename;

Causes the output to be

   /tmp/foo.sh
   /tmp
   /tmp

which is (by inspection) correct.


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.15-mc2
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages fakechroot depends on:
ii  libc6                 2.3.2.ds1-22sarge4 GNU C Library: Shared libraries an

-- debconf-show failed


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to