bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string substitution broken since 5.2


From: Alex fxmbsw7 Ratchev
Subject: Re: string substitution broken since 5.2
Date: Fri, 4 Nov 2022 13:30:16 +0100

On Fri, Nov 4, 2022, 12:33 Greg Wooledge <greg@wooledge.org> 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 <lea.gris@noiraude.net> 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 scripts.
> > >
> >
> > there is , imo , no sense to comply to outdated specs to not add few more
> > of the infinite base features
> >
> > nevermind ..
>
> There is no "spec" for this.  It's not a POSIX feature.  It's a bashism.
>

its a 'basic' to me .. viral .. essential

i am talking mr chet bash , sticks much to , draft specs , some , and much
on backward compatibility
its hard to add features like this

i.. would care ppl get informed of bugs they use cause , very old versions
in use , and so ly u can even assure future updates
for them , its 'it works for me'
to me , its like non acceptable

To be clear, we're talking about:
>
> somecmd "${var//search/replace}"
>
> where "replace" might be a string contained in a variable.
>
> The reason this is an issue is because bash 5.2 has changed the default
> behavior of this expansion in a way that not only changes the behavior of
> existing scripts (possibly "breaking" them), but also makes it extremely
> difficult to write one script that works across all bash versions.
>
> In order to write a version-portable script that uses this feature,
> now you have to choose between these two workarounds:
>

i mean yea , for those who 'portable'

my, 'posix++' specs are even less portable
not of the logic
of the diswantings of the parties there

in future , specs drafts will grow and addments done..
in future.. we are far away from it .. :(


> 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 variable, and pass
>    the temp var to somecmd.  Every.  Single.  Time.
>

? i dont get that

i just say its for me painful to have more keep-code-old ppl than -updated-
.. as an end user

sorry , greets , peace

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]