[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 bc043280c47539926fb278be76f3f7a0d1610b4c
Author: Clint Adams <schizo at debian.org>
Date: Sat Oct 4 14:35:48 2008 -0400
Patch from Joe Malicki to increase number of cases where fakeroot will cope better with inode reuse.
diff --git a/faked.c b/faked.c
index a98b0b5..1e38853 100644
--- a/faked.c
+++ b/faked.c
@@ -662,12 +662,17 @@ void process_chmod(struct fake_msg *buf){
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.
+ file type on disk and in our database. Therefore, we check the file's
+ type first. If we have something in our database as a device node and
+ we get a request to change it to regular file, it might be a chmod of
+ a device node that was created from within fakeroot, which is a device
+ file on disk - there's no way to distinguish. For anything else, we
+ trust the new type and assume the inode got unlinked from something that
+ wasn't using the LD_PRELOAD library.
*/
- if ((buf->st.mode&S_IFMT) != S_IFREG &&
- (buf->st.mode&S_IFMT) != (st->mode&S_IFMT)) {
+ if ((buf->st.mode&S_IFMT) != (st->mode&S_IFMT) &&
+ ((buf->st.mode&S_IFMT) != S_IFREG || (!st->mode&(S_IFBLK|S_IFCHR)))) {
fprintf(stderr,"FAKEROOT: chmod mode=%lo incompatible with "
"existing mode=%lo\n", buf->st.mode, st->mode);
st->mode = buf->st.mode;
diff --git a/test/Makefile.am b/test/Makefile.am
index 9a03d6f..e22b978 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.no_ld_preload
+ t.touchinstall t.no_ld_preload t.no_ld_preload_link t.chmod_dev
suffix =
TESTS_ENVIRONMENT = libfakeroot=libfakeroot-0.so suffix=$(suffix) posixshell=$(SHELL)
diff --git a/test/t.touchinstall b/test/t.chmod_dev
similarity index 52%
copy from test/t.touchinstall
copy to test/t.chmod_dev
index 612e00d..34d8c63 100755
--- a/test/t.touchinstall
+++ b/test/t.chmod_dev
@@ -2,7 +2,7 @@
mkdir tmp
../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
- ${posixshell} -c "touch tmp/iamnotuser; ls -al tmp/iamnotuser" | grep root
+ ${posixshell} -c 'mknod tmp/hda3 b 3 0 && chmod 644 tmp/hda3 && ls -ld tmp/hda3' | grep "^b"
TEMP=$?
-rm -r tmp
+rm -rf tmp
exit $TEMP
diff --git a/test/t.no_ld_preload b/test/t.no_ld_preload
index b5cd729..64a20f2 100755
--- a/test/t.no_ld_preload
+++ b/test/t.no_ld_preload
@@ -1,4 +1,8 @@
#!/bin/sh
+mkdir tmp
../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
- ${posixshell} -c 'touch justafile; LD_PRELOAD= rm justafile; mkdir justafile; ls -ld justafile' | grep "^d"
+ ${posixshell} -c 'touch tmp/justafile && LD_PRELOAD= rm tmp/justafile && mkdir tmp/justafile && ls -ld tmp/justafile' | grep "^d"
+TEMP=$?
+rm -rf tmp
+exit $TEMP
diff --git a/test/t.no_ld_preload_link b/test/t.no_ld_preload_link
new file mode 100755
index 0000000..be32114
--- /dev/null
+++ b/test/t.no_ld_preload_link
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+mkdir tmp
+../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
+ ${posixshell} -c 'touch tmp/justafile && ln -s justafile tmp/alink && LD_PRELOAD= rm tmp/alink && touch tmp/alink && ls -ld tmp/alink' | grep "^-"
+TEMP=$?
+rm -rf tmp
+exit $TEMP
--
fakeroot
More information about the Fakeroot-commits
mailing list