On Sun, May 24, 2026 at 11:31:51AM +0200, Emanuele Torre wrote:
> The current order of these cases does not seem logical to me; it is
> probably incorrect: I would expect the PF_ASSIGNRHS case not to care
> about whether the expansion is quoted, and thus also to take precedence
> over the case for double quoted expansions outside of assignments.
>
> Unless I am missing something, reordering those two cases seems to fix
> the regression; so, the fix probably looks similar to something like
> this:
I will point out that this patch also changes the behaviour of [@]@k
in assignments, and maybe also that of some other @OP expansions, to
one which I would think is more correct:
bash-5.3.9
$ IFS=+ a=(a b) b=${a[*]@k}; declare -p b
declare -- b="0+a+1+b"
$ IFS=+ a=(a b) b=${a[@]@k}; declare -p b
declare -- b="0+a+1+b"
$ IFS= a=(a b) b=${a[*]@k}; declare -p b
declare -- b="0a1b"
$ IFS= a=(a b) b=${a[@]@k}; declare -p b
declare -- b="0 a 1 b"
devel (2d4ba0c618584d3554165b9484d921ec8c4e4523) with the patch applied
$ IFS=+ a=(a b) b=${a[*]@k}; declare -p b
declare -- b="0+a+1+b"
$ IFS=+ a=(a b) b=${a[@]@k}; declare -p b
declare -- b="0 a 1 b"
$ IFS= a=(a b) b=${a[*]@k}; declare -p b
declare -- b="0a1b"
$ IFS= a=(a b) b=${a[@]@k}; declare -p b
declare -- b="0 a 1 b"
That is, [@] → " " and [*] → IFS as opposed to the current IFS for
both unless IFS='', in which case [@] → " ", [*] → "".
o/
emanuele6