mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-19 01:15:04 -05:00
fix(pkg): diagnostics never ran - set -e ate the failure before $? check
pgadmin4-appbundle-build #113 (macos-arm64) failed again on the same
otool -L call, but none of the diagnostic output from 401afbfa3 showed
up. Instead:
The command "OTOOL_OUTPUT=$(otool -L "${TODO_OBJ}" 2>&1)" failed in
"_fixup_imports" with exit code 1.
That's this script's own ERR trap firing on the assignment statement
itself. Under set -e, `VAR=$(cmd)` still propagates cmd's non-zero
exit to the trap immediately - the previous diagnostic's separate
`OTOOL_STATUS=$?` line right after never got a chance to run, so
nothing was ever printed, same as the original bare failure.
Move the assignment into the condition of the `if` itself
(`if ! OTOOL_OUTPUT=$(...); then`) - bash explicitly exempts a
command being tested by if/while/until (or negated with !) from
errexit, so this time the diagnostic block will actually execute.
Still not verified - watching the next buildfarm run.
This commit is contained in:
@@ -169,7 +169,7 @@ _build_docs() {
|
||||
}
|
||||
|
||||
_fixup_imports() {
|
||||
local TODO TODO_OLD TODO_PYTHON FW_RELPATH LIB LIB_BN OTOOL_OUTPUT OTOOL_STATUS
|
||||
local TODO TODO_OLD TODO_PYTHON FW_RELPATH LIB LIB_BN OTOOL_OUTPUT
|
||||
|
||||
echo "Fixing imports on the core appbundle..."
|
||||
pushd "$1" > /dev/null || exit
|
||||
@@ -233,11 +233,18 @@ _fixup_imports() {
|
||||
sed -n 's|[^/][^/]*/|../|gp' \
|
||||
)"Contents/Frameworks"
|
||||
|
||||
# Find all libraries ${TODO_OBJ} depends on, but skip system libraries
|
||||
OTOOL_OUTPUT=$(otool -L "${TODO_OBJ}" 2>&1)
|
||||
OTOOL_STATUS=$?
|
||||
if [ "${OTOOL_STATUS}" -ne 0 ]; then
|
||||
echo "ERROR: otool -L failed (exit ${OTOOL_STATUS}) on: ${TODO_OBJ}"
|
||||
# Find all libraries ${TODO_OBJ} depends on, but skip system libraries.
|
||||
#
|
||||
# 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.
|
||||
if ! OTOOL_OUTPUT=$(otool -L "${TODO_OBJ}" 2>&1); then
|
||||
echo "ERROR: 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
|
||||
|
||||
Reference in New Issue
Block a user