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)
This commit is contained in:
parent
8bc930ca39
commit
33518fcb45
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue