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:
happysalada 2021-08-03 11:07:58 +09:00
parent ed279433d7
commit 5d0acf20f8

View File

@ -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