[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. debian/1.14.3-200-gb232f8a

Clint Adams schizo at debian.org
Tue Aug 23 13:06:11 UTC 2011


The following commit has been merged in the upstream branch:
commit 445aded15a55e73388d6a5851760236fee2fd520
Author: Clint Adams <schizo at debian.org>
Date:   Fri Oct 3 19:07:32 2008 -0400

    Patch from Joe Malicki (with root-cause analysis credit to Mike Itz) to
    cope better with inodes that are reused outside of fakeroot's knowledge
    (such as by ldconfig or other static binaries).  closes: #366067.

diff --git a/faked.c b/faked.c
index aedb884..a98b0b5 100644
--- a/faked.c
+++ b/faked.c
@@ -654,7 +654,27 @@ void process_chmod(struct fake_msg *buf){
   i = data_find(&buf->st, buf->remote);
   if (i != data_end()) {
     st = data_node_get(i);
-    st->mode = (buf->st.mode&~S_IFMT) | (st->mode&S_IFMT);
+    /* Statically linked binaries can remove inodes without us knowing.
+       ldconfig is a prime offender.  Also, some packages run tests without
+       LD_PRELOAD.
+
+       While those cases can be fixed in other ways, we shouldn't continue to
+       cache stale file information.
+
+       mknod() creates a regular file, everything else should have the same
+       file type on disk and in our database.  Therefore, we check to see if
+       it's a regular file before blindly applying the new file type.
+    */
+
+    if ((buf->st.mode&S_IFMT) != S_IFREG &&
+        (buf->st.mode&S_IFMT) != (st->mode&S_IFMT)) {
+      fprintf(stderr,"FAKEROOT: chmod mode=%lo incompatible with "
+              "existing mode=%lo\n", buf->st.mode, st->mode);
+      st->mode = buf->st.mode;
+    }
+    else{
+      st->mode = (buf->st.mode&~S_IFMT) | (st->mode&S_IFMT);
+    }
   }
   else{
     st=&buf->st;
diff --git a/test/Makefile.am b/test/Makefile.am
index 5f941ca..9a03d6f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 AUTOMAKE_OPTIONS=foreign
 
 TESTS = t.echoarg t.mknod t.tar t.truereturn t.falsereturn t.option \
-	t.touchinstall
+	t.touchinstall t.no_ld_preload
 
 suffix =
 TESTS_ENVIRONMENT = libfakeroot=libfakeroot-0.so suffix=$(suffix) posixshell=$(SHELL)
diff --git a/test/t.no_ld_preload b/test/t.no_ld_preload
new file mode 100755
index 0000000..b5cd729
--- /dev/null
+++ b/test/t.no_ld_preload
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
+ ${posixshell} -c 'touch justafile; LD_PRELOAD= rm justafile; mkdir justafile; ls -ld justafile' | grep "^d"

-- 
fakeroot



More information about the Fakeroot-commits mailing list