mainThe GNU Bourne-Again SHell - Support: sr #110888, Pattern replacement substitution...

 
 

sr #110888: Pattern replacement substitution causes segfault

Submitter:  None
Submitted:  Sun 18 Jun 2023 09:11:32 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Postponed
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 19 Jun 2023 05:04:23 PM UTC, comment #2: 

I see. It's a shame there's no solution, but thanks for this link. It explains some of the differences in performance I see between extglobs and regexes.

Anonymous
Mon 19 Jun 2023 04:22:12 PM UTC, comment #1: 

You've exceeded your stack size limit with the recursion needed to implement the +(pat) operator.

There was a discussion about this last year:

https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00048.html

There's no good solution.

Chet Ramey <chet>
Group administrator
Sun 18 Jun 2023 09:11:32 AM UTC, original submission:  

Pattern substitutions with long matches (~80KiB) cause bash to crash with SIGSEGV. Here's an example that crashes on bash 5.2.15.


#!/usr/bin/env bash
shopt -s extglob

text=$(python3 -c 'print("a" * 1024 * 80)')
pattern=$'+([[:alpha:]])'
sub=${text//$pattern/}  # Segmentation fault
echo "${#sub}"


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-06-19 chet StatusNone Postponed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code