Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All changes to fakechroot we carry in Debian for glibc >= 2.37 #104

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

josch
Copy link

@josch josch commented Aug 24, 2022

I'm creating this merge request to keep track of the patch stack we carry in Debian on top of fakechroot 2.20.1.

These are mostly the same patches that are also applied by Fedora: https://src.fedoraproject.org/rpms/fakechroot

This pull request contains commits from the following pull requests:

As well as the last useful commit that was pushed to master since the release of 2.20.1: b42d1fb

This is the current patch stack in Debian: https://sources.debian.org/src/fakechroot/unstable/debian/patches/

@josch josch force-pushed the debian branch 3 times, most recently from d28622c to e2e1622 Compare August 25, 2022 11:58
@sergiomb2
Copy link

First commit is already in master , can you rebase with master please?

lugia-kun and others added 6 commits October 28, 2022 21:24
Starting with glibc 2.32 the compat nss module for getpwnam calls
__nss_files_fopen (which is a GLIBC_PRIVATE symbol provided by glibc)
instead of fopen (see 299210c1fa67e2dfb564475986fce11cd33db9ad). This
leads to getpwnam calls accessing /etc/passwd from *outside* the chroot
and as a result programs like adduser do not work correctly anymore
under fakechroot.

Starting with glibc 2.34 the __nss_files_fopen was moved from nss to
libc.so and thus wrapping it with LD_PRELOAD has no affect anymore
(see 6212bb67f4695962748a5981e1b9fea105af74f6).

So now we also wrap all the functions accessing /etc/passwd, /etc/group
and /etc/shadow. This solution will ignore NIS, LDAP or other local files
as potentially configured in /etc/nsswitch.conf.

dex4er#98
@sergiomb2
Copy link

sergiomb2 commented Oct 29, 2022

as note #98 for glibc 2.32 added src/__nss_files_fopen.c and later for glibc 2.34 remove it

@josch
Copy link
Author

josch commented Oct 31, 2022

I added two more commits which are needed to prevent #107 under glibc 2.34.

@sergiomb2
Copy link

I added two more commits which are needed to prevent #107 under glibc 2.34.

It failed to build on "../build-aux/test-driver: line 107: ./t/rm.t: Permission denied".
I just hat modify the file permissions (mode) to 755 [1] to fix the build , everything else is fine .

Thank you.

[1]
diff --git a/test/t/rm.t b/test/t/rm.t
new file mode 100755

@josch
Copy link
Author

josch commented Jan 31, 2023

Thank you @sergiomb2 I added the executable flag to the test.

I also added a new commit that fixes ldd.fakechroot on mips64el, ppc64el and s390x -- see #111 for details.

@josch josch force-pushed the debian branch 3 times, most recently from 30d6b95 to fc707f6 Compare February 2, 2023 17:00
josch added 4 commits February 6, 2023 10:46
 - test/t/rm.t will fail under glibc 2.34 unless __stat64_time64 functions are
   wrapped
 - test/t/touch.t will fail under glibc 2.34 unless __lstat64_time64 is
   wrapped
…nsat,s,}64

These functions are only wrapped on 32 bit platforms like i386, armel or
armhf. On 64 bit platforms, the corresponding HAVE_* macros will not be
defined.

 * __fstatat64_time64
 * __lstat64_time64
 * __stat64_time64
 * __utime64
 * __utimensat64
 * __utimes64
…he linker in `objdump -p` like mips64el, ppc64el and s390x
 - the variable is set in test/common.inc.sh and includes `basename $0 .t`
 - otherwise test/t/touch.t will always get skipped
@josch
Copy link
Author

josch commented Feb 6, 2023

I found a rather important problem with my patch stack. The fix is:

diff --git a/src/__lstat64_time64.c b/src/__lstat64_time64.c
index e3e8400..1637b9c 100644
--- a/src/__lstat64_time64.c
+++ b/src/__lstat64_time64.c
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#ifdef HAVE___lstat64_time64
+#ifdef HAVE___LSTAT64_TIME64
 
 #define _ATFILE_SOURCE
 #define _POSIX_C_SOURCE 200809L

Because of that "typo" (probably some copy-paste mess-up of mine), touch --no-dereference --reference ... would fail on 32bit arches like armel, armhf and i386 because __lstat64_time64 was not wrapped by fakechroot. I added a check to test/t/touch.t to test running touch in that way to prevent future regressions.

In the process I also observed that during a normal build, test/t/touch.t is never run because test/touch.inc.sh tries to find testtree/usr/bin/touch instead of $testtree/usr/bin/touch.

I pushed all fixes here as well as to #108.

pld-gitsync pushed a commit to pld-linux/fakechroot that referenced this pull request May 7, 2023
- updated urls (lives on github now)
- statx patch from master
- debian patches gathered in dex4er/fakechroot#104
@josch
Copy link
Author

josch commented Apr 14, 2024

I pushed another commit which wraps __lutimes64 which is used by glibc 2.37 and later on armel and armhf.

@josch josch changed the title All changes to fakechroot we carry in Debian for glibc >= 2.34 All changes to fakechroot we carry in Debian for glibc >= 2.37 Apr 14, 2024
@josch
Copy link
Author

josch commented Nov 15, 2024

This branch now has another fix by @yorickvP to fix #114

@sergiomb2
Copy link

this fix " __readlink_chk, __readlinkat_chk: properly pass buffer length " seems to me that fixes cp.t .

but now socket test fail with "af_unix server socket created bind: File name too long"

Anyway I need to reduce my workload , and fakechroot seems abandoned to me , I think it was replaced with fakeroot , I most probably I will orphan the package in Fedora .

It was a pleasure meet you

@josch
Copy link
Author

josch commented Nov 19, 2024

fakechroot seems abandoned to me

I think it is.

I think it was replaced with fakeroot

No. fakeroot makes the wrapped program appear as if the user running it is actually root (uid 0). fakechroot makes the program believe it is run inside a chroot. You usually use both fakeroot and fakechroot at the same time. They work together.

I most probably I will orphan the package in Fedora .

I think that makes sense. I will continue maintaining it in Debian but it's not much fun at this point...

@sergiomb2
Copy link

sergiomb2 commented Nov 21, 2024

OK , I'm building it for Fedora 41 without socket-af_unix.t .
we can add to this PR is one typo fix #80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants