From: Peter Stephenson <pws@csr.com>
To: zsh-workers@zsh.org
Subject: Re: Infinite loop in parsing <()?
Date: Thu, 25 Mar 2010 13:06:01 +0000 [thread overview]
Message-ID: <20100325130601.1ad26f05@news01> (raw)
In-Reply-To: <87d3yszm3n.fsf@gmail.com>
On Thu, 25 Mar 2010 12:17:48 +0100
Christian Neukirchen <chneukirchen@gmail.com> wrote:
> Bart Schaefer <schaefer@brasslantern.com> writes:
>
> > On Mar 24, 7:22pm, Christian Neukirchen wrote:
> > }
> > } % cat <(echo foo | sort)
> > } # 100% CPU usage
> >
> > My guess would be that you have an alias for "sort" ...?
>
> Whoops, right:
> sort='LC_ALL=C sort'
>
> % cat <(echo foo | LC_ALL=C sort)
>
> works in zsh -f, but not with the alias set.
Yes, that's 100% reproducible. Took a little hunting down. This is a
local diff since CVS is a bit slow.
--- Src/input.c 2010-01-18 10:17:49.000000000 +0000
+++ ../zsh-debug/zsh/Src/input.c 2010-03-25 12:58:04.000000000 +0000
@@ -195,21 +195,24 @@
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 ' ';
--- Test/A02alias.ztst 2009-03-03 17:08:12.000000000 +0000
+++ ../zsh-debug/zsh/Test/A02alias.ztst 2010-03-25 13:00:07.000000000 +0000
@@ -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
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
next prev parent reply other threads:[~2010-03-25 13:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 18:22 Christian Neukirchen
2010-03-25 0:33 ` Bart Schaefer
2010-03-25 11:17 ` Christian Neukirchen
2010-03-25 13:06 ` Peter Stephenson [this message]
2010-03-25 14:21 ` Bart Schaefer
2010-03-25 15:16 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100325130601.1ad26f05@news01 \
--to=pws@csr.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).