Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
On Fri, Nov 4, 2022, 19:42 Chet Ramey wrote: > On 11/4/22 12:22 PM, Alex fxmbsw7 Ratchev wrote: > > > what on yours i ask , o i see now , 4.2 .. > > i quote right in ${ // - to me , preserved quotes are • an invalid youth > > bug to be replaced with better by bash.c changes > > which it

Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
addition to my greycat-answer mail .. i didnt use & there at all , my fault .. but with & its no else root@localhost:~# a=i_am_foo b=_ c=${b}am$b d=$b\&$b e=${a//"$c"/"$d"} ; printf ' --> %s\n' "$e" "${a//"$c"/"$d"}" --> i_&_foo --> i_&_foo sorry short imo , the ' " not parsing is outdated

Re: string substitution broken since 5.2

2022-11-04 Thread Chet Ramey
On 11/4/22 12:22 PM, Alex fxmbsw7 Ratchev wrote: what on yours i ask , o i see now , 4.2 .. i quote right in ${ // - to me , preserved quotes are • an invalid youth bug to be replaced with better by bash.c changes which it seemfully did The question is, as always, tradeoffs. Do you fix bugs

Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
On Fri, Nov 4, 2022, 17:03 Greg Wooledge wrote: > On Fri, Nov 04, 2022 at 01:30:16PM +0100, Alex fxmbsw7 Ratchev wrote: > > > 1) Put something like "shopt -u patsub_replacement 2>/dev/null || true" > > >at the top of your script. > > > > > > > there d be many such senselessnesses > > > > > >

Re: string substitution broken since 5.2

2022-11-04 Thread Greg Wooledge
On Fri, Nov 04, 2022 at 01:30:16PM +0100, Alex fxmbsw7 Ratchev wrote: > > 1) Put something like "shopt -u patsub_replacement 2>/dev/null || true" > >at the top of your script. > > > > there d be many such senselessnesses > > > > > 2) Assign the result of the expansion to a temporary

Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
that u word comply to very outdated specs i did word bye On Fri, Nov 4, 2022, 15:26 Martin D Kealey wrote: > I now very much regret not commenting on this proposal during the > pre-release period, and I apologise for not having done so. > > On Fri, 4 Nov 2022, 05:50 Chet Ramey, wrote: > > > >

Re: string substitution broken since 5.2

2022-11-04 Thread Koichi Murase
2022年11月4日(金) 23:26 Martin D Kealey : > I now very much regret not commenting on this proposal during the > pre-release period, and I apologise for not having done so. I actually raised the concern in [1], but Chet's reply [2] at the time was > I generally make new functionality that's

Re: string substitution broken since 5.2

2022-11-04 Thread Martin D Kealey
I now very much regret not commenting on this proposal during the pre-release period, and I apologise for not having done so. On Fri, 4 Nov 2022, 05:50 Chet Ramey, wrote: > > The option is enabled by default. If you want to restore the previous > behavior, add `shopt -u patsub_replacement'. >

Re: string substitution broken since 5.2

2022-11-04 Thread Chet Ramey
On 11/4/22 3:56 AM, Léa Gris wrote: Le 03/11/2022 à 19:50, Chet Ramey écrivait : The option is enabled by default. If you want to restore the previous behavior, add `shopt -u patsub_replacement'. Having it enabled by default is not good, because it introduces side-effects for existing

Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
On Fri, Nov 4, 2022, 12:33 Greg Wooledge wrote: > On Fri, Nov 04, 2022 at 09:50:03AM +0100, Alex fxmbsw7 Ratchev wrote: > > On Fri, Nov 4, 2022, 08:56 Léa Gris wrote: > > > > > Le 03/11/2022 à 19:50, Chet Ramey écrivait : > > > > The option is enabled by default. If you want to restore the

Re: string substitution broken since 5.2

2022-11-04 Thread Greg Wooledge
On Fri, Nov 04, 2022 at 09:50:03AM +0100, Alex fxmbsw7 Ratchev wrote: > On Fri, Nov 4, 2022, 08:56 Léa Gris wrote: > > > Le 03/11/2022 à 19:50, Chet Ramey écrivait : > > > The option is enabled by default. If you want to restore the previous > > > behavior, add `shopt -u patsub_replacement'. > >

Re: string substitution broken since 5.2

2022-11-04 Thread Alex fxmbsw7 Ratchev
On Fri, Nov 4, 2022, 08:56 Léa Gris wrote: > Le 03/11/2022 à 19:50, Chet Ramey écrivait : > > The option is enabled by default. If you want to restore the previous > > behavior, add `shopt -u patsub_replacement'. > > Having it enabled by default is not good, because it introduces > side-effects

Re: string substitution broken since 5.2

2022-11-04 Thread Léa Gris
Le 03/11/2022 à 19:50, Chet Ramey écrivait : The option is enabled by default. If you want to restore the previous behavior, add `shopt -u patsub_replacement'. Having it enabled by default is not good, because it introduces side-effects for existing scripts. Shell has historically

Re: string substitution broken since 5.2

2022-11-03 Thread Koichi Murase
2022年11月4日(金) 8:48 Greg Wooledge : > On Thu, Nov 03, 2022 at 05:20:52PM -0400, Greg Wooledge wrote: > > On Fri, Nov 04, 2022 at 04:09:10AM +0900, Koichi Murase wrote: > > > When one wants to also support Bash 4.2, one possible workaround is to > > > assign the result to a variable (without quoting

Re: string substitution broken since 5.2

2022-11-03 Thread Greg Wooledge
On Thu, Nov 03, 2022 at 05:20:52PM -0400, Greg Wooledge wrote: > On Fri, Nov 04, 2022 at 04:09:10AM +0900, Koichi Murase wrote: > > When one wants to also support Bash 4.2, one possible workaround is to > > assign the result to a variable (without quoting the right-hand side > > of the

Re: string substitution broken since 5.2

2022-11-03 Thread Greg Wooledge
On Fri, Nov 04, 2022 at 04:09:10AM +0900, Koichi Murase wrote: > When one wants to also support Bash 4.2, one possible workaround is to > assign the result to a variable (without quoting the right-hand side > of the assignment): > > $ bash-4.2 -c 'string=\"hi\"; string=${string//\"/\}; echo

Re: string substitution broken since 5.2

2022-11-03 Thread Koichi Murase
2022年11月4日(金) 3:46 Greg Wooledge : > On Fri, Nov 04, 2022 at 03:31:44AM +0900, Koichi Murase wrote: > > [...] > > > > Another option is to quote `&' in the replacement if you want to make > > it work regardless of the 5.2 feature, patsub_replacement: > > > > string="${string//\"/\}" > > Sadly,

Re: string substitution broken since 5.2

2022-11-03 Thread Chet Ramey
On 11/3/22 1:32 PM, thierryb--- via Bug reports for the GNU Bourne Again SHell wrote: Bash Version: 5.2 Patch Level: 2 Release Status: release Description: String substitution code running for years is broken in 5.2. Repeat-By: string = 'xdotool type "sudo apt update"'

Re: string substitution broken since 5.2

2022-11-03 Thread Greg Wooledge
On Fri, Nov 04, 2022 at 03:31:44AM +0900, Koichi Murase wrote: > 2022年11月4日(金) 2:50 Andreas Schwab : > > On Nov 03 2022, thierryb--- via Bug reports for the GNU Bourne Again SHell > > wrote: > > > Description: > > > String substitution code running for years is broken in 5.2. > > > > > >

Re: string substitution broken since 5.2

2022-11-03 Thread Thierry B.
Le 03/11/2022 à 18:49, Andreas Schwab a écrit : shopt -u patsub_replacement OK thanks, I read the 5.2 release notes. I just regret that this option is enabled by default, it will break many scripts running since years. -- Thierry Bothorel OpenPGP_0x81BB850F60BA2BC2.asc Description:

Re: string substitution broken since 5.2

2022-11-03 Thread Koichi Murase
2022年11月4日(金) 2:50 Andreas Schwab : > On Nov 03 2022, thierryb--- via Bug reports for the GNU Bourne Again SHell > wrote: > > Description: > > String substitution code running for years is broken in 5.2. > > > > Repeat-By: > > string = 'xdotool type "sudo apt update"' > >

Re: string substitution broken since 5.2

2022-11-03 Thread Andreas Schwab
On Nov 03 2022, thierryb--- via Bug reports for the GNU Bourne Again SHell wrote: > Description: > String substitution code running for years is broken in 5.2. > > Repeat-By: > string = 'xdotool type "sudo apt update"' > string="${string//\"/}" > printf '%s' "$string" > >