Source: glibc
Version: 2.34-1
Severity: normal
X-Debbugs-Cc: jo...@debian.org
Control: affects -1 + fakechroot mmdebstrap

Hi,

ultimately this probably needs to be fixed in fakechroot but I need some
help solving this problem from somebody who understands glibc.

Since the upload of glibc 2.34, getpwnam (and friends) under fakechroot
are not wrapped anymore. This means that instead of accessing
/etc/passwd from the chroot, the version from the host will be accessed,
leading to incorrect behaviour.

Since mmdebstrap uses fakechroot, this problem affects mmdebstrap as
well and breaks its autopkgtest.

There was a similar problem in the past. See
https://bugs.debian.org/993946 which in the end was fixed by letting
fakechroot wrap __nss_files_fopen.

I bisected glibc from git between 2.33 and 2.34 and found out, that this
fix broke again in this commit:

https://sourceware.org/git/?p=glibc.git;a=commit;h=6212bb67f4695962748a5981e1b9fea105af74f6

Do you have any idea why this commit is responsible and what fakechroot
could do to fix it? Attached the script I used to setup a minimal chroot
to bisect glibc git (this is for future-me in case I need to do this
ever again in the future).

Thanks!

cheers, josch

#!/bin/sh
set -e
rm -rf /install ./*
/glibc/configure --prefix=/usr && make -j
wget -c 
http://snapshot.debian.org/archive/debian/20211216T150239Z/pool/main/f/fakechroot/fakechroot_2.20.1%2Bds-2_all.deb
wget -c 
http://snapshot.debian.org/archive/debian/20211216T150239Z/pool/main/f/fakechroot/libfakechroot_2.20.1%2Bds-2_amd64.deb
mkdir -p /install/bin /install/lib /install/lib64 /install/dev /install/usr/lib
ln -s ../lib/ld.so /install/lib64/ld-linux-x86-64.so.2
ln -s ../../lib64 /install/usr/lib/x86_64-linux-gnu
ln -s ../bin /install/usr/bin
cp /bin/dash /install/bin/sh
cp ./elf/ldconfig /install/bin/
cp /usr/bin/seq /usr/bin/env /bin/bash /usr/bin/tr /usr/bin/basename 
/usr/bin/getopt /usr/sbin/chroot /bin/echo /install/bin/
cp -a /lib/x86_64-linux-gnu/libtinfo.so.6.2 /install/lib64
ln -s libtinfo.so.6.2 /install/lib64/libtinfo.so.6
cp ./elf/ld.so /install/lib
find -name '*.so' -or -name '*.so.*' | xargs -I'{}' cp '{}' /install/lib64
dpkg-deb --fsys-tarfile fakechroot_2.20.1+ds-2_all.deb | tar -C /install 
--keep-directory-symlink -x
dpkg-deb --fsys-tarfile libfakechroot_2.20.1+ds-2_amd64.deb | tar -C /install 
--keep-directory-symlink -x
cp /fakechroot/test/src/test-nss_files_fopen /install/bin/
cp -a /install /chroot
mv /chroot /install/chroot
echo "user:x:1337:1337:user:/home/user:/bin/bash" > /install/chroot/etc/passwd
chroot /install fakechroot --lib 
/usr/lib/x86_64-linux-gnu/fakechroot/libfakechroot.so /bin/chroot /chroot 
/bin/test-nss_files_fopen user

Reply via email to