about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-07-24 00:53:13 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-07-24 01:05:30 -0400
commitb087618ac06256cb3c06278e7eaba45841f4ea91 (patch)
treeaeb5d6123fa58ebd20ff0351fba5b285d14c20e6 /pkgs/stdenv
parentf4a8e6ab7f4e1c6d7499a1660fbd5c655ad0a805 (diff)
downloadnixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar.gz
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar.bz2
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar.lz
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar.xz
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.tar.zst
nixlib-b087618ac06256cb3c06278e7eaba45841f4ea91.zip
Revert "stdenv: Store one package per line in nix-support/propagated-*"
As @oxij points out in [1], this breakage is especially serious because
it changes the contents of built environments without a corresonding
change in their hashes. Also, the revert is easier than I thought.

This reverts commit 3cb745d5a69018829ac15f7d5a508135f6bda123.

[1]: https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/builder.sh5
-rw-r--r--pkgs/stdenv/generic/setup.sh20
2 files changed, 8 insertions, 17 deletions
diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh
index f8c0fd44ac78..a46c46c2db50 100644
--- a/pkgs/stdenv/generic/builder.sh
+++ b/pkgs/stdenv/generic/builder.sh
@@ -1,3 +1,4 @@
+export PATH=
 for i in $initialPath; do
     if [ "$i" = / ]; then i=; fi
     PATH=$PATH${PATH:+:}$i/bin
@@ -14,6 +15,4 @@ cat "$setup" >> $out/setup
 # Allow the user to install stdenv using nix-env and get the packages
 # in stdenv.
 mkdir $out/nix-support
-if [ "$propagatedUserEnvPkgs" ]; then
-    printf '%s\n' $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages
-fi
+echo $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index de94565ed6d7..e5d2ba8682de 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -215,11 +215,6 @@ isScript() {
     if [[ "$magic" =~ \#! ]]; then return 0; else return 1; fi
 }
 
-# printf unfortunately will print a trailing newline regardless
-printLines() {
-    [[ $# -gt 0 ]] || return 0
-    printf '%s\n' "$@"
-}
 
 ######################################################################
 # Initialisation.
@@ -305,12 +300,9 @@ findInputs() {
     fi
 
     if [ -f "$pkg/nix-support/$propagatedBuildInputsFile" ]; then
-        local fd pkgNext
-        exec {fd}<"$pkg/nix-support/$propagatedBuildInputsFile"
-        while IFS= read -r -u $fd pkgNext; do
-            findInputs "$pkgNext" $var $propagatedBuildInputsFile
+        for i in $(cat "$pkg/nix-support/$propagatedBuildInputsFile"); do
+            findInputs "$i" $var $propagatedBuildInputsFile
         done
-        exec {fd}<&-
     fi
 }
 
@@ -802,17 +794,17 @@ fixupPhase() {
         fi
         if [ -n "$propagated" ]; then
             mkdir -p "${!outputDev}/nix-support"
-            printLines $propagated > "${!outputDev}/nix-support/propagated-native-build-inputs"
+            echo "$propagated" > "${!outputDev}/nix-support/propagated-native-build-inputs"
         fi
     else
         if [ -n "$propagatedBuildInputs" ]; then
             mkdir -p "${!outputDev}/nix-support"
-            printLines $propagatedBuildInputs > "${!outputDev}/nix-support/propagated-build-inputs"
+            echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs"
         fi
 
         if [ -n "$propagatedNativeBuildInputs" ]; then
             mkdir -p "${!outputDev}/nix-support"
-            printLines $propagatedNativeBuildInputs > "${!outputDev}/nix-support/propagated-native-build-inputs"
+            echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs"
         fi
     fi
 
@@ -825,7 +817,7 @@ fixupPhase() {
 
     if [ -n "$propagatedUserEnvPkgs" ]; then
         mkdir -p "${!outputBin}/nix-support"
-        printLines $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"
+        echo "$propagatedUserEnvPkgs" > "${!outputBin}/nix-support/propagated-user-env-packages"
     fi
 
     runHook postFixup