Package: fakechroot
Version: 2.5-1.1
Severity: important

Inside fakechroot, make displays 

 make[1]: Entering directory `/home/eichin/....'

ie. it display the *outside* path.  Yet a Makefile target running pwd
gives the correct value.  (I was hunting this down in search of
another problem...)

Turns out that this is a fakeroot bug.  getcwd is documented in
getcwd(3) as:

       The  getcwd() function copies an absolute pathname of the current work-
       ing directory to the array pointed to by buf, which is of length  size.
 
Note that further on, the man page only suggests the return value as
having meaning in two cases: it's NULL if the call can't fit the path
in the buffer, and a linux-specific hack of having getcwd malloc() the
value if buf is NULL.

gnu make, being quite portable code, simply calls:
      if (getcwd (current_directory, GET_PATH_MAX) == 0)

and expects current_directory to have the desired value.

fakechroot-2.5/src/libfakechroot.c #define narrow_chroot_path, in the
typical ("not in /") case, does this:

                        (path) = ((path) + strlen(fakechroot_path)); \

ie. returns a pointer that skips over the prefix.  "That's Not Right" :-)

The obvious fix is to do something like

   memmove(path, path+strlen(fakechroot_path), 
1+strlen(path)-strlen(fakechroot_path))

instead, though I have not tested this.  I've also noted that bash
uses the "return value ignored" form in the only two places it
actually calls the function, so builtins probably have buggy behaviour
here too:

./parse.y:4146:             if (getcwd (t_string, sizeof(t_string)) == 0)
./jobs.c:355:      dir = getcwd (d, sizeof(d));
                   if (dir)
                      dir = d;

(I went digging for this in search of an explanation for a
   /bin/sh: line 1: cd: .: No such file or directory
 message from deep in a fakeroot/fakechroot/pdebuild/pbuilder/dpkg-buildpackage
 stack, and will see if this helps shortly... but since it's clearly
 wrong even if it doesn't, I figured I'd get the bug report out the
 door promptly.)



-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.1manekineko
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages fakechroot depends on:
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries

fakechroot recommends no packages.

-- no debconf information


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

Reply via email to