[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. 08ed00124d8b6b445d3b91a9aa15eec638b02f05
Clint Adams
schizo at debian.org
Sun Nov 15 03:17:31 UTC 2009
The following commit has been merged in the upstream branch:
commit 503020abfabbfefaa5d11ae17df7d4acfa7a6638
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