summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/input.c21
-rw-r--r--Test/A02alias.ztst6
3 files changed, 25 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ba4494a85..aeb2bb6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-25 Peter Stephenson <pws@csr.com>
+
+ * 27827: Src/input.c, Test/A02alias.ztst: infinite loop
+ if alias with recursive definition occurred at end
+ of parsed string (normal shell input was OK).
+
2010-03-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 27823: Src/hist.c: 27822 could access freed memory because
@@ -12959,5 +12965,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4943 $
+* $Revision: 1.4944 $
*****************************************************
diff --git a/Src/input.c b/Src/input.c
index 248d2ae71..0e802da62 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -195,21 +195,24 @@ ingetc(void)
return lastc;
}
- /* If the next element down the input stack is a continuation of
- * this, use it.
- */
- if (inbufflags & INP_CONT) {
- inpoptop();
- continue;
- }
/*
- * Otherwise, see if we have reached the end of input
+ * See if we have reached the end of input
* (due to an error, or to reading from a single string).
+ * Check the remaining characters left, since if there aren't
+ * any we don't want to pop the stack---it'll mark any aliases
+ * as not in use before we've finished processing.
*/
- if (strin || errflag) {
+ if (!inbufct && (strin || errflag)) {
lexstop = 1;
return ' ';
}
+ /* If the next element down the input stack is a continuation of
+ * this, use it.
+ */
+ if (inbufflags & INP_CONT) {
+ inpoptop();
+ continue;
+ }
/* As a last resort, get some more input */
if (inputline())
return ' ';
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 231e13771..67ae8e52f 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -36,3 +36,9 @@
>Without
>This command has the argument true
>With
+
+ print -u $ZTST_fd 'This test hangs the shell when it fails...'
+ alias sort='LC_ALL=C sort'
+ cat <(echo foo | sort)
+0:Alias expansion works at the end of parsed strings
+>foo