Support building glibc in a mock chroot using older systemd-nspawn (#1869030).

Resolves: #1869030
This commit is contained in:
Carlos O'Donell 2020-08-20 18:18:47 -04:00
parent b1869f947a
commit b8f476de79
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,25 @@
With older systemd-nspawn the faccessat2 syscall was denied but
instead of returning ENOSYS it returned EPERM. This has since
been corrected in upstream systemd-nsapwn, but with older builders
that may have older nspawn the Fedora Rawhide glibc should fall
back to faccessat when it sees ENOSYS *or* EPERM. This is a
Fedora Rawhide-only patch that should be removed before the next
release.
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 56cb6dcc8b4d58d3..5de75032bbc93a2c 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -34,7 +34,11 @@ faccessat (int fd, const char *file, int mode, int flag)
#if __ASSUME_FACCESSAT2
return ret;
#else
- if (ret == 0 || errno != ENOSYS)
+ /* Fedora-specific workaround:
+ As a workround for a broken systemd-nspawn that returns
+ EPERM when a syscall is not allowed instead of ENOSYS
+ we must check for EPERM here and fall back to faccessat. */
+ if (ret == 0 || !(errno == ENOSYS || errno == EPERM))
return ret;
if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))

View File

@ -96,7 +96,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 3%{?dist}
Release: 4%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -169,6 +169,7 @@ Patch23: glibc-python3.patch
Patch29: glibc-fedora-nsswitch.patch
Patch30: glibc-deprecated-selinux-makedb.patch
Patch31: glibc-deprecated-selinux-nscd.patch
Patch32: glibc-rhbz1869030-faccessat2-eperm.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2019,6 +2020,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Thu Aug 20 2020 Carlos O'Donell <carlos@redhat.com> - 2.32.9000-4
- Support building glibc in a mock chroot using older systemd-nspawn (#1869030).
* Tue Aug 18 2020 Carlos O'Donell <carlos@redhat.com> - 2.32.9000-3
- Suggest installing minimal localization e.g. C, POSIX, C.UTF-8.