1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-05-19 23:21:25 +02:00

27827: fix infinite loop in recursive alias at end of parsed string

This commit is contained in:
Peter Stephenson 2010-03-25 14:03:40 +00:00
parent c2fdffa316
commit e71df91bd2
3 changed files with 25 additions and 10 deletions

View file

@ -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 $
*****************************************************

View file

@ -195,21 +195,24 @@ ingetc(void)
return lastc;
}
/*
* 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 (!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;
}
/*
* Otherwise, see if we have reached the end of input
* (due to an error, or to reading from a single string).
*/
if (strin || errflag) {
lexstop = 1;
return ' ';
}
/* As a last resort, get some more input */
if (inputline())
return ' ';

View file

@ -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