Package: fakeroot
Version: 1.32.2-1+b1
Severity: important
Tags: patch upstream
Hello,
I couldn't find the upstream for fakeroot, so reporting here.
I was getting testsuite issues on hurd-amd64, the t.tar test would fail:
13c13
< rw-r--r-- root/root 0 tar/1.file
---
> rw-r--r-- daemon/sys 0 tar/1.file
18c18
< rw-r--r-- root/root 0 tar/3.file
---
> rw-r--r-- daemon/sys 0 tar/3.file
20c20
< rw-r--r-- root/root 0 tar/5.file
---
> rw-r--r-- daemon/sys 0 tar/5.file
24c24
< rw-r--r-- root/root 0 tar/fjsdk.file
---
> rw-r--r-- daemon/sys 0 tar/fjsdk.file
35c35
< rw-r--r-- root/root 0 tar/vn.34.654l..file
---
> rw-r--r-- daemon/sys 0 tar/vn.34.654l..file
It seems like fakeroot is not catching file removals and the inode cache
gets confused. Indeed coreutils now uses renameat2, which fakeroot
doesn't divert yet. The attach patch implements that and indeed fixes
the test.
Samuel
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'unreleased'),
(500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500,
'oldstable-proposed-updates-debug'), (500, 'oldstable-proposed-updates'), (500,
'oldoldstable-proposed-updates'), (500, 'oldoldstable'), (500,
'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1,
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64
Kernel: Linux 6.7.0 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages fakeroot depends on:
ii libc6 2.37-13
ii libfakeroot 1.32.2-1+b1
fakeroot recommends no packages.
fakeroot suggests no packages.
-- no debconf information
Index: fakeroot-1.32.2/config.h.in
===================================================================
--- fakeroot-1.32.2.orig/config.h.in
+++ fakeroot-1.32.2/config.h.in
@@ -144,6 +144,9 @@
/* Define to 1 if you have the `renameat' function. */
#undef HAVE_RENAMEAT
+/* Define to 1 if you have the `renameat2' function. */
+#undef HAVE_RENAMEAT2
+
/* have the semun union */
#undef HAVE_SEMUN_DEF
Index: fakeroot-1.32.2/configure.ac
===================================================================
--- fakeroot-1.32.2.orig/configure.ac
+++ fakeroot-1.32.2/configure.ac
@@ -360,7 +360,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
],[ AC_MSG_RESULT([no])
])
-AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat
unlinkat lchmod fgetattrlist)
+AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat
renameat2 unlinkat lchmod fgetattrlist)
save_LIBS="$LIBS"
# Linux
Index: fakeroot-1.32.2/libfakeroot.c
===================================================================
--- fakeroot-1.32.2.orig/libfakeroot.c
+++ fakeroot-1.32.2/libfakeroot.c
@@ -1382,6 +1382,29 @@ int renameat(int olddir_fd, const char *
return 0;
}
#endif /* HAVE_RENAMEAT */
+#ifdef HAVE_RENAMEAT2
+int renameat2(int olddir_fd, const char *oldpath,
+ int newdir_fd, const char *newpath, unsigned int flags){
+ int r,s;
+ INT_STRUCT_STAT st;
+
+ /* If newpath points to an existing file, that file will be
+ unlinked. Make sure we tell the faked daemon about this! */
+
+ /* we need the st_new struct in order to inform faked about the
+ (possible) unlink of the file */
+
+ r=INT_NEXT_FSTATAT(newdir_fd, newpath, &st, AT_SYMLINK_NOFOLLOW);
+
+ s=next_renameat2(olddir_fd, oldpath, newdir_fd, newpath, flags);
+ if(s)
+ return -1;
+ if(!r)
+ INT_SEND_STAT(&st,unlink_func);
+
+ return 0;
+}
+#endif /* HAVE_RENAMEAT2 */
#endif /* HAVE_FSTATAT */
Index: fakeroot-1.32.2/wrapfunc.inp
===================================================================
--- fakeroot-1.32.2.orig/wrapfunc.inp
+++ fakeroot-1.32.2/wrapfunc.inp
@@ -203,6 +203,9 @@ mkdirat;int;(int dir_fd, const char *pat
#ifdef HAVE_RENAMEAT
renameat;int;(int olddir_fd, const char *oldpath, int newdir_fd, const char
*newpath);(olddir_fd, oldpath, newdir_fd, newpath)
#endif /* HAVE_RENAMEAT */
+#ifdef HAVE_RENAMEAT2
+renameat2;int;(int olddir_fd, const char *oldpath, int newdir_fd, const char
*newpath, unsigned int flags);(olddir_fd, oldpath, newdir_fd, newpath, flags)
+#endif /* HAVE_RENAMEAT2 */
#ifdef HAVE_UNLINKAT
unlinkat;int;(int dir_fd, const char *pathname, int flags);(dir_fd, pathname,
flags)
#endif /* HAVE_UNLINKAT */