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: Chet Ramey
Subject: Re: Bash 5.2 breaks our Arch Linux devtools
Date: Thu, 16 Feb 2023 11:25:27 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 2/15/23 8:29 AM, Tobias Powalowski via Bug reports for the GNU Bourne Again SHell wrote:

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
Hi,
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.

The `extglob' option changes the behavior of the shell parser, since
extended glob patterns would otherwise be syntax errors.

The shell function is parsed in its entirety before being stored --
otherwise how would you know where it ends -- and none of the commands
in it are executed until the shell function is executed.

The process substitution is parsed at the same time as the function
definition, because you have to parse it to know where the closing right
paren is. Bash-5.2 is more rigorous about this -- it actually calls the
parser to do it instead of relying on the ad-hoc code in bash-5.1 and
earlier versions.

If you put these together, you can see what's happening: the shell function
is parsed without `extglob' being enabled because the `shopt' command to
enable it is part of the function body. If you want to parse a function
that includes extended glob patterns, extglob needs to be enabled before
you do that.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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