Bug#1023286: fakeroot doesn't wrap __stat64_time64 (and friends) introduced by glibc 2.34 on 32 bit arches
On Tue, Nov 01, 2022 at 09:29:41PM +0100, Johannes Schauer Marin Rodrigues wrote: > Do you have a patch for fakeroot that I can try? You could try https://salsa.debian.org/clint/fakeroot/-/commit/4a946cdc5cba202f888deb4ad831b4a305df7978
Bug#1023286: fakeroot doesn't wrap __stat64_time64 (and friends) introduced by glibc 2.34 on 32 bit arches
Hi, Quoting Johannes Schauer Marin Rodrigues (2022-11-01 21:29:41) > Do you have a patch for fakeroot that I can try? to make sure this doesn't happen again and to allow for easier testing that this issue is fixed, I created a test case for fakeroot that shows the problem on i386 (but not on amd64): diff --git a/test/t.chown b/test/t.chown new file mode 100755 --- /dev/null +++ b/test/t.chown @@ -0,0 +1,15 @@ +#!/bin/sh +. ./defs || exit 1 + +mkdir $tmp + +# starting with glibc 2.34, __stat64_time64 is used on 32 bit architectures +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023286 +echo "echo foo > $tmp/bar && + echo baz > $tmp/blub && + chown --reference=$tmp/bar $tmp/blub && + stat -c owner:%u $tmp/blub" > $tmp/sh +run_fakeroot -- \ +${posixshell} $tmp/sh > $tmp/out +cat $tmp/out > /tmp/foo +grep "^owner:0$" /tmp/foo I also submitted this on salsa as a merge request where you can see in the pipeline results that the test suite passes on amd64 but not on i386: https://salsa.debian.org/clint/fakeroot/-/merge_requests/18 Thanks! cheers, josch signature.asc Description: signature
Bug#1023286: fakeroot doesn't wrap __stat64_time64 (and friends) introduced by glibc 2.34 on 32 bit arches
Hi, Quoting Clint Adams (2022-11-01 20:10:34) > On Tue, Nov 01, 2022 at 07:44:05PM +0100, Johannes Schauer Marin Rodrigues > wrote: > > the normal user "user" which suggests to me that the function is not > > wrapped by fakeroot even though it should. Other functions that might be > > interesting from glibc 2.34 and might need wrapping are > > __fstatat64_time64 and __lstat64_time64. > > If we only need to wrap the form with _time64 and not the one without, it > should be easy to add that to the WRAPPED for loop in configure.ac . only the form with _time64 is needed. On 64bit, __stat64_time64 is not used but just a simple stat() is done. I've had to wrap the same functions on 32 bit only in fakechroot as well https://github.com/dex4er/fakechroot/pull/108 Do you have a patch for fakeroot that I can try? Thanks! cheers, josch signature.asc Description: signature
Bug#1023286: fakeroot doesn't wrap __stat64_time64 (and friends) introduced by glibc 2.34 on 32 bit arches
On Tue, Nov 01, 2022 at 07:44:05PM +0100, Johannes Schauer Marin Rodrigues wrote: > the normal user "user" which suggests to me that the function is not > wrapped by fakeroot even though it should. Other functions that might be > interesting from glibc 2.34 and might need wrapping are > __fstatat64_time64 and __lstat64_time64. If we only need to wrap the form with _time64 and not the one without, it should be easy to add that to the WRAPPED for loop in configure.ac . If both need to be wrapped because some programs can be compiled to use the form without _time64, then those new functions need to be added to the SEARCH for loop, or somewhere else entirely.
Bug#1023286: fakeroot doesn't wrap __stat64_time64 (and friends) introduced by glibc 2.34 on 32 bit arches
Package: fakeroot Version: 1.29-1 Severity: important Control: affects -1 + mmdebstrap Hi, glibc 2.34 introduced several new functions on 32 bit arches which are used by coreutils since 9.1 which was built with glibc 2.34. Since these new functions are not wrapped by fakeroot, ownership information will be wrong on 32 bit arches like i386 or armhf. To show what should happen, lets run this on amd64: mmdebstrap --arch=amd64 --include=fakeroot,adduser --variant=apt \ --customize-hook='chroot "$1" adduser --gecos user --disabled-password user' \ --customize-hook='chroot "$1" runuser -u user -- /bin/bash' \ unstable /dev/null [...] user@hoothoot:/$ whoami user user@hoothoot:/$ fakeroot /bin/bash root@hoothoot:/# whoami root root@hoothoot:/# cd /tmp/ root@hoothoot:/tmp# echo foo > bar root@hoothoot:/tmp# echo baz > blub root@hoothoot:/tmp# chown --reference=/tmp/bar blub root@hoothoot:/tmp# ls -lha bar blub -rw-r--r-- 1 root root 4 Nov 1 18:39 bar -rw-r--r-- 1 root root 4 Nov 1 18:39 blub Success! Both files are owned by the (fake) root user. And now lets run it on i386: $ mmdebstrap --arch=i386 --include=fakeroot,adduser --variant=apt \ --customize-hook='chroot "$1" adduser --gecos user --disabled-password user' \ --customize-hook='chroot "$1" runuser -u user -- /bin/bash' \ unstable /dev/null [...] user@hoothoot:/$ whoami user user@hoothoot:/$ fakeroot /bin/bash root@hoothoot:/# whoami root root@hoothoot:/# cd /tmp/ root@hoothoot:/tmp# echo foo > bar root@hoothoot:/tmp# echo baz > blub root@hoothoot:/tmp# chown --reference=/tmp/bar blub root@hoothoot:/tmp# ls -lha bar blub -rw-r--r-- 1 root root 4 Nov 1 18:26 bar -rw-r--r-- 1 user user 4 Nov 1 18:26 blub The file blub is not owned by the fake root user but by the outer user "user". This is incorrect. When investigating what is going on I found that the "chown" command calls __stat64_time64 on i386 which will return the normal user "user" which suggests to me that the function is not wrapped by fakeroot even though it should. Other functions that might be interesting from glibc 2.34 and might need wrapping are __fstatat64_time64 and __lstat64_time64. This is breaking my package mmdebstrap. Thanks! cheers, josch