about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-18 22:30:42 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-18 22:54:11 +0100
commitbf63de1613396a1a4d1f27fea73f125988d468a7 (patch)
treed8810e3cbe37c03bc95cfc844cbbaf7a6d6bf4a7 /pkgs
parent854c27c69c2f38b2e5a7ed5099c88aa0bcc520d1 (diff)
downloadnixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar.gz
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar.bz2
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar.lz
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar.xz
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.tar.zst
nixlib-bf63de1613396a1a4d1f27fea73f125988d468a7.zip
separateDebugInfo: Handle weird filenames properly
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/setup-hooks/separate-debug-info.sh12
1 files changed, 5 insertions, 7 deletions
diff --git a/pkgs/build-support/setup-hooks/separate-debug-info.sh b/pkgs/build-support/setup-hooks/separate-debug-info.sh
index 617bbba58456..cf3d7b07a499 100644
--- a/pkgs/build-support/setup-hooks/separate-debug-info.sh
+++ b/pkgs/build-support/setup-hooks/separate-debug-info.sh
@@ -11,15 +11,13 @@ _separateDebugInfo() {
     dst="$dst/lib/debug/.build-id"
 
     # Find executables and dynamic libraries.
-    local -a files=($(find "$prefix" -type f -a \( -perm /0100 -o -name "*.so" -o -name "*.so.*" \)))
-
     local i magic
-    for i in "${files[@]}"; do
+    while IFS= read -r -d $'\0' i; do
         # Skip non-ELF files.
-        exec 10< "$i"
-        read -n 4 -u 10 magic
+        exec {fd}< "$i"
+        read -n 4 -u $fd magic
+        exec {fd}<&-
         if ! [[ "$magic" =~ ELF ]]; then continue; fi
-        exec 10<&-
 
         # Extract the Build ID. FIXME: there's probably a cleaner way.
         local id="$(readelf -n "$i" | sed 's/.*Build ID: \([0-9a-f]*\).*/\1/; t; d')"
@@ -36,7 +34,7 @@ _separateDebugInfo() {
 
         # Also a create a symlink <original-name>.debug.
         ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
-    done
+    done < <(find "$prefix" -type f -a \( -perm /0100 -o -name "*.so" -o -name "*.so.*" \) -print0)
 }
 
 # - We might prefer to compress the debug info during link-time already,