bug-bash
[Top][All Lists]
Advanced

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

(( arr[${var@Q}] )) makes the shell crash in bash-5.2


From: Emanuele Torre
Subject: (( arr[${var@Q}] )) makes the shell crash in bash-5.2
Date: Fri, 30 Sep 2022 12:32:30 +0200

In bash-5.2, using the ${parameter@Q} parameter expansion with an unset
parameter, in an array subscript, in an arithmetic context, causes a
segmentation fault.

    bash-5.1$ ./bash --norc

    bash-5.2$ (x[y[${a@Q}]]=)
    Segmentation fault (core dumped)
    bash-5.2$ ( (( y[${a@Q}] )) )
    Segmentation fault (core dumped)

    bash-5.2$ a=
    bash-5.2$ (x[y[${a@Q}]]=)
    bash: \'\': syntax error: operand expected (error token is "\'\'")
    bash-5.2$ ( (( y[${a@Q}] )) )
    bash: \'\': syntax error: operand expected (error token is "\'\'")



reply via email to

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