bug-bash
[Top][All Lists]
Advanced

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

Inner Command Groups fail in Bash 5.2


From: Dima Korobskiy
Subject: Inner Command Groups fail in Bash 5.2
Date: Thu, 31 Aug 2023 13:21:31 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin20.6.0
Compiler: clang
Compilation CFLAGS: -DSSH_SOURCE_BASHRC
uname output: Darwin San-Francisco-iMac.local 20.6.0 Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47 PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_$
Machine Type: x86_64-apple-darwin20.6.0

Bash Version: 5.2
Patch Level: 15
Release Status: release

Description:
        One of my Bash scripts started to fail all of a sudden and I was able to narrow down this problem to Bash upgrade itself (via Homebrew on a Mac): from 5.1.16 to 5.2.15. It looks to me pretty serious: a lot of scripts might be potentially affected.

Repeat-By:

# Bash 5.1.16: success
# Bash 5.2.15: syntax error near unexpected token `}'
var2=$(time { echo foo; echo bar; })
echo -e "\nvar2=\`$var2\`"

# Bash 5.1.16: success
# Bash 5.2.15: syntax error near unexpected token `echo'
var3=$(time (echo foo; echo bar))
echo -e "\nvar3=\`$var3\`"

Fix:
       The scripts have to change to work around this problem: to refactor out an inner command group. It might or might not be feasible. For example, the fix for the script above:

time var4=$(echo foo; echo bar)
echo -e "\nvar4=\`$var4\`"

--
🇺🇸 Dima Korobskiy 🇺🇦




reply via email to

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