URL:
  <https://savannah.gnu.org/bugs/?68886>

                 Summary: Incorrect parsing of nested quoted parameter
expansions
                   Group: The GNU Bourne-Again SHell
               Submitter: None
               Submitted: Fri 06 Nov 2026 05:37:33 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Unlocked


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 06 Nov 2026 05:37:33 AM UTC By: Anonymous
Quotes inside the alternate-value portion of Bash parameter expansions are
incorrectly parsed when they contain quoted variable expansions, and the
expansions themselves are also quoted.

When a quoted variable expansion appears inside the alternate-value word of a
quoted parameter expansion, Bash incorrectly handles the inner closing double
quote.

Example: "${a-foo"$var"bar}"
is incorrectly interpreted as: "${a-foo"$varbar"}"
instead of "${a-foo${var}bar}"

Affected are (at least) the following operators for using or assigning default
values and using alternate values:
${var:-alt}
${var-alt}
${var:=alt}
${var=alt}
${var:+alt}
${var+alt}

Reproduce with:
unset a
var=VALUE
varbar=PROBLEM
echo "${a-foo"$var"bar}"
# Expected: fooVALUEbar
# Actual: fooPROBLEM

Note:
- All versions of bash since 2.0 are impacted
- Unquoted expansions don't exhibit the problematic behavior







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68886>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to