Skip to content

Commit c840234

Browse files
committed
fix(glibc): +brewing strip — detect linker scripts without file(1)
Commit 6d105d8 added the +brewing strip but used `file(1)` to detect linker-script-vs-ELF — and `file` isn't on the test-sandbox PATH (it's its own package, not coreutils). Result: the type check raised "file: command not found", the conditional fell through, no .so files were sed'd, and the test still hit the +brewing linker error. Detect linker scripts by their first-16-bytes marker `/* GNU ld script` instead. That's a pure bash + grep + head check, all in the sandbox. Also adds an echo so future CI logs make it obvious which files were modified.
1 parent 6d105d8 commit c840234

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

projects/gnu.org/glibc/package.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,19 @@ build:
130130
131131
# brewkit's fix-elf rewrites +brewing in ELF RPATH/RUNPATH, and
132132
# fix-shebangs.ts handles shell scripts. glibc additionally installs
133-
# libc.so, libpthread.so, etc. as TEXT linker scripts (GROUP (...))
134-
# that reference the install prefix by absolute path. Those need
135-
# the same treatment, otherwise downstream `-lc` link attempts hit
136-
# "cannot find +brewing/lib/glibc-X.Y/libc.so.6" because the
137-
# +brewing suffix is gone from the final install dir.
133+
# libc.so, libm.so, etc. as TEXT linker scripts (GROUP (...)) that
134+
# reference the install prefix by absolute path. Those need the
135+
# same treatment, otherwise downstream `-lc` link attempts hit
136+
# "cannot find +brewing/lib/glibc-X.Y/libc.so.6" once brewkit
137+
# renames the install dir to drop the +brewing suffix.
138+
#
139+
# We identify the scripts by their first-line marker rather than
140+
# `file(1)` (not on the test-sandbox PATH).
138141
- run: |
139142
for f in $(find . -maxdepth 2 -type f -name '*.so'); do
140-
if file "$f" | grep -qE 'ASCII text|GNU ld script'; then
143+
if head -c 16 "$f" | grep -q "GNU ld script"; then
141144
sed -i 's|+brewing||g' "$f"
145+
echo "stripped +brewing from $f"
142146
fi
143147
done
144148
working-directory: ${{prefix}}/lib

0 commit comments

Comments
 (0)