* Core dump on completion after `for'
@ 2002-03-06 19:19 Peter Stephenson
2002-03-07 8:35 ` Sven Wischnowsky
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2002-03-06 19:19 UTC (permalink / raw)
To: Zsh hackers list
% ./zsh -f
% for f in <TAB>zsh: segmentation fault (core dumped) ./zsh -f
It's at the first sprintf in the following in get_comp_string(). tok is
51, which is FOR, which is out of range for tokstrings, which only
handles tokens looking like punctuation.
if (inredir) {
rdstr = rdstrbuf;
if (tokfd >= 0)
sprintf(rdop, "%d%s", tokfd, tokstrings[tok]);
else
strcpy(rdop, tokstrings[tok]);
strcpy(rdstr, rdop);
}
We've got to this branch because redir is set for special commands which
take lists in ctxtlex():
if (IS_REDIROP(tok) || tok == FOR || tok == FOREACH || tok == SELECT) {
inredir = 1;
...
so there are two ways to handle it: make these three tokens special
cases of redirections, or simply ignore the inredir flag for them.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Core dump on completion after `for'
2002-03-06 19:19 Core dump on completion after `for' Peter Stephenson
@ 2002-03-07 8:35 ` Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2002-03-07 8:35 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> % ./zsh -f
> % for f in <TAB>zsh: segmentation fault (core dumped) ./zsh -f
>
> ...
>
> so there are two ways to handle it: make these three tokens special
> cases of redirections, or simply ignore the inredir flag for them.
Oh, sorry. I've done the latter.
Bye
Sven
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.33
diff -u -r1.33 zle_tricky.c
--- Src/Zle/zle_tricky.c 1 Mar 2002 10:42:02 -0000 1.33
+++ Src/Zle/zle_tricky.c 7 Mar 2002 08:36:18 -0000
@@ -1086,7 +1086,7 @@
else
linarr = 0;
}
- if (inredir) {
+ if (inredir && IS_REDIROP(tok)) {
rdstr = rdstrbuf;
if (tokfd >= 0)
sprintf(rdop, "%d%s", tokfd, tokstrings[tok]);
--
Sven Wischnowsky wischnow@berkom.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-03-07 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-06 19:19 Core dump on completion after `for' Peter Stephenson
2002-03-07 8:35 ` Sven Wischnowsky
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).