Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in regexp operator when warn_create_global is in effect
- X-seq: zsh-workers 40498
- From: Ronald Fischer <ynnor@xxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: Bug in regexp operator when warn_create_global is in effect
- Date: Mon, 06 Feb 2017 12:26:37 +0100
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=mm.st; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=nWe9X+MM0rXX0KPbpEhoyGnRzR E=; b=NsPTYz9aG0TxP+4z62YV03aD+YzEDjBoelFDZWRMWfklEztUaUy/oKitBf csEyT4y4kVAgcWueoVq7AT7O15EiEZlU4MOi6erW4Ppv19zq6nm5gi62O/8rtGcS t0h5QENi1mv0/57+crJ2QMW9FR2BHWV9GB6q7f78COPoIsGgY=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=nW e9X+MM0rXX0KPbpEhoyGnRzRE=; b=owZEGkiw+jrIiuxSqKe1ejjID/Iv/sdqF1 8FY/Zqu0y2Dx8IJuuW21seNImEbCdCA1irTQQX7KnSF8XOcXS7LZ4cSTP6B2j5it MQAXCGD6sEDL9mYZkDpfbHIm8ze47eTv+9AnBv5zjRalUhuTs5DJZR4okX9ZCm1Z KhMpa/v6k=
- In-reply-to: <20170206111152.7ed7ba11@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20170202073801epcas4p3fa77b3bbe2794d2f574ac0319f13ab3f@epcas4p3.samsung.com> <1486021036.1782934.867696784.0FCB3E9A@webmail.messagingengine.com> <20170202094340.64946066@pwslap01u.europe.root.pri> <1486377849.3086499.871611224.31A19FC9@webmail.messagingengine.com> <20170206111152.7ed7ba11@pwslap01u.europe.root.pri>
On Mon, Feb 6, 2017, at 12:11, Peter Stephenson wrote:
> On Mon, 06 Feb 2017 11:44:09 +0100
> Ronald Fischer <ynnor@xxxxx> wrote:
> > > Yes, you're right, the user doesn't even necessarily want them, which is
> > > different from the case of the globbing flags in native zsh
> > > expressions. So probably best to turn the warnings off.
> >
> > I wouldn't consider this an optimal solution. This type of warning
> > proved to be extremely useful, and was catching already several spelling
> > errors in our own program.
>
> I'm not sure what you're referring to, but the change only turns off the
> warnings for the case in question, i.e. regular expression matches,
> where the use of the variables is hidden, the one you were complaining
> about.
I think I misunderstood your comment here. I thought that you did not
want to change anything in zsh, but recommend that I simply turn off
warning about creating globals inside functions. This indeed would not
have been a good idea.
Basically, I want to be warned about globals which I explicitly create
by myself, but I don't want to be warned about globals which are created
implicitly by zsh (since I don't have any control about them.
> If you're talking about other cases, if you could show exactly what's
> triggering a warning, or failing to trigger it, I'll have a look.
The case is exactly the example program I've supplied: We get a warning
about a global variable being created, while this variable is not even
mentioned anywhere in the code.
About the suggestion in my original posting: What speaks against the
idea of creating all "implicit variables" as globals implicitly, when
the shell starts execution? That is, a program
#!/bin/zsh
source something
foo bar
would be equivalent (that is, internally replaced) by
#!/bin/zsh
MATCH=
source something
foo bar
If you worry that MATCH could be an exported variable in the parent
shell (and hence must not be modified), it is trivial to include this
case as well.
Ronald
Messages sorted by:
Reverse Date,
Date,
Thread,
Author