zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: ${(z)...} with error
@ 2002-06-14 13:14 Peter Stephenson
  2002-06-14 13:18 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2002-06-14 13:14 UTC (permalink / raw)
  To: Zsh hackers list

If a ${(z)...} aborts early, the space we added at the end for the lexer
to be able to spot the end of the last word isn't stripped, so we end up
returning a final string with a bogus space at the end.

It's hard to know if there are pathological cases, however.  I think
this is better than it was before, but it may well not be perfect.

It would actually be quite nice to indicate to the user a lexical error
in the last word, but it's hard to pass back.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.44
diff -u -r1.44 hist.c
--- Src/hist.c	24 Mar 2002 23:52:47 -0000	1.44
+++ Src/hist.c	14 Jun 2002 13:13:04 -0000
@@ -2291,7 +2291,16 @@
 	}
     } while (tok != ENDINPUT && tok != LEXERR);
     if (buf && tok == LEXERR && tokstr && *tokstr) {
+	int plen;
 	untokenize((p = dupstring(tokstr)));
+	plen = strlen(p);
+	/*
+	 * Strip the space we added for lexing but which won't have
+	 * been swallowed by the lexer because we aborted early.
+	 * The test is paranoia.
+	 */
+	if (plen && p[plen-1] == ' ' && (plen == 1 || p[plen-2] != Meta))
+	    p[plen - 1] = '\0';
 	addlinknode(list, p);
 	num++;
     }

-- 
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] 5+ messages in thread

* Re: PATCH: ${(z)...} with error
  2002-06-14 13:14 PATCH: ${(z)...} with error Peter Stephenson
@ 2002-06-14 13:18 ` Peter Stephenson
  2002-06-14 13:32   ` Borsenkow Andrej
  2002-06-14 16:29   ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Stephenson @ 2002-06-14 13:18 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> If a ${(z)...} aborts early, the space we added at the end for the lexer
> to be able to spot the end of the last word isn't stripped, so we end up
> returning a final string with a bogus space at the end.

By the way, if no-one sees any too horrific possibilities I will commit
this to both branches.

It seems highly unlikely anyone is going to be checking exhaustively for
more patches to transfer to 4.0 so unless someone has urgent business I
will produce 4.0.5 (as well as a new dev release of 4.1) in the near
future.

pws


**********************************************************************
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] 5+ messages in thread

* RE: PATCH: ${(z)...} with error
  2002-06-14 13:18 ` Peter Stephenson
@ 2002-06-14 13:32   ` Borsenkow Andrej
  2002-06-14 13:40     ` Borsenkow Andrej
  2002-06-14 16:29   ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Borsenkow Andrej @ 2002-06-14 13:32 UTC (permalink / raw)
  To: 'Peter Stephenson', 'Zsh hackers list'

> 
> It seems highly unlikely anyone is going to be checking exhaustively
for
> more patches to transfer to 4.0 

we had a number of completion fixes (no, I cannot tell exact articles at
the moment) that I'd like to see in 4.0 as well. If you can wait until
weekend I'll try to dig them out.

-andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: PATCH: ${(z)...} with error
  2002-06-14 13:32   ` Borsenkow Andrej
@ 2002-06-14 13:40     ` Borsenkow Andrej
  0 siblings, 0 replies; 5+ messages in thread
From: Borsenkow Andrej @ 2002-06-14 13:40 UTC (permalink / raw)
  To: 'Zsh hackers list'

> 
> >
> > It seems highly unlikely anyone is going to be checking exhaustively
> for
> > more patches to transfer to 4.0
> 
> we had a number of completion fixes (no, I cannot tell exact articles
at
> the moment) that I'd like to see in 4.0 as well. If you can wait until
> weekend I'll try to dig them out.
> 

Some of them (in no particular order)

17148, 17163, 17135, 17195, 17193, 17192, 17191, 17189, 17125, 17159,
17196


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: ${(z)...} with error
  2002-06-14 13:18 ` Peter Stephenson
  2002-06-14 13:32   ` Borsenkow Andrej
@ 2002-06-14 16:29   ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2002-06-14 16:29 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Fri, 14 Jun 2002, Peter Stephenson wrote:

> It seems highly unlikely anyone is going to be checking exhaustively for
> more patches to transfer to 4.0 so unless someone has urgent business I
> will produce 4.0.5 (as well as a new dev release of 4.1) in the near
> future.

I don't recall whether anyone finished going through the list of article
numbers that I posted ... or is that what you mean?

Here they are again (not updated for anything recent, but I think we've
been pretty good about propagating things recently):

users/4157 users/4503 users/4483
16988 16956 16955 16933 16927 16923 16913 16911 16906 16895 16879 16862
16849 16847 16842 16838 16831 16823 16821 16819 16803 16789 16779 16776
16774 16769 16767 16755 16751 16748 16737 16711 16710 16708 16697 16689
16688 16678 16676 16673 16672 16669 16668 16667 16625 16620 16619 16618
16609 16582 16577 16555 16553 16527 16515 16503 16494 16492 16489 16487
16486 16483 16472 16464 16448 16443 16437 16426 16423 16422 16418 16417
16407 16406 16398 16397 16393 16372 16361 16357 16353 16352 16349 16347
16346 16345 16330 16325 16323 16320 16310 16258 16255 16254 16253 16247
16241 16228 16224 16198 16197 16177 16176 16174 16172 16158


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-06-14 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-14 13:14 PATCH: ${(z)...} with error Peter Stephenson
2002-06-14 13:18 ` Peter Stephenson
2002-06-14 13:32   ` Borsenkow Andrej
2002-06-14 13:40     ` Borsenkow Andrej
2002-06-14 16:29   ` Bart Schaefer

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).