fix(pkg): retry via otool-classic directly, now with hard evidence

pgadmin4-appbundle-build #114 (macos-arm64) failed on the same
"pgAdmin 4 Helper (GPU)" binary as before, but this time the
diagnostics from d4364555a actually ran and proved the path itself is
not the problem:

  Raw bytes of the path (od -c): plain ASCII throughout, single
  spaces, no non-breaking/unicode look-alikes, no trailing garbage.
  ls -la of the exact path: file exists, correct size/perms,
  timestamped seconds before otool ran - not a race condition either.

otool -L still failed via its internal otool-classic re-exec on that
exact, verified-correct, verified-present file. That's conclusively a
bug in otool's own internal dispatch, not anything this script builds
or passes to it - we can't fix Apple's tool, but we can avoid
triggering its broken code path.

Retry via `otool-classic -L "${TODO_OBJ}"` called directly (our own
argv-based quoting, not otool's internal re-exec, whatever that does
differently) when the initial `otool -L` fails. Every other binary in
the bundle keeps going through plain `otool -L` unchanged - this only
engages for the specific case that's already failing anyway. The
diagnostic dump (od -c / ls -la / otool-classic's own output) is kept
as the final fallback in case even the direct call fails too.

Not yet verified against a real buildfarm run.
This commit is contained in:
Ashesh Vashi
2026-07-30 11:55:29 +05:30
parent d4364555ae
commit 2d17e9e15d
+26 -11
View File
@@ -235,24 +235,39 @@ _fixup_imports() {
# Find all libraries ${TODO_OBJ} depends on, but skip system libraries.
#
# otool sometimes re-execs the legacy otool-classic internally
# for certain Mach-O binaries (seen consistently on
# "pgAdmin 4 Helper (GPU)"), and that internal re-exec fails
# to open a file confirmed present, correctly-permissioned,
# and byte-for-byte correctly-pathed at that exact moment
# (verified via ls -la + od -c on a prior failing build) -
# i.e. otool's own internal dispatch is broken here, not
# anything this script passes it. Retry via otool-classic
# directly (our own quoting, not otool's internal re-exec)
# before giving up.
#
# NOTE: the assignment must be the condition of the `if`
# itself, not a separate statement followed by checking $? -
# this script runs under an ERR trap/set -e, and a bare
# `VAR=$(cmd)` assignment still propagates cmd's failure to
# the trap immediately, aborting before $? can ever be
# inspected (that's why the previous version of this
# diagnostic never actually printed anything). Bash exempts
# the tested command of an `if` from errexit.
# inspected. Bash exempts the tested command of an `if` from
# errexit.
if ! OTOOL_OUTPUT=$(otool -L "${TODO_OBJ}" 2>&1); then
echo "ERROR: otool -L failed on: ${TODO_OBJ}"
echo "WARNING: otool -L failed on: ${TODO_OBJ}"
echo "otool output: ${OTOOL_OUTPUT}"
echo "Raw bytes of the path (od -c):"
printf '%s' "${TODO_OBJ}" | od -c
echo "ls -la of the exact path:"
ls -la -- "${TODO_OBJ}"
echo "ls -la of the containing directory:"
ls -la -- "$(dirname "${TODO_OBJ}")"
exit 1
echo "Retrying via otool-classic directly..."
if ! OTOOL_OUTPUT=$(otool-classic -L "${TODO_OBJ}" 2>&1); then
echo "ERROR: otool-classic -L also failed on: ${TODO_OBJ}"
echo "otool-classic output: ${OTOOL_OUTPUT}"
echo "Raw bytes of the path (od -c):"
printf '%s' "${TODO_OBJ}" | od -c
echo "ls -la of the exact path:"
ls -la -- "${TODO_OBJ}"
echo "ls -la of the containing directory:"
ls -la -- "$(dirname "${TODO_OBJ}")"
exit 1
fi
fi
for LIB in $(
echo "${OTOOL_OUTPUT}" | \