bug-bash
[Top][All Lists]
Advanced

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

Re: Extended regex match (shmatch.c:115) malloc error


From: Chris F.A. Johnson
Subject: Re: Extended regex match (shmatch.c:115) malloc error
Date: Mon, 9 Aug 2021 16:33:33 -0400 (EDT)
User-agent: Alpine 2.22 (DEB 394 2020-01-19)

On Mon, 9 Aug 2021, Gyorgy Matyasfalvi wrote:

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

Description:
       When a regex matches inside [[ ]] it results in a malloc error.
       Whereas if it doesn't you get expected behavior.

       Take the code below:
----------------------------------------------------------------------------------
       #!/usr/bin/env bash

       text="123 text!"
       if [[ "$text" =~ "123" ]]; then
               printf "'123' in '$text'\n"
       else
               printf "'123' not in '$text'\n"
       fi
----------------------------------------------------------------------------------
       You will receive:
----------------------------------------------------------------------------------
       malloc: shmatch.c:115: assertion botched
       free: start and end chunk sizes differ
       Aborting...ABORT instruction (core dumped)
----------------------------------------------------------------------------------

I get:

'123' in '123 text!'

(bash 5.1 in mate-terminal)

--
   Chris F.A. Johnson                         <http://cfajohnson.com/>
   =========================== Author: ===============================
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
   Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)



reply via email to

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