about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2021-08-03 11:07:58 +0900
committerRaphael Megzari <raphael@megzari.com>2021-09-12 09:48:54 +0900
commit33518fcb4533828a0319e2def297ef7de0583b78 (patch)
treeae8a517ff5c9bb0aa6a5e7cb6adc207d6f3405c0 /pkgs/stdenv
parent8bc930ca39d3b41e3afbf50864a60250112dfe5f (diff)
stdenv/setup.sh: fix read -N 0 for bash 5
somehow `read -N 0` behavior changed in bash 5. `read -d ''` has identical behavior
the purpose of the function is to read stdin and exit 1 on a null byte (i.e. if stdin is the content of a binary)

(cherry picked from commit 5d0acf20f88b1820cb8b641cfc5a43e973122701)
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/setup.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 2d2a085ef9331..b2852ca604b4a 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -736,9 +736,11 @@ substituteStream() {
     printf "%s" "${!var}"
 }
 
+# put the content of a file in a variable
+# fail loudly if provided with a binary (containing null bytes)
 consumeEntire() {
     # read returns non-0 on EOF, so we want read to fail
-    if IFS='' read -r -N 0 $1; then
+    if IFS='' read -r -d '' $1 ; then
         echo "consumeEntire(): ERROR: Input null bytes, won't process" >&2
         return 1
     fi