zsh-workers
 help / color / mirror / code / Atom feed
* WARN_CREATE_GLOBAL and url-quote-magic
@ 2015-12-11 13:05 Vincent Lefevre
  2015-12-11 13:50 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2015-12-11 13:05 UTC (permalink / raw)
  To: zsh-workers

I don't think that the following has been reported yet. Run "zsh -f"
and:

  setopt WARN_CREATE_GLOBAL
  autoload -Uz url-quote-magic
  zle -N self-insert url-quote-magic

Then type "echo a:b ". After typing the space after "a:b", I get:

cventin% echo a:b
url-quote-magic:12: array parameter match created globally in function url-quote-magic
url-quote-magic:12: array parameter mbegin created globally in function url-quote-magic
url-quote-magic:12: array parameter mend created globally in function url-quote-magic
cventin% echo a:b 

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: WARN_CREATE_GLOBAL and url-quote-magic
  2015-12-11 13:05 WARN_CREATE_GLOBAL and url-quote-magic Vincent Lefevre
@ 2015-12-11 13:50 ` Peter Stephenson
  2015-12-11 16:52   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2015-12-11 13:50 UTC (permalink / raw)
  To: zsh-workers

On Fri, 11 Dec 2015 14:05:07 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> I don't think that the following has been reported yet. Run "zsh -f"
> and:
> 
>   setopt WARN_CREATE_GLOBAL
>   autoload -Uz url-quote-magic
>   zle -N self-insert url-quote-magic
> 
> Then type "echo a:b ". After typing the space after "a:b", I get:
> 
> cventin% echo a:b
> url-quote-magic:12: array parameter match created globally in function url-quote-magic
> url-quote-magic:12: array parameter mbegin created globally in function url-quote-magic
> url-quote-magic:12: array parameter mend created globally in function url-quote-magic
> cventin% echo a:b 

Yes, it's the (#b) in the pattern creating those parameters.  All such
instances in distributed functions should be suitably protected.

I don't think there's any chance of needing the result in a higher scope
this time...

pws

diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic
index 0e49573..7ee281e 100644
--- a/Functions/Zle/url-quote-magic
+++ b/Functions/Zle/url-quote-magic
@@ -115,7 +115,7 @@ alias globurl='noglob urlglobber '
 function url-quote-magic {
     setopt localoptions noksharrays extendedglob
     local qkey="${(q)KEYS}"
-    local -a reply
+    local -a reply match mbegin mend
     if [[ "$KEYS" != "$qkey" ]]
     then
 	local lbuf="$LBUFFER$qkey"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: WARN_CREATE_GLOBAL and url-quote-magic
  2015-12-11 13:50 ` Peter Stephenson
@ 2015-12-11 16:52   ` Bart Schaefer
  2015-12-11 16:55     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2015-12-11 16:52 UTC (permalink / raw)
  To: zsh-workers

On Dec 11,  1:50pm, Peter Stephenson wrote:
}
} Yes, it's the (#b) in the pattern creating those parameters.  All such
} instances in distributed functions should be suitably protected.

This doesn't directly apply to url-quote-magic because it does not have
an "emulate" call, but I'm left wondering whether "emulate zsh" should
reset warn_create_global.

Obviously "emulate -R zsh" does so, but why isn't warn_create_global
considered to be "likely to cause portability problems in scripts and
functions" ?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: WARN_CREATE_GLOBAL and url-quote-magic
  2015-12-11 16:52   ` Bart Schaefer
@ 2015-12-11 16:55     ` Peter Stephenson
  2015-12-11 17:11       ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2015-12-11 16:55 UTC (permalink / raw)
  To: zsh-workers

On Fri, 11 Dec 2015 08:52:20 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Dec 11,  1:50pm, Peter Stephenson wrote:
> }
> } Yes, it's the (#b) in the pattern creating those parameters.  All such
> } instances in distributed functions should be suitably protected.
> 
> This doesn't directly apply to url-quote-magic because it does not have
> an "emulate" call, but I'm left wondering whether "emulate zsh" should
> reset warn_create_global.
> 
> Obviously "emulate -R zsh" does so, but why isn't warn_create_global
> considered to be "likely to cause portability problems in scripts and
> functions" ?

I've got no object to that.

pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: WARN_CREATE_GLOBAL and url-quote-magic
  2015-12-11 16:55     ` Peter Stephenson
@ 2015-12-11 17:11       ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2015-12-11 17:11 UTC (permalink / raw)
  To: zsh-workers

On Fri, 11 Dec 2015 16:55:46 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> I've got no object to that.

(I did have an object, but the object shouldn't have been "no object",
it should have been "no objection".)

pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-11 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 13:05 WARN_CREATE_GLOBAL and url-quote-magic Vincent Lefevre
2015-12-11 13:50 ` Peter Stephenson
2015-12-11 16:52   ` Bart Schaefer
2015-12-11 16:55     ` Peter Stephenson
2015-12-11 17:11       ` Peter Stephenson

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).