zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: [SOLVED] Libtool/zsh quoting problem: a zsh... bug?
Date: Sun, 12 Feb 2006 20:26:17 +0000	[thread overview]
Message-ID: <200602122026.k1CKQHGH003629@pwslaptop.csr.com> (raw)
In-Reply-To: Your message of "Sat, 11 Feb 2006 10:14:40 PST." <20060211181440.GA30984@dot.blorf.net>

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@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


  parent reply	other threads:[~2006-02-12 20:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-09 23:32 Libtool/zsh quoting problem David Gómez
2006-02-10  8:46 ` DervishD
2006-02-10  9:48   ` David Gómez
2006-02-10 11:34     ` DervishD
2006-02-10 12:56       ` David Gómez
2006-02-10 14:25         ` DervishD
2006-02-10 18:27           ` David Gómez
2006-02-10 19:31             ` DervishD
2006-02-11  9:36 ` [SOLVED] Libtool/zsh quoting problem: a zsh... bug? DervishD
2006-02-11 10:21   ` Andrey Borzenkov
2006-02-11 11:06     ` DervishD
2006-02-11 11:33       ` David Gómez
2006-02-11 12:06         ` DervishD
2006-02-11 12:28       ` Andrey Borzenkov
2006-02-11 18:07         ` DervishD
2006-02-11 12:21     ` DervishD
2006-02-11 18:14     ` Wayne Davison
2006-02-11 18:22       ` DervishD
2006-02-11 18:58         ` Wayne Davison
2006-02-11 19:42       ` Bart Schaefer
2006-02-12  4:50         ` Wayne Davison
2006-02-12 20:28           ` Peter Stephenson
2006-02-13 10:56             ` Peter Stephenson
2006-02-12  7:46       ` Andrey Borzenkov
2006-02-12  7:54         ` Andrey Borzenkov
2006-02-12 20:26       ` Peter Stephenson [this message]
2006-02-13 10:53         ` PATCH: fixing ${1+"$@"} when word-splitting Wayne Davison
2006-02-13 11:34           ` Peter Stephenson
2006-02-13 17:43             ` Wayne Davison
2006-02-13 18:08               ` Peter Stephenson
2006-02-13 19:00                 ` Wayne Davison
2006-02-13 19:33                   ` Wayne Davison
2006-02-13 19:33                   ` Peter Stephenson
2006-02-13 20:11                     ` Wayne Davison
2006-02-13 19:48               ` Wayne Davison
2006-02-13 11:40           ` DervishD
2006-02-14  7:14           ` Wayne Davison
2006-02-15 10:31             ` Wayne Davison
2006-02-15 11:35             ` Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200602122026.k1CKQHGH003629@pwslaptop.csr.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).