diff options
author | 2014-04-06 16:41:54 -0700 | |
---|---|---|
committer | 2014-04-06 16:41:54 -0700 | |
commit | b20013e387047ba016cbee9014093dd76225c7d1 (patch) | |
tree | 49a5cb5ed0436356f56299c9d8102c8f6ed432e7 | |
parent | 8b097ba038d2744e45810428bddfaf729c64e789 (diff) | |
download | paludis-b20013e387047ba016cbee9014093dd76225c7d1.tar.gz paludis-b20013e387047ba016cbee9014093dd76225c7d1.tar.xz |
test: fix tests with bash 4.3
bash 4.3 changes the semantics of the read builtin. It will now silently ignore
NUL characters in the input stream. This is problematic since the paludis pipe
command protocol uses the NUL character as an indicator for end of message.
Passing read an explicit delimiter of a NUL char ($'\0') ensures that it treats
the NUL character as valid input. This avoids the hang during the process
tests.
The delimiter option has existed prior to 4.3 (and explicitly tested against
4.2p45) and should not break compatibility with older releases of bash.
-rwxr-xr-x | paludis/util/process_TEST_setup.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/paludis/util/process_TEST_setup.sh b/paludis/util/process_TEST_setup.sh index 8749b0bd6..3d4bfa18f 100755 --- a/paludis/util/process_TEST_setup.sh +++ b/paludis/util/process_TEST_setup.sh @@ -10,7 +10,7 @@ cat <<'END' > pipe_test.bash echo "$1" | tr "\n" "\0" 1>&$PALUDIS_PIPE_COMMAND_WRITE_FD response1= while true ; do - read -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c + read -d $'\0' -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c [[ "$c" == $'\0' ]] && break response1="${response1}${c}" done @@ -18,7 +18,7 @@ done echo "$2" | tr "\n" "\0" 1>&$PALUDIS_PIPE_COMMAND_WRITE_FD response2= while true ; do - read -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c + read -d $'\0' -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c [[ "$c" == $'\0' ]] && break response2="${response2}${c}" done @@ -32,7 +32,7 @@ cat <<'END' > captured_pipe_test.bash echo "$1" | tr "\n" "\0" 1>&$PALUDIS_PIPE_COMMAND_WRITE_FD response1= while true ; do - read -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c + read -d $'\0' -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c [[ "$c" == $'\0' ]] && break response1="${response1}${c}" done @@ -40,7 +40,7 @@ done echo "$2" | tr "\n" "\0" 1>&$PALUDIS_PIPE_COMMAND_WRITE_FD response2= while true ; do - read -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c + read -d $'\0' -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c [[ "$c" == $'\0' ]] && break response2="${response2}${c}" done @@ -48,7 +48,7 @@ done echo "$3" | tr "\n" "\0" 1>&$PALUDIS_PIPE_COMMAND_WRITE_FD response3= while true ; do - read -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c + read -d $'\0' -n 1 -u $PALUDIS_PIPE_COMMAND_READ_FD c [[ "$c" == $'\0' ]] && break response3="${response3}${c}" done |