mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
rm "I/O error" error msg; just keep >0 exit status (re: 9011fa93)
The bug was really that I/O errors in output builtins were undetectable by any means. Having a >0 exit status is sufficient. Adding an error message risks making existing ksh scripts noisier, or even breaking them if they redirect stderr to stdout. Note to self: in future, implement the minimum change necessary to fix bugs, nothing more. The fact that I needed to add four extra 2>/dev/null to the regression tests should have been a hint. src/cmd/ksh93/bltins/print.c, src/cmd/ksh93/data/msg.c, src/cmd/ksh93/include/io.h: - Remove "I/O error" message. src/cmd/ksh93/tests/builtins.sh: - Update to check for exit status only. src/cmd/ksh93/tests/basic.sh, src/cmd/ksh93/tests/coprocess.sh: - Revert four new '2>/dev/null' to suppress the error message. (cherry picked from commit 5e17be24d18455b575b6e98bc631c6935ffc795a)
This commit is contained in:
parent
b883c7a7f8
commit
a1f46d785f
7 changed files with 7 additions and 11 deletions
|
@ -446,7 +446,7 @@ done | while read sec; do ( "$binsleep" "$sec"; "$binsleep" "$sec") done
|
|||
s=SECONDS
|
||||
set -o pipefail
|
||||
for ((i=0; i < 30; i++))
|
||||
do print hello 2>/dev/null
|
||||
do print hello
|
||||
sleep .01
|
||||
done | "$binsleep" .1
|
||||
(( (SECONDS-s) < .2 )) || err_exit 'early termination not causing broken pipe'
|
||||
|
@ -486,7 +486,7 @@ bintrue=$(whence -p true)
|
|||
set -o pipefail
|
||||
float start=$SECONDS end
|
||||
for ((i=0; i < 2; i++))
|
||||
do print foo 2>/dev/null
|
||||
do print foo
|
||||
sleep .15
|
||||
done | { read; $bintrue; end=$SECONDS ;}
|
||||
(( (SECONDS-start) < .1 )) && err_exit "pipefail not waiting for pipe to finish"
|
||||
|
|
|
@ -662,8 +662,8 @@ actual=$(
|
|||
) | true
|
||||
} 2>&1
|
||||
)
|
||||
expect=$': print: I/O error\n1'
|
||||
if [[ $actual != *"$expect" ]]
|
||||
expect='1'
|
||||
if [[ $actual != "$expect" ]]
|
||||
then
|
||||
err_exit "I/O error not detected: expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
||||
fi
|
||||
|
|
|
@ -272,7 +272,7 @@ _COSHELL_msgfd=5
|
|||
function cop
|
||||
{
|
||||
read
|
||||
print ok 2>/dev/null
|
||||
print ok
|
||||
}
|
||||
|
||||
exp=ok
|
||||
|
@ -348,7 +348,7 @@ wait
|
|||
function cop
|
||||
{
|
||||
read
|
||||
print ok 2>/dev/null
|
||||
print ok
|
||||
}
|
||||
exp=ok
|
||||
cop |&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue