Skip to content

Commit 3b7de75

Browse files
committed
test(e2e): ldd's interpreter line is about ldd, not about the artifact
The host-library check I added a commit ago failed on CI for a dependency the artifact does not have: /home/runner/.mcpp/.../xim-x-glibc/2.39/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 ldd resolves the program interpreter by running the host's loader, so it always reports the payload interpreter as resolving to the host's. That says nothing about what the artifact loads at runtime -- the PT_INTERP assertion above already covers the interpreter, and it passed. A real dependency has a bare soname on the left; the interpreter line has an absolute path. The predicate now requires the former, and is self-checked against all three line shapes before use. Worth stating plainly: this is a check that would have blocked correct work while claiming a defect. That is the opposite failure from the ones this branch has been chasing, and no less expensive.
1 parent ec34195 commit 3b7de75

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

tests/e2e/201_gcc_no_specs_pollution.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,19 @@ echo "$out" | grep -q 'Hello' || { echo "unexpected output: $out"; exit 1; }
9292
#
9393
# Asking where each library actually came from makes the same defect visible
9494
# everywhere, host toolchain or not.
95+
# Only lines whose LEFT side is a bare soname count. ldd resolves the program
96+
# interpreter by running the host's loader, so it always reports the
97+
# interpreter as `<payload>/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2`
98+
# -- a statement about ldd, not about the artifact, and a false positive that
99+
# failed this very check on CI. A real dependency has no slash on the left.
100+
host_lib_lines() {
101+
ldd "$1" 2>/dev/null \
102+
| grep -E '^[[:space:]]*[^/[:space:]]+ => +(/lib|/usr/lib|/lib64|/usr/lib64)/' \
103+
|| true
104+
}
105+
95106
if command -v ldd > /dev/null 2>&1; then
96-
host_libs=$(ldd "$bin" 2>/dev/null \
97-
| grep -E '=> +(/lib|/usr/lib|/lib64|/usr/lib64)/' || true)
107+
host_libs=$(host_lib_lines "$bin")
98108
if [[ -n "$host_libs" ]]; then
99109
echo "the artifact loads libraries from the host:"
100110
echo "$host_libs" | sed 's/^/ /'
@@ -147,8 +157,7 @@ EOF
147157
pfbin=$(find target -type f -name pf -path '*/bin/*' | head -1)
148158
[[ -n "$pfbin" ]] || { echo "no payload-first binary produced"; exit 1; }
149159

150-
pf_host=$(ldd "$pfbin" 2>/dev/null \
151-
| grep -E '=> +(/lib|/usr/lib|/lib64|/usr/lib64)/' || true)
160+
pf_host=$(host_lib_lines "$pfbin")
152161
if [[ -n "$pf_host" ]]; then
153162
echo "the payload-first artifact loads libraries from the host:"
154163
echo "$pf_host" | sed 's/^/ /'

0 commit comments

Comments
 (0)