macOS 26's unified log shows an NSLog argument that is an object or a string made at run time as <private>, so the bundle's diagnostics named nothing there: RealityKit's usdz Quick Look preview logged "RGFX: <private>: no reflection (<private>); answered nil" and no more. The bundle's Objective-C sources now log through rgfxLogLine, which formats the line as NSLog does, logs it as one public string on the bundle's subsystem at the default level NSLog used, and writes it to stderr where NSLog wrote there too (the death checks read a death's words there). bundle_log_check.sh fails a bundle that calls NSLog.
38 lines
1.7 KiB
Bash
Executable File
38 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# bundle_log_check.sh BUNDLE PLIST HEADER: that the bundle's os_log lines go to its own subsystem.
|
|
# A line on OS_LOG_DEFAULT has no subsystem, and no mode of `log config` persists its debug lines
|
|
# (docs/lessons.md), so the bundle's executable imports no _os_log_default, the object
|
|
# OS_LOG_DEFAULT names; it links its log object (src/RgfxLog.cpp) rather than importing it, which
|
|
# its -undefined dynamic_lookup would let through to fail in the guest; and the subsystem HEADER
|
|
# names is PLIST's CFBundleIdentifier, the name `log config --subsystem` takes; and it calls no
|
|
# NSLog, whose object and run-time string arguments macOS 26's log shows as <private>. Part of
|
|
# `make test`.
|
|
set -euo pipefail
|
|
exe=$1
|
|
[ -f "$exe" ] || exe=$1/Contents/MacOS/reims-graphics
|
|
fails=0
|
|
imports=$(nm -u "$exe")
|
|
if grep -qx '__os_log_default' <<<"$imports"; then
|
|
echo "bundle_log_check: FAIL: $exe logs on OS_LOG_DEFAULT (it imports _os_log_default)"
|
|
fails=1
|
|
fi
|
|
if grep -qx '_NSLog' <<<"$imports"; then
|
|
echo "bundle_log_check: FAIL: $exe calls NSLog, whose arguments read <private> in macOS 26's" \
|
|
"log: its lines go through rgfxLogLine (src/RgfxLog.hpp)"
|
|
fails=1
|
|
fi
|
|
if grep -q 'rgfxLog' <<<"$imports"; then
|
|
echo "bundle_log_check: FAIL: $exe imports its log object instead of linking it:" \
|
|
$(grep 'rgfxLog' <<<"$imports")
|
|
fails=1
|
|
fi
|
|
id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$2")
|
|
subsystem=$(sed -n 's/^#define RGFX_LOG_SUBSYSTEM "\(.*\)"$/\1/p' "$3")
|
|
if [ "$subsystem" != "$id" ]; then
|
|
echo "bundle_log_check: FAIL: the log subsystem \"$subsystem\" ($3) is not the bundle's" \
|
|
"identifier \"$id\" ($2)"
|
|
fails=1
|
|
fi
|
|
[ $fails = 0 ] || exit 1
|
|
echo "bundle_log_check: $exe logs on subsystem $id, not on OS_LOG_DEFAULT nor through NSLog"
|