fakechroot icon indicating copy to clipboard operation
fakechroot copied to clipboard

glibc 2.33+ compatibility

Open lipnitsk opened this issue 4 years ago • 2 comments

Should fix #82 and similar

lipnitsk avatar Feb 23 '21 06:02 lipnitsk

I'm experiencing an issue where expand_chroot_path_at gets called twice per stat64, fstatat, and probably more stat functions. This only occurs with glibc 2.33 and this PR, when using fakeroot fakechroot chroot /some/dir some-command as opposed to fakechroot chroot /some/dir fakeroot some-command. Sadly, this means it's the more common and easier to use variation of the two that breaks.

Stepping through the call, I see the following trace

#0  0x00007ffff7f995e0 in stat64 () from [...]/lib/libfakeroot.so
#1  0x00007ffff7fb8d73 in stat64 () from [...]/lib/fakechroot/libfakechroot.so

and after one step this becomes

#0  0x00007ffff7fa8f70 in __xstat64 () from [...]/lib/fakechroot/libfakechroot.so
#1  0x00007ffff7fb8d73 in stat64 () from [...]/lib/fakechroot/libfakechroot.so

which shows the problem, because both of these functions expand the chroot path, which must only happen once. Note that glibc implements stat64 by calling __xstat64. Removing one is not an option because both need to be intercepted, but it seems that it would suffice for libfakechroot to implement its stat64 by calling its own __xstat64 directly. While duplicating a line from glibc isn't great, it's tiny and that code hasn't changed in 24 years. I don't know if it's the best idea, but it may do the job.

roberth avatar Oct 01 '21 10:10 roberth

Any update about merge this PR? 😋

kloczek avatar Jun 15 '22 17:06 kloczek