about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2016-07-14 15:51:28 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2016-07-14 15:51:28 +0200
commit1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb (patch)
tree79da6273c3244e5de7a0cb5c5093376aa3efa2c6 /pkgs/build-support
parentab9515092b291fb92cf83a21c2a344a096ae8474 (diff)
parentd9aafc885fe9424689ae30b11736b214be3cf9c2 (diff)
downloadnixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar.gz
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar.bz2
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar.lz
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar.xz
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.tar.zst
nixlib-1b5ac058451e5e0a0bc3ad36d1d1546e9aba61bb.zip
Merge branch 'staging'
Includes security fixes in gd and libarchive.
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/buildenv/builder.pl18
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh3
2 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index f6cfe52dc318..678f5a3fe9e6 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -31,9 +31,23 @@ sub isInPathsToLink {
 
 my %symlinks;
 
+# Add all pathsToLink and all parent directories.
+#
+# For "/a/b/c" that will include
+# [ "", "/a", "/a/b", "/a/b/c" ]
+#
+# That ensures the whole directory tree needed by pathsToLink is
+# created as directories and not symlinks.
+$symlinks{""} = ["", 0];
 for my $p (@pathsToLink) {
-    $p = "" if $p eq "/";
-    $symlinks{$p} = ["", 0];
+    my @parts = split '/', $p;
+
+    my $cur = "";
+    for my $x (@parts) {
+        $cur = $cur . "/$x";
+        $cur = "" if $cur eq "/";
+        $symlinks{$cur} = ["", 0];
+    }
 }
 
 sub findFiles;
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 38660718d0e2..4317a5f4dade 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -46,7 +46,8 @@ patchShebangs() {
             args="$arg0 $args"
         fi
 
-        newInterpreterLine="$newPath $args"
+        # Strip trailing whitespace introduced when no arguments are present
+        newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"
 
         if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
             if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then