From: Ronald Fischer <ynnor@mm.st>
To: zsh-workers@zsh.org
Subject: Bug in regexp operator when warn_create_global is in effect
Date: Thu, 02 Feb 2017 08:37:16 +0100 [thread overview]
Message-ID: <1486021036.1782934.867696784.0FCB3E9A@webmail.messagingengine.com> (raw)
Consider the following program:
#!/bin/zsh
function f {
[[ x =~ x ]]
}
setopt warn_create_global
f
When run by zsh 5.2 (x86_64-ubuntu-linux-gnu), I get the error messages:
f:1: scalar parameter MATCH created globally in function f
f:1: numeric parameter MBEGIN created globally in function f
f:1: numeric parameter MEND created globally in function f
While it is correct, that regexp matching sets, as side effect, the
variables mentioned here, it doesn't, IMHO, make much sense that a zsh
user, who not even *uses* these variables, receives these error
messages. If the user had to pay attention to those variables which
automatically spring into existence by zsh language constructs, doing a
cd inside a function should equally well raise the message "parameter
OLDPWD created globally in function".
I suggest that the variables MATCH, MBEGIN and MEND are already created
by zsh
as global parameters during shell startup time. This would not trigger
the warning, if someone uses regexp matching inside functions.
Ronald
next reply other threads:[~2017-02-02 7:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170202073801epcas4p3fa77b3bbe2794d2f574ac0319f13ab3f@epcas4p3.samsung.com>
2017-02-02 7:37 ` Ronald Fischer [this message]
2017-02-02 9:43 ` Peter Stephenson
2017-02-02 22:55 ` Bart Schaefer
2017-02-03 9:20 ` Peter Stephenson
2017-02-06 10:44 ` Ronald Fischer
2017-02-06 11:11 ` Peter Stephenson
2017-02-06 11:26 ` Ronald Fischer
2017-02-06 12:02 ` Peter Stephenson
2017-02-06 15:48 ` Ronald Fischer
2017-02-06 16:04 ` Peter Stephenson
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=1486021036.1782934.867696784.0FCB3E9A@webmail.messagingengine.com \
--to=ynnor@mm.st \
--cc=zsh-workers@zsh.org \
/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).