Commit fc15a96
committed
fix-elf: also patchelf PT_INTERP to strip +brewing post-install
brewkit installs into ${prefix}+brewing/ then renames to ${prefix}/.
The build's `ld --dynamic-linker=...+brewing/.../ld-linux*.so` flag
bakes the +brewing path into PT_INTERP of every linked binary.
fix-elf has historically only patched RPATH via patchelf, leaving
PT_INTERP referencing a path that no longer exists post-rename.
For typical pantry recipes this is harmless: their binaries' PT_INTERP
points at the host runner's /lib(64)?/ld-linux-*.so, not back into
their own bottle, so the bake doesn't matter. For low-level packages
whose own bottle ships ld-linux* (glibc being the obvious example),
PT_INTERP after install is broken — bin/ld.so, bin/getconf, etc. fail
to exec because the kernel can't find the +brewing path. This blocked
gnu.org/glibc (pkgxdev/pantry#5080 / pkgxdev/pantry#12968) from
shipping its own bin/ tools as usable: the test-phase had to fall
back on bash-builtin `test -f` rather than running e.g. `ld.so --version`.
Add a no-op-by-default `fix_interpreter()` step alongside `set_rpaths()`:
- read PT_INTERP with `patchelf --print-interpreter`
- if it contains "+brewing", rewrite via `patchelf --set-interpreter`
- skip if the rewritten target doesn't exist (guards against bad rewrites)
- catch errors quietly when the file is statically linked / has no
.interp section, consistent with the surrounding set_rpaths style.
No behaviour change for any existing pantry bottle — they all consume
the host runner's ld-linux at PT_INTERP, so the substring "+brewing"
never matches.
Refs: pkgxdev/pantry#12968 (gnu.org/glibc PR).1 parent 2e18552 commit fc15a96
1 file changed
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
30 | 70 | | |
31 | 71 | | |
32 | 72 | | |
| |||
0 commit comments