summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton Schaefer <schaefer@zsh.org>2013-05-20 22:44:03 -0700
committerBarton Schaefer <schaefer@zsh.org>2013-05-20 23:38:58 -0700
commit1182a75e1b4d46a42935a217e80a2955b76be1a5 (patch)
tree36822fdf6a9bbc1d75c7c0ca3c0afe7309cf193c
parentaa7467b0bfcf1e28fd2b2b91a88040946c680e59 (diff)
downloadzsh-1182a75e1b4d46a42935a217e80a2955b76be1a5.tar.gz
zsh-1182a75e1b4d46a42935a217e80a2955b76be1a5.tar.xz
zsh-1182a75e1b4d46a42935a217e80a2955b76be1a5.zip
upon "read" of a short line, assign all variables passed as arguments.
It was noted that (print 1 2 | read one two three four) assigned values
only to $one and $two except in the case where EOF was reached.
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6cdb25ae9..4ce49d11b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-20  Barton Schaefer  <schaefer@zsh.org>
+
+	* 31416: Src/builtin.c: upon "read" of a short line, assign all
+	variables passed as arguments.
+
 2013-05-14  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* unposted: Completion/Unix/Command/_perforce: Improve
diff --git a/Src/builtin.c b/Src/builtin.c
index cd886437b..bc91578b3 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5674,7 +5674,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
 	    zputs(buf, stdout);
 	    putchar('\n');
 	}
-	if (!OPT_ISSET(ops,'e') && (*buf || first)) {
+	if (!OPT_ISSET(ops,'e') && (*buf || first || gotnl)) {
 	    if (OPT_ISSET(ops,'A')) {
 		addlinknode(readll, buf);
 		al++;