bug-bash
[Top][All Lists]
Advanced

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

Re: Bash 5.2 breaks our Arch Linux devtools


From: Koichi Murase
Subject: Re: Bash 5.2 breaks our Arch Linux devtools
Date: Thu, 16 Feb 2023 11:09:50 +0900

2023年2月16日(木) 0:03 Tobias Powalowski via Bug reports for the GNU
Bourne Again SHell <bug-bash@gnu.org>:
> Description:
> latest 5.2.x seems to have introduced a change in shopt extglob:
> https://gitlab.archlinux.org/archlinux/devtools/-/merge_requests/133
> I'm not sure if my proposed fix for this is correct or if this is just a
> bug in bash 5.2.x not checking the function for shopt first before bailing
> out.

Let me first explain the background. As others are pointing out, there
are no changes about `shopt extglob'. The `shopt extglob' setting is
referenced twice, in the parsing phase and in the execution phase. The
`shopt extglob' should be turned on for both phases. So, if you have
an extglob in shell functions, you need to turn on `extglob' outside
the function to make sure that the function is parsed with `extglob'
being turned on.

Then, let us discuss the main issue. The difference between Bash 5.2
and 5.1 that you observe in the reported case is related to the change
of the parsing point of the content of the process substitution  In
Bash 5.1 and below, the content of the process substitution hasn't
been actually parsed until execution, so it was somehow equivalent to

mapfile -t packages < <(eval 'printf "%s\n"
"something/something".pkg.tar?(.!(sig|.*))')

>From Bash 5.2, we started to fully parse the content of the process
substitution in the normal parsing phase to better handle nested (),
{}, etc. and also to detect the syntax problem earlier. This means
that Bash 5.2 became stricter than 5.1, and an existing problem with
the script, which was hidden by the incomplete parsing of process
substitutions, was revealed this time.

> Fix:
>
> Putting shopt options outside the function, but is this the wanted
> behaviour?

Yes, that is the expected usage.



reply via email to

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