Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug in regexp operator when warn_create_global is in effect
- X-seq: zsh-workers 40484
- From: Ronald Fischer <ynnor@xxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Bug in regexp operator when warn_create_global is in effect
- Date: Thu, 02 Feb 2017 08:37:16 +0100
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=mm.st; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=sip1pfZ9WYHad+/BXJiJycMid6M=; b=LhxtJ21wGN86jrstwoTIq aLR8VOSfag1m11STEYQCbzAtgz/DpkqbdKohtFuMxWGf5uXV7IRsMFAZmtHQN0cK AdnKom5FpzkNEaY2csw17cgCK1ZkFg1a+u+zU8flPnnt5+seKG6KFS2kdTMb8fRQ AGPG7ru9UicZDA/1yD0DJU=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=smtpout; bh=sip1pfZ9WYHad+/BXJiJycMid 6M=; b=Z1kQX19DsTBaZ5SPkS5DfxDWMhUzsPr4jZd5dx2ECiqPqeGT2LmqFgySu Fzfv2BHA2BkEoQ52vQ8kmzZqFk1q9l21pnlTyzeRwMtAJQE78szoaRATDVCGG4iR Itzg0KD7R10xqkib1rOAKftsStybw+uXZx2HVcYp/vkOFcXqkk=
- 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
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author