zsh-workers
 help / color / mirror / code / Atom feed
* perl 5.22 causes warnings when zsh calls it
@ 2015-06-28 19:44 John
  2015-06-28 21:04 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: John @ 2015-06-28 19:44 UTC (permalink / raw)
  To: zsh-workers

Using Arch Linux + grml-zsh-config and zsh version 5.0.8 with the latest release of perl (5.22.0) causes warning messages when zsh calls perl.  Specifically, switching themes that have a token via `prompt adam1 yellow` can trigger it due to zsh invoking a perl line that the new version of perl doesn't like.  This was not the case under the older version of perl.

Under perl 5.20.2-1:
3:02% prompt adam1 yellow
facade@playtime ~ %
Under perl 5.22.0-1:

3:03% prompt adam1 yellow
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%(K{ <-- HERE .*?}|k)/ at -e line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%(K{ <-- HERE .*?}|k)/ at -e line 1.

facade@playtime ~ %

If I `set -x` in an attempt to debug, I found this line which I believe zsh is calling:


...
+prompt_adam1_setup:8:> base_prompt_no_color=+prompt_adam1_setup:8:cmdsubst pipe> perl -pe 's/%(K{.*?}|k)//g'
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%(K{ <-- HERE .*?}|k)/ at -e line 1.

Note - I am not subscribed to the ML so please remember to cc me on all subsequent correspondence.


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

* Re: perl 5.22 causes warnings when zsh calls it
  2015-06-28 19:44 perl 5.22 causes warnings when zsh calls it John
@ 2015-06-28 21:04 ` Bart Schaefer
  2015-07-05 12:41   ` John
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2015-06-28 21:04 UTC (permalink / raw)
  To: zsh-workers; +Cc: John

On Jun 28,  7:44pm, John wrote:
} Subject: perl 5.22 causes warnings when zsh calls it
}
} Using Arch Linux + grml-zsh-config and zsh version 5.0.8 with the
} latest release of perl (5.22.0) causes warning messages when zsh calls
} perl.

This is specific to using the adam1 prompt theme, but there's no reason
for any of the prompt themes to be calling perl.

Also looks like years ago somebody copied the adam2 help strings into
adam1 and never noticed that left this theme dissing itself.

Aside:  Damn, it's hard to get curly braces into a pattern in a parameter
substitution inside double quotes.


diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index 034641f..aca0e59 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -14,8 +14,6 @@ This theme works best with a dark background.
 Recommended fonts for this theme: nexus or vga or similar.  If you
 don't have any of these, then specify the `plain' option to use 7-bit
 replacements for the 8-bit characters.
-
-And you probably thought adam1 was overkill.
 EOF
 }
 
@@ -27,8 +25,9 @@ prompt_adam1_setup () {
   base_prompt="%K{$prompt_adam1_color1}%n@%m%k "
   post_prompt="%b%f%k"
 
-  base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%(K{.*?}|k)//g")
-  post_prompt_no_color=$(echo "$post_prompt" | perl -pe "s/%(K{.*?}|k)//g")
+  setopt localoptions extendedglob
+  base_prompt_no_color="${base_prompt//(%K{[^\\\}]#\}|%k)/}"
+  post_prompt_no_color="${post_prompt//(%K{[^\\\}]#\}|%k)/}"
 
   add-zsh-hook precmd prompt_adam1_precmd
 }


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

* Re: perl 5.22 causes warnings when zsh calls it
  2015-06-28 21:04 ` Bart Schaefer
@ 2015-07-05 12:41   ` John
  2015-07-05 18:32     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: John @ 2015-07-05 12:41 UTC (permalink / raw)
  To: Bart Schaefer, zsh-workers

Thanks, this works. Will it be incorporated into the next release of zsh?


----- Original Message -----
> Aside:  Damn, it's hard to get curly braces into a pattern in a parameter
> substitution inside double quotes.
> 
> 
> diff --git a/Functions/Prompts/prompt_adam1_setup 
> b/Functions/Prompts/prompt_adam1_setup
> index 034641f..aca0e59 100644
> --- a/Functions/Prompts/prompt_adam1_setup
> +++ b/Functions/Prompts/prompt_adam1_setup
> @@ -14,8 +14,6 @@ This theme works best with a dark background.
> Recommended fonts for this theme: nexus or vga or similar.  If you
> don't have any of these, then specify the `plain' option to use 7-bit
> replacements for the 8-bit characters.
> -
> -And you probably thought adam1 was overkill.
> EOF
> }
> 
> @@ -27,8 +25,9 @@ prompt_adam1_setup () {
>    base_prompt="%K{$prompt_adam1_color1}%n@%m%k "
>    post_prompt="%b%f%k"
> 
> -  base_prompt_no_color=$(echo "$base_prompt" | perl -pe 
> "s/%(K{.*?}|k)//g")
> -  post_prompt_no_color=$(echo "$post_prompt" | perl -pe 
> "s/%(K{.*?}|k)//g")
> +  setopt localoptions extendedglob
> +  
> base_prompt_no_color="${base_prompt//(%K{[^\\\}]#\}|%k)/}"
> +  
> post_prompt_no_color="${post_prompt//(%K{[^\\\}]#\}|%k)/}"
> 
>    add-zsh-hook precmd prompt_adam1_precmd
> 
> }
> 


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

* Re: perl 5.22 causes warnings when zsh calls it
  2015-07-05 12:41   ` John
@ 2015-07-05 18:32     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2015-07-05 18:32 UTC (permalink / raw)
  To: John, zsh-workers@zsh.org 

On Jul 5, 12:41pm, John wrote:
} Subject: Re: perl 5.22 causes warnings when zsh calls it
}
} Thanks, this works. Will it be incorporated into the next release of zsh?

Yes.


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

end of thread, other threads:[~2015-07-05 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-28 19:44 perl 5.22 causes warnings when zsh calls it John
2015-06-28 21:04 ` Bart Schaefer
2015-07-05 12:41   ` John
2015-07-05 18:32     ` Bart Schaefer

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