zsh-workers
 help / color / mirror / code / Atom feed
* Bug in Functions/Misc/regexp-replace
@ 2021-04-29 23:53 Jacob Menke
  2021-04-30  0:40 ` Matthew Martin
  2021-04-30  6:51 ` Stephane Chazelas
  0 siblings, 2 replies; 9+ messages in thread
From: Jacob Menke @ 2021-04-29 23:53 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 478 bytes --]

Hello,

I think I found a bug in Functions/Misc/regexp-replace

Steps to reproduce:

zsh -f
str='x :=bad'
autoload regexp-replace
regexp-replace str 'a' 'z' && echo $str

Actual Output:
(eval):1: bzd not found

Expected:
x :=bzd

Root cause:
Line 41: eval ${1}=${(q)5}
It appears the ${(q)5} is not escaping = so the =command is executed after :

Instead of 'x\ :\=bad', you get '= x\ :=bad'

One way to fix:
41: eval ${1}=${(qqq)5}

Patch file is attached.

Thanks
Jacob Menke

[-- Attachment #1.2: Type: text/html, Size: 941 bytes --]

[-- Attachment #2: regexp-replace.patch --]
[-- Type: application/x-patch, Size: 328 bytes --]

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

end of thread, other threads:[~2021-04-30 21:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 23:53 Bug in Functions/Misc/regexp-replace Jacob Menke
2021-04-30  0:40 ` Matthew Martin
2021-04-30  5:56   ` Stephane Chazelas
2021-04-30  6:51 ` Stephane Chazelas
2021-04-30  8:17   ` tilde expansion after quoted : in assignments Stephane Chazelas
2021-04-30 17:43     ` Bart Schaefer
2021-04-30 20:13   ` Bug in Functions/Misc/regexp-replace Jacob Menke
2021-04-30 21:22     ` Bart Schaefer
2021-04-30 20:43   ` 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).