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

Re: [SOLVED] Libtool/zsh quoting problem: a zsh... bug?



Wayne Davison wrote:
> I just took a look at that code using Peter's old patch as a start, and
> the assertion that the quotes have been stripped out is not quite true:
> there are still Dnull and Snull characters remaining which indicate that
> there used to be a double- or single-quotes present.  This allows us to
> check the string.  An overly simple version is this:
> 
> --- subst.c	6 Feb 2006 11:57:06 -0000	1.44
> +++ subst.c	11 Feb 2006 18:07:23 -0000
> @@ -2012,6 +2012,8 @@ paramsubst(LinkList l, LinkNode n, char 
>  		 */
>  		multsub(&val, (aspar ? NULL : &aval), &isarr, NULL);
>  		copied = 1;
> +		if (spbreak && (*s == Dnull || *s == Snull))
> +		    spbreak = 0;
>  	    }
>  	    break;
>  	case ':':
> 
> This will turn off word-splitting if the string started with a single or
> a double quote.  This is incomplete because the arg may be something
> more complicated (such as: 'one' 'two' 'three four'), but it seems
> better than what we have now.

Frankly, it's such a mess at the moment that I think any practical
improvement is a good thing.  However, I think a comment would be a good
idea.  (I've already covered paramsubst() with ranty comments about the
mess but never worked out what to do about it.)

> One question I have is what to do about ${=1:"$@"}?  In the patch above,
> I chose to let the double quotes override the '='.  If that is not
> desired, change the new "if" to only trigger disallow an spbreak of 2:
> 
> +		if (spbreak == 1 && (*s == Dnull || *s == Snull))

As pointed out elsewhere, the ${1+"$@"} is to work around limitations of
old Bourne shells and this sort of thing isn't that natural in native
zsh, which is the only place we have to worry about the = syntax.  I
would probably expect the splitting to take place, but I'm not that
fussed.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



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