From 9156daa547086435dadc55ed78bb0d1a85a03a6c Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Sun, 23 Apr 2023 11:53:47 +0200 Subject: [PATCH] setup-hooks/separate-debug-info.sh: make deterministic If multiple files with the same build id were found, we silently randomly overwrote one with the other. Change the order to make the output deterministic, and emit a warning when overwriting. --- pkgs/build-support/setup-hooks/separate-debug-info.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/setup-hooks/separate-debug-info.sh b/pkgs/build-support/setup-hooks/separate-debug-info.sh index ca651b4393a..334db4cfcd9 100644 --- a/pkgs/build-support/setup-hooks/separate-debug-info.sh +++ b/pkgs/build-support/setup-hooks/separate-debug-info.sh @@ -36,10 +36,14 @@ _separateDebugInfo() { # architecture than we're building for. (This happens with # firmware blobs in QEMU.) ( + if [ -f "$dst/${id:0:2}/${id:2}.debug" ] + then + echo "separate-debug-info: warning: multiple files with build id $id found, overwriting" + fi $OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" # Also a create a symlink .debug. ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")" ) || rmdir -p "$dst/${id:0:2}" - done < <(find "$prefix" -type f -print0) + done < <(find "$prefix" -type f -print0 | sort -z) }