bug-bash
[Top][All Lists]
Advanced

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

Bash Bug - Incorrect Printing of Escaped Characters


From: Seth Sabar
Subject: Bash Bug - Incorrect Printing of Escaped Characters
Date: Mon, 25 Dec 2023 17:00:37 -0500

Hi all,

I'm reaching out to report what I believe to be a bug with the
*--pretty-print* feature in bash-5.2. From what I can tell, Bash uses the
utf-8 character */001* as an escape character. However, when using the
pretty-print feature in Bash, this doesn't seem to be considered. So, for
example, in a bash script with character */001* the AST representation
will contain */001/001*, however, when it's printed via the pretty print
feature, this isn't un-escaped.

Steps to reproduce:

Download the following version of bash (this is the latest version of
bash-5.2 as of sending this email):
https://git.savannah.gnu.org/cgit/bash.git/commit/?id=4b0f8ba28449c60d6b3436d0c98b14e016b232c2

After extracting the tar file run the *configure* script and *make clean
all* as usual to prepare the bash executable.

Copy the attached *test.sh* into the bash directory.

Run the following command: ./bash --pretty-print test.sh > test2.sh
Then run: ./bash --pretty-print test2.sh > test3.sh

Observe the exponential growth of the escape character */001* in the bash
files.

I believe the following files in the *tests* directory in the bash source
directory may also be used to reproduce this issue:

case2.sub,
nquote3.sub,
dollar-star6.sub,
nquote5.sub,
exp6.sub,
exp7.sub,
quote4.sub,
cond-regexp1.sub,
iquote1.sub,
exp1.sub,
rhs-exp1.sub,
cond-regexp3.sub,
glob8.sub,
posixexp6.sub,
new-exp6.sub,
dollar-at-star10.sub,
dollar-at-star4.sub

Additional Information:

My computer: 2020 13-inch Macbook Pro on MacOS 14.1.2

However, I should note that I was able to reproduce this issue on Linux.

Thanks all and Merry Christmas,
Seth

Attachment: test.sh
Description: Text Data


reply via email to

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