mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 15:22:59 +01:00
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)
This commit is contained in:
parent
ed279433d7
commit
5d0acf20f8
1 changed files with 3 additions and 1 deletions
|
@ -716,9 +716,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