zsh-workers
 help / color / mirror / code / Atom feed
* Bug in ${(Q)...}
@ 2003-07-13  2:38 Philippe Troin
  2003-07-13 17:24 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Troin @ 2003-07-13  2:38 UTC (permalink / raw)
  To: zsh-workers

% emulate -R zsh
% setopt extended_glob
% echo $ZSH_VERSION "<${(Q)${$(print hello)/%hello#}}>"
4.0.6 < >

Shouldn't that be:
4.0.6 <>

(no space)

But note that:

% echo $ZSH_VERSION "<${(Q)$(print hello)/%hello#}>"  
4.0.6 <>

And that sounds good.

Phil.


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

* Re: Bug in ${(Q)...}
  2003-07-13  2:38 Bug in ${(Q)...} Philippe Troin
@ 2003-07-13 17:24 ` Bart Schaefer
  2003-07-17  9:32   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2003-07-13 17:24 UTC (permalink / raw)
  To: zsh-workers

On Jul 12,  7:38pm, Philippe Troin wrote:
} Subject: Bug in ${(Q)...}
}
} % setopt extended_glob
} % echo $ZSH_VERSION "<${(Q)${$(print hello)/%hello#}}>"
} 4.0.6 < >
} 
} Shouldn't that be:
} 4.0.6 <>
} 
} (no space)

This is indeed a bug.  No process substitution required:

schaefer<501> x=(hello)
schaefer<502> setopt extendedglob
schaefer<503> echo $ZSH_VERSION "<${(Q)${${x}/%hello#}}>"
4.1.1-dev-1 < >

But it's not arrays, either, which I initially thought it was:

schaefer<505> x=hello
schaefer<506> echo $ZSH_VERSION "<${(Q)${${x}/%hello#}}>"
4.1.1-dev-1 < >
schaefer<507> echo $ZSH_VERSION "<${(Q)${x/%hello#}}>" 
4.1.1-dev-1 < >

So I'm not sure if this is really a problem with (Q) in paramsubst(), or
if it's deeper, in parse_subst_string(), and it just happens that (Q)
makes it visible.


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

* Re: Bug in ${(Q)...}
  2003-07-13 17:24 ` Bart Schaefer
@ 2003-07-17  9:32   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2003-07-17  9:32 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
> On Jul 12,  7:38pm, Philippe Troin wrote:
> } Subject: Bug in ${(Q)...}
> }
> } % setopt extended_glob
> } % echo $ZSH_VERSION "<${(Q)${$(print hello)/%hello#}}>"
> } 4.0.6 < >
> }
> } Shouldn't that be:
> } 4.0.6 <>
> }
> } (no space)
>
> So I'm not sure if this is really a problem with (Q) in paramsubst(), or
> if it's deeper, in parse_subst_string(), and it just happens that (Q)
> makes it visible.

I think the fix is the following.  I've never quite followed the logic
of using a string consisting only of a Nularg to represent an empty
string, but it occurs sporadically.

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.24
diff -u -r1.24 lex.c
--- Src/lex.c	6 Oct 2002 18:38:14 -0000	1.24
+++ Src/lex.c	17 Jul 2003 09:29:06 -0000
@@ -1512,7 +1512,7 @@
 {
     int c, l = strlen(s), err, olen;
 
-    if (! *s)
+    if (!*s || !strcmp(s, nulstring))
 	return 0;
     lexsave();
     untokenize(s);

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2003-07-17  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-13  2:38 Bug in ${(Q)...} Philippe Troin
2003-07-13 17:24 ` Bart Schaefer
2003-07-17  9:32   ` Peter Stephenson

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