zsh-workers
 help / color / mirror / code / Atom feed
From: Jacob Menke <linux.dev25@gmail.com>
To: zsh-workers@zsh.org
Subject: Bug in Functions/Misc/regexp-replace
Date: Thu, 29 Apr 2021 19:53:52 -0400	[thread overview]
Message-ID: <CAB5oL3Z4m+vYsGLzkAqw62o3RbUy+N5HpgbBuLn_kK99YPNjDg@mail.gmail.com> (raw)


[-- 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 --]

             reply	other threads:[~2021-04-29 23:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 23:53 Jacob Menke [this message]
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

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=CAB5oL3Z4m+vYsGLzkAqw62o3RbUy+N5HpgbBuLn_kK99YPNjDg@mail.gmail.com \
    --to=linux.dev25@gmail.com \
    --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).