Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#255788: $'' does not work after <<<



Clint Adams wrote:
> Interesting that the x is disappearing.
> 
> > Current behaviour (tested with zsh -f):
> > 
> >    % cat <<< $'x\ny'
> >    \ny
> > 
> > Desired behaviour:
> > 
> >    % cat <<< $'x\ny'
> >    x
> >    y

I don't know the history of this, but it looks like someone got their
wires crossed, since the remnulargs() in the parsing code is obviously
incompatible with the singsub() in the exec code (er, for certain values
of `obviously').  I haven't dared remove the dupstring() but I suspect
it must be redundant, somehow.

By the way I think this sort of thing ought to work, too:

cat <<$'a\tb'
Here document
a	t

so I've made it.  Again, it does in bash.  That's the first hunk.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.65
diff -u -r1.65 exec.c
--- Src/exec.c	22 Jun 2004 13:10:02 -0000	1.65
+++ Src/exec.c	25 Jun 2004 09:50:31 -0000
@@ -2714,9 +2714,10 @@
 
     for (s = str; *s; s++)
 	if (INULL(*s)) {
-	    *s = Nularg;
 	    qt = 1;
+	    break;
 	}
+    singsub(&str);
     untokenize(str);
     if (typ == REDIR_HEREDOCDASH) {
 	strip = 1;
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.45
diff -u -r1.45 parse.c
--- Src/parse.c	22 Jun 2004 13:10:02 -0000	1.45
+++ Src/parse.c	25 Jun 2004 09:50:32 -0000
@@ -1755,7 +1755,7 @@
 	    type = tokstr[0] == Inang ? REDIR_INPIPE : REDIR_OUTPIPE;
 	break;
     case REDIR_HERESTR:
-        remnulargs(name = dupstring(name));
+        name = dupstring(name);
         break;
     }
     yylex();

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


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author