Commit 18152a21 authored by Allan McRae's avatar Allan McRae
Browse files

libmakepkg: Do not "strip" files when the format is not recognised



We use a multi step process during stripping to ensure permissions do
not get changed.  However, if the initial objcopy fails, the subsequent cat
results in a blank file.  Abandon early if objcopy fails.

Fixes FS#74486
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent f5f9e0f4
Pipeline #18600 passed with stage
in 2 minutes and 28 seconds
......@@ -80,7 +80,12 @@ strip_file() {
# copy debug symbols to debug directory
mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
# abandon processing files that are not a recognised format
if ! objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" 2>/dev/null; then
return
fi
local tempfile=$(mktemp "$binary.XXXXXX")
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile"
cat "$tempfile" > "$binary"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment