too eager expansion in substitution
Bug #1798397 reported by
Thorsten Glaser
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mksh |
Invalid
|
Medium
|
Unassigned |
Bug Description
“If word is not needed, it shall not be expanded.” (POSIX)
00:52 < izabera> i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : ${var#${q[i=777]}}; echo $i
00:52 < izabera> prints 42 777 in bash and ksh93
00:52 < izabera> and 777 777 in mkmsh
The #/##/%/%% of course need to expand word first.
Thanks to jilles for the heads-up.
To post a comment you must log in.
Found to be not a bug:
$ i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : ${var#${q[i=777]}}; echo $i
must return 777 twice, because the pattern must always be expanded before looking at $var.
$ i=42; : ${var+${q[i=777]}}; echo $i; var=meow; : ${var+${q[i=777]}}; echo $i
already behaves correctly (42 then 777).