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

List:       bash-bug
Subject:    Re: [PATCH] Fix leaked internal escapes of patsub_replacement ${var/$pat/"&"} with pat=# or pat=%
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2022-07-18 20:46:47
Message-ID: 106f471d-002a-0f61-205e-96e03cf87146 () case ! edu
[Download RAW message or body]

On 7/18/22 2:11 AM, Koichi Murase wrote:
> Here is another patch that was pending.
> 
> Bash Version: 5.2
> Commit 87a6e89edc7cb1af057e2c15666df189595d305b (the current devel)
> 
> Description:
> 
>    When `shopt -s patsub_replacement' is turned on and the pattern
>    string `pat' of ${var/$pat/"&"} is just an anchoring character `#'
>    or `%', the internal escape of `&' (i.e., `\&') remains in the
>    result of the parameter expansion.  Also, with the same condition,
>    the unquoted & in ${var/$pat/&} remains a literal & where we expect
>    it to be expanded to an empty string.

Thanks for the patch. I think this is reasonable; it duplicates what `sed'
does when presented with a BRE like '^' or '$', or when it gets a null
input line. I'll put this in for 5.2-rc2.

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/

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

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