On Mon, 9 Aug 2021, Gyorgy Matyasfalvi wrote:
Bash Version: 5.1 Patch Level: 8 Release Status: releaseDescription: 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)
