diff --git a/CHANGES b/CHANGES index d770111..96ca838 100644 --- a/CHANGES +++ b/CHANGES @@ -168,6 +168,10 @@ corrections: Fixed return value of nestlex() + Option ignoreeof on the right address hung. + Test: IGNOREEOF_REV + Thanks to Franz Fasching for reporting this bug. + porting: Red Hat issue 1020203: configure checks fail with some compilers. Use case: clang diff --git a/test.sh b/test.sh index e6c3dac..2f6ee09 100755 --- a/test.sh +++ b/test.sh @@ -3542,7 +3542,6 @@ esac N=$((N+1)) -#set -vx NAME=IGNOREEOF case "$TESTS" in *%$N%*|*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) @@ -3576,7 +3575,41 @@ wait fi ;; # NUMCOND esac N=$((N+1)) -#set +vx + + +NAME=IGNOREEOF_REV +case "$TESTS" in +*%$N%*|*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) +TEST="$NAME: ignoreeof on file right-to-left" +if ! eval $NUMCOND; then :; else +ti="$td/test$N.file" +tf="$td/test$N.stdout" +te="$td/test$N.stderr" +tdiff="$td/test$N.diff" +da="test$N $(date) $RANDOM" +CMD="$SOCAT $opts -U - file:\"$ti\",ignoreeof" +printf "test $F_n $TEST... " $N +touch "$ti" +$CMD >"$tf" 2>"$te" & +bg=$! +usleep 500000 +echo "$da" >>"$ti" +sleep 1 +kill $bg 2>/dev/null +if ! echo "$da" |diff - "$tf" >"$tdiff"; then + $PRINTF "$FAILED: diff:\n" + cat "$tdiff" + listFAIL="$listFAIL $N" + numFAIL=$((numFAIL+1)) +else + $PRINTF "$OK\n" + if [ -n "$debug" ]; then cat $te; fi + numOK=$((numOK+1)) +fi +wait +fi ;; # NUMCOND +esac +N=$((N+1)) NAME=EXECIGNOREEOF @@ -7918,7 +7951,7 @@ N=$((N+1)) NAME=COOLWRITE case "$TESTS" in -*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%coolwrite%*|*%$NAME%*) TEST="$NAME: option cool-write" if ! eval $NUMCOND; then :; elif ! testoptions cool-write >/dev/null; then @@ -7961,7 +7994,7 @@ N=$((N+1)) # this failed up to socat 1.6.0.0 NAME=COOLSTDIO case "$TESTS" in -*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%coolwrite%*|*%$NAME%*) TEST="$NAME: option cool-write on bidirectional stdio" # this test starts a socat reader that terminates after receiving one+ # bytes (option readbytes); and a test process that sends two bytes via @@ -11886,7 +11919,7 @@ if [ "$fileopt" = "." ]; then fileopt=; fi if [ "$addropts" = "." ]; then addropts=; fi NAME=${ADDR_}_PERM case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: $ADDR applies option perm" # start a socat process with passive/listening file system entry. Check the # permissions of the FS entry, then terminate the process. @@ -11958,7 +11991,7 @@ if [ "$fileopt" = "." ]; then fileopt=; fi if [ "$addropts" = "." ]; then addropts=; fi NAME=${ADDR_}_USER case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%root%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: $ADDR applies option user" # start a socat process with passive/listening file system entry with user option. # Check the owner of the FS entry, then terminate the process. diff --git a/xioengine.c b/xioengine.c index 610eef8..6dbb892 100644 --- a/xioengine.c +++ b/xioengine.c @@ -302,6 +302,9 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) { if (XIO_RDSTREAM(sock1)->ignoreeof) { mayrd1 = 0; } + if (XIO_RDSTREAM(sock2)->ignoreeof) { + mayrd2 = 0; + } } else if (polling && wasaction) { wasaction = 0;