Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146189454
D31876.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D31876.id.diff
View Options
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -231,6 +231,8 @@
* If there's nothing ready, return an error.
*/
if (status <= 0) {
+ while (*ap != NULL)
+ setvar(*ap++, "", 0);
sig = pendingsig;
return (128 + (sig != 0 ? sig : SIGALRM));
}
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -141,6 +141,8 @@
${PACKAGE}FILES+= read7.0
${PACKAGE}FILES+= read8.0
${PACKAGE}FILES+= read9.0
+${PACKAGE}FILES+= read10.0
+${PACKAGE}FILES+= read11.0
${PACKAGE}FILES+= return1.0
${PACKAGE}FILES+= return2.1
${PACKAGE}FILES+= return3.1
diff --git a/bin/sh/tests/builtins/read10.0 b/bin/sh/tests/builtins/read10.0
new file mode 100644
--- /dev/null
+++ b/bin/sh/tests/builtins/read10.0
@@ -0,0 +1,8 @@
+
+set -e
+
+v=original_value
+r=0
+read v < /dev/null || r=$?
+[ "$r" -eq 1 ]
+[ -z "$v" ]
diff --git a/bin/sh/tests/builtins/read11.0 b/bin/sh/tests/builtins/read11.0
new file mode 100644
--- /dev/null
+++ b/bin/sh/tests/builtins/read11.0
@@ -0,0 +1,17 @@
+
+set -e
+
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
+trap 'rm -rf "$T"' 0
+cd $T
+mkfifo fifo1
+# Open fifo1 for writing and then read block on a dummy fifo
+{ mkfifo fifo2; read dummy <fifo2; } >fifo1 &
+# Wait for the child to open fifo1 for writing
+exec 3<fifo1
+v=original_value
+r=0
+read -t 0 v <&3 || r=$?
+kill -TERM "$!" || :
+{ [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = ALRM ]; } || exit
+[ -z "$v" ]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 1, 2:33 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29116811
Default Alt Text
D31876.id.diff (1 KB)
Attached To
Mode
D31876: read builtin: Empty variables on timeout
Attached
Detach File
Event Timeline
Log In to Comment