commit:     61049d2954dcf04bd2a2f38ac398fc406e45695f
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 26 23:39:06 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Mar 26 23:39:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=61049d29

gen_compile.sh: populate_binpkg(): Throw away binpkg when glibc has changed

It was reported that dropbear in genkernel initramfs crashed when
client tried to connect.

The problem is, that while we are compiling statically, we still depend
on used glibc version. I.e. dropbear binpkg was created against glibc
version A, but when genkernel initramfs will be created, we will copy
system libraries from whatever glibc version host is currently using which
doesn't necessarily need to match used glibc version when binpkg was
created which could result in reported problem.

This commit will make genkernel treat binpkg as stale when glibc was
changed since binpkg was created to force a rebuild.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_compile.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gen_compile.sh b/gen_compile.sh
index d755150..e2b86cc 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -510,6 +510,23 @@ populate_binpkg() {
                unset patch patchdir
        fi
 
+       if [[ -f "${BINPKG}" ]]
+       then
+               if isTrue "$(is_glibc)"
+               then
+                       local libdir=$(get_chost_libdir)
+                       local glibc_test_file="${libdir}/libnss_files.so"
+
+                       if [[ "${BINPKG}" -ot "${glibc_test_file}" ]]
+                       then
+                               print_info 3 "${CHECK_LEVEL_PREFIX}Glibc 
(${glibc_test_file}) is newer than us; Removing stale ${P} binpkg ..."
+                               rm "${BINPKG}" || gen_die "Failed to remove 
stale binpkg '${BINPKG}'!"
+                       fi
+
+                       print_info 3 "${CHECK_LEVEL_PREFIX}Existing ${P} binpkg 
is newer than glibc (${glibc_test_file}); Skipping ..."
+               fi
+       fi
+
        if [[ ! -f "${BINPKG}" ]]
        then
                print_info 3 "${CHECK_LEVEL_PREFIX}Binpkg '${BINPKG}' does NOT 
exist; Need to build ${P} ..."

Reply via email to