mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 10:27:00 +02:00
sys-libs/glibc: Apply Flatcar changes
Drop pkg_pretend since it breaks build_image if cross-compilers are not installed yet (e.g. in Jenkins jobs). Drop the libidn2 runtime dependency since it breaks bootstrapping, and it's dlopen()ed so the resolver can work without it. Drop the host /dev/pts checks since the SDK doesn't control it. Apply our gshadow segfault patch, and adapt into glibc 2.30. Install nscd.conf in /usr and set up tmpfiles to link it in /etc. Wipe out /etc files (except for an environment file that is still needed in the SDK). Originally comes from eb07324f4de3 ("sys-libs/glibc: Apply CoreOS changes").
This commit is contained in:
parent
e43d18f0da
commit
930c8a40fa
@ -0,0 +1,112 @@
|
||||
From 74250a7cdf106d4ca7d9506e6d5dc7c448dc3434 Mon Sep 17 00:00:00 2001
|
||||
From: Dongsu Park <dongsu@kinvolk.io>
|
||||
Date: Fri Jun 19 15:48:47 2020 +0200
|
||||
Subject: [PATCH] gshadow: Sync fgetsgent_r.c with grp/fgetgrent_r.c
|
||||
|
||||
[BZ #20338]
|
||||
* gshadow/fgetsgent_r.c: Include <libio/iolibio.h>.
|
||||
(flockfile): New macro.
|
||||
(funlockfile): Likewise.
|
||||
(__fgetsgent_r): Sync with __fgetgrent_r.
|
||||
* nss/nss_files/files-sgrp.c: Fix "fgetsgent_r.c" typo.
|
||||
|
||||
Originally written by David Michael.
|
||||
---
|
||||
gshadow/fgetsgent_r.c | 35 ++++++++++++++++++++++++-----------
|
||||
nss/nss_files/files-sgrp.c | 2 +-
|
||||
2 files changed, 25 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/gshadow/fgetsgent_r.c b/gshadow/fgetsgent_r.c
|
||||
index b70f6fa..02cd33a 100644
|
||||
--- a/gshadow/fgetsgent_r.c
|
||||
+++ b/gshadow/fgetsgent_r.c
|
||||
@@ -20,39 +20,44 @@
|
||||
#include <gshadow.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+#include <libio/iolibio.h>
|
||||
+#define flockfile(s) _IO_flockfile (s)
|
||||
+#define funlockfile(s) _IO_funlockfile (s)
|
||||
+
|
||||
/* Define a line parsing function using the common code
|
||||
used in the nss_files module. */
|
||||
|
||||
#define STRUCTURE sgrp
|
||||
#define ENTNAME sgent
|
||||
-#define EXTERN_PARSER 1
|
||||
+#define EXTERN_PARSER 1
|
||||
struct sgent_data {};
|
||||
|
||||
#include <nss/nss_files/files-parse.c>
|
||||
|
||||
|
||||
-/* Read one shadow entry from the given stream. */
|
||||
+/* Read one entry from the given stream. */
|
||||
int
|
||||
__fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen,
|
||||
struct sgrp **result)
|
||||
{
|
||||
char *p;
|
||||
+ int parse_result;
|
||||
|
||||
- _IO_flockfile (stream);
|
||||
+ flockfile (stream);
|
||||
do
|
||||
{
|
||||
buffer[buflen - 1] = '\xff';
|
||||
p = fgets_unlocked (buffer, buflen, stream);
|
||||
- if (p == NULL && feof_unlocked (stream))
|
||||
+ if (__builtin_expect (p == NULL, 0) && feof_unlocked (stream))
|
||||
{
|
||||
- _IO_funlockfile (stream);
|
||||
+ funlockfile (stream);
|
||||
*result = NULL;
|
||||
__set_errno (ENOENT);
|
||||
return errno;
|
||||
}
|
||||
- if (p == NULL || buffer[buflen - 1] != '\xff')
|
||||
+ if (__builtin_expect (p == NULL, 0) || buffer[buflen - 1] != '\xff')
|
||||
{
|
||||
- _IO_funlockfile (stream);
|
||||
+ funlockfile (stream);
|
||||
*result = NULL;
|
||||
__set_errno (ERANGE);
|
||||
return errno;
|
||||
@@ -61,10 +66,18 @@ __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen,
|
||||
} while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */
|
||||
/* Parse the line. If it is invalid, loop to
|
||||
get the next line of the file to parse. */
|
||||
- || ! parse_line (buffer, (void *) resbuf, (void *) buffer, buflen,
|
||||
- &errno));
|
||||
+ || ! (parse_result = parse_line (p, resbuf,
|
||||
+ (void *) buffer, buflen,
|
||||
+ &errno)));
|
||||
+
|
||||
+ funlockfile (stream);
|
||||
|
||||
- _IO_funlockfile (stream);
|
||||
+ if (__builtin_expect (parse_result, 0) == -1)
|
||||
+ {
|
||||
+ /* The parser ran out of space. */
|
||||
+ *result = NULL;
|
||||
+ return errno;
|
||||
+ }
|
||||
|
||||
*result = resbuf;
|
||||
return 0;
|
||||
diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c
|
||||
index 15dc659..05c3805 100644
|
||||
--- a/nss/nss_files/files-sgrp.c
|
||||
+++ b/nss/nss_files/files-sgrp.c
|
||||
@@ -23,7 +23,7 @@
|
||||
#define DATABASE "gshadow"
|
||||
struct sgent_data {};
|
||||
|
||||
-/* Our parser function is already defined in sgetspent_r.c, so use that
|
||||
+/* Our parser function is already defined in sgetsgent_r.c, so use that
|
||||
to parse lines from the database file. */
|
||||
#define EXTERN_PARSER
|
||||
#include "files-parse.c"
|
||||
--
|
||||
2.7.4
|
||||
|
2
sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles
vendored
Normal file
2
sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
L /etc/nscd.conf - - - - ../usr/share/baselayout/nscd.conf
|
||||
d /var/db/nscd - - - - -
|
@ -123,7 +123,6 @@ else
|
||||
"
|
||||
DEPEND+=" virtual/os-headers "
|
||||
RDEPEND+="
|
||||
>=net-dns/libidn2-2.3.0
|
||||
vanilla? ( !sys-libs/timezone-data )
|
||||
"
|
||||
PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
|
||||
@ -713,14 +712,6 @@ sanity_prechecks() {
|
||||
# the phases
|
||||
#
|
||||
|
||||
# pkg_pretend
|
||||
|
||||
pkg_pretend() {
|
||||
# All the checks...
|
||||
einfo "Checking general environment sanity."
|
||||
sanity_prechecks
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
# see bug 682570
|
||||
[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
|
||||
@ -746,6 +737,10 @@ src_unpack() {
|
||||
unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
|
||||
}
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/2.25/glibc-2.25-gshadow-handle-erange.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
if ! use vanilla ; then
|
||||
elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
|
||||
@ -1350,6 +1345,23 @@ glibc_do_src_install() {
|
||||
run_locale_gen --inplace-glibc "${ED}/"
|
||||
sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
|
||||
fi
|
||||
|
||||
## Flatcar: Add some local changes:
|
||||
# - Config files are installed by baselayout, not glibc.
|
||||
# - Install nscd/systemd stuff in /usr.
|
||||
|
||||
# Use tmpfiles to put nscd.conf in /etc and create directories.
|
||||
insinto /usr/share/baselayout
|
||||
if ! in_iuse nscd || use nscd ; then
|
||||
doins "${S}"/nscd/nscd.conf || die
|
||||
systemd_newtmpfilesd "${FILESDIR}"/nscd-conf.tmpfiles nscd-conf.conf || die
|
||||
fi
|
||||
|
||||
# Clean out any default configs.
|
||||
rm -rf "${ED}"/etc
|
||||
|
||||
# Restore this one for the SDK.
|
||||
test ! -e "${T}"/00glibc || doenvd "${T}"/00glibc
|
||||
}
|
||||
|
||||
glibc_headers_install() {
|
||||
|
Loading…
Reference in New Issue
Block a user