Package: fakechroot
Version: 2.9-1.2
Severity: normal

I think fakechroot is mistaken about how it wraps symlink(), because
it appears to not prepend the "oldpath" argument with the
FAKECHROOT_PATH if the FAKECHROOT_PATH is already present.  I think it
should go ahead and prepend it if the oldpath is already absolute.

Consider the following sequence of code:

 char buf[PATH_MAX];
 char *p = "/srv/test/foo";
 ssize_t sz;
 if (0 == symlink(p, "x")) {
   sz = readlink("x", buf, sizeof(buf) - 1);
   if (sz != -1) {
     buf[sz] = '\0';
     return strcmp(p, buf);
   }
 }

I think i would expect the final strcmp to return 0 on any reasonable
POSIX-compliant operating system.

However, if this code happens to be run from within a fakechroot that
is on the path to p (or is p itself), the two strings will fail
comparisons.

That is, something like:

 # make a test tree at /srv/test:
 cd /srv/test
 fakechroot /usr/sbin/chroot example

would make the above strcmp() return non-zero.

Consider:

0 wt...@pip:/srv/test$ fakechroot /usr/sbin/chroot /srv/test
r...@pip# ln -s /srv/test/foo bar
r...@pip# readlink bar
/foo
r...@pip# exit
0 wt...@pip:/srv/test$

I think the above readlink command should have returned /srv/test/foo.

      --dkg

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages fakechroot depends on:
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib

fakechroot recommends no packages.

fakechroot suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to