[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Failing shell code under busybox 1.36.1 that worked with 1.31.1
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2024-02-26 15:39:40
Message-ID: CAK1hOcPXKw76OzjXzsq6pBZtBT8hWjdZVwnXa9kXNvtRXokZZg () mail ! gmail ! com
[Download RAW message or body]

On Thu, Feb 15, 2024 at 9:52 AM David Leonard
<d+busybox@adaptive-enterprises.com> wrote:
> >         _result="$_result '${_p//'/'\"'\"'}'"
>
> Busybox ash has a CONFIG_ASH_BASH_COMPAT config to get this ${var//...}
> replacement behaviour.  And, in bash, the ' in the pattern section is treated
> as a quote start. To give the ' a literal meaning, use \'
> eg ${_p//\'/..repl..}
>
> In current busybox ash you will run into a bug where quotes aren't
> handled in the pattern, and even loses the rest of the word, as you
> observed. That is, given this script:
>
>         var="don't g/o"
>         echo "${var/'/'o}!"
>         echo "${var/\'/\'o}!"
>
> bash outputs:
>
>         don't g!                        (pattern="/o" repl="")
>         don'ot g/o!                     (pattern="'", repl="'o")
>
> and busybox ash outputs:
>
>         don't g/o                       (pattern=?, repl=?, NOTE: lost !)
>         don'ot g/o!                     (pattern="'", repl="'o")
>
> Here's a patch to make ash a little bit closer to bash.

Thank you, applied (with some changes, but the same idea).
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic