Does not wrap *at() functions which makes fakechroot fail badly with Hardy

Bug #228534 reported by Martin Pitt
10
Affects Status Importance Assigned to Milestone
fakechroot (Debian)
Fix Released
Unknown
fakechroot (Ubuntu)
Fix Released
Undecided
Martin Pitt
Hardy
Fix Released
High
Martin Pitt
Intrepid
Fix Released
Undecided
Martin Pitt

Bug Description

Binary package hint: fakechroot

Using fakechroot to debootstrap and work with Ubuntu had worked fine until Gutsy. With Hardy it breaks completely, scripts fail with all sorts of weird errors, such as rm claiming that /etc/shells.tmp does not exist (although it does).

The reason is that Hardy's glibc and coreutils started to use the new *at() family of system calls, such as fxstatat(), openat(), etc., but fakechroot does not handle them at all. Thus paths are not converted to the fakechroot environment.

TEST CASE:
  sudo apt-get install fakechroot fakeroot
  mkdir /tmp/c
  cd /tmp/c
  mkdir bin lib
  cp /lib/*.so lib
  cp /bin/{bash,cp,rm,mkdir,echo,ls} bin
  fakeroot fakechroot chroot /tmp/c

Now try some commands in the chroot and see how many break with absolute path names:
  $ mkdir /test
  $ echo hello > /test/foo
  $ ls /test/foo
  /test/foo
  $ rm /test/foo
  rm: cannot remove `/test/foo': No such file or directory
  $ rm -r /test
  rm: cannot remove `/test': No such file or directory

They do work with relative paths:
  $ rm test/foo
  $ rm -r test

With the updated version of fakechroot, the ones with absolute path names work.

If you do not mind downloading some MB from the net, you can/should test debootstrapping:

   sudo apt-get install debootstrap
   fakeroot fakechroot debootstrap --variant=fakechroot hardy /tmp/hardy http://de.archive.ubuntu.com/ubuntu

(use your local mirror). This fails horribly with the fakechroot in hardy final, but should work with the hardy-proposed version.

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in Intrepid yesterday:

fakechroot (2.6-1.3ubuntu2) intrepid; urgency=low

  * src/libfakechroot.c:
    - Define openat(), to unbreak rm -r.
    - Define fchmodat(), to unbreak chmod.
    - Define fchownat(), to unbreak chown.
    This fixes everything which broke debootstrapping Hardy.
  * test/fakechroot.sh: Add cp, mkdir, chmod.

 -- Martin Pitt <email address hidden> Thu, 08 May 2008 22:13:43 +0200

fakechroot (2.6-1.3ubuntu1) intrepid; urgency=low

  * src/libfakechroot.c: Provide wrapping of unlinkat(), __fxstatat(), and
    __fxstatat64() to unbreak rm'ing absolute directories. This extends the
    original patch from Daniel Kahn Gillmor in Debian #473682. Still
    incomplete, since other *at() functions are still missing, but those are
    the most pressing which cause the Apport retracers to fail so badly.
  * test/fakechroot.sh: Add /bin/rm, and call bash instead of sh.

 -- Martin Pitt <email address hidden> Thu, 08 May 2008 20:45:48 +0200

Changed in fakechroot:
assignee: nobody → pitti
status: New → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

This breaks the apport retracers and makes fakechroot basically unusable in Hardy, thus I'd like to fix this properly in Hardy.

Changed in fakechroot:
assignee: nobody → pitti
importance: Undecided → High
status: New → In Progress
Martin Pitt (pitti)
description: updated
Revision history for this message
Martin Pitt (pitti) wrote :

Argh, my two uploads to intrepid yesterday were only tested on amd64. On i386 we need openat64(), too.

Changed in fakechroot:
status: Fix Released → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Proposed debdiff for hardy-proposed. Tested on i386 and amd64, debootstrapping hardy now works fine.

description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package fakechroot - 2.6-1.3ubuntu3

---------------
fakechroot (2.6-1.3ubuntu3) intrepid; urgency=low

  * src/libfakechroot.c: Define openat64(), to unbreak rm -r on i386, too.
    (LP: #228534)

 -- Martin Pitt <email address hidden> Fri, 09 May 2008 07:53:31 +0200

Changed in fakechroot:
status: Fix Committed → Fix Released
Changed in fakechroot:
status: Unknown → New
Revision history for this message
Martin Pitt (pitti) wrote :

Upload is in the queue, but waiting for ~motu-sru to accept.

Revision history for this message
John Dong (jdong) wrote :

ACK from motu-sru. Thanks for your contribution to Ubuntu ;-)

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into hardy-proposed, please test and give feedback here. Thank you!

Changed in fakechroot:
status: In Progress → Fix Committed
Revision history for this message
Pedro Villavicencio (pedro) wrote :

verification done:

- test with fakechroot (2.6-1.3), followed the test case, it indeed fails to delete files/directories with absolute paths on it throwing a "No such file or directory" error, however relative paths works.
- test with fakechroot proposed (2.6-1.3ubuntu0.1), followed the test case, it doesn't fails to perform the operation with absolute paths also the relative ones works as expected, bug is fixed, thanks.

Revision history for this message
Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in fakechroot:
status: Fix Committed → Fix Released
Changed in fakechroot:
status: New → Fix Committed
Changed in fakechroot:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.