Le Thu, May 23, 2024 at 08:19:49PM +0300, Oğuz a écrit :
>
> $ bash -c 'for (( $(case x in x) esac);; )); do :; done'
>From there, I've tested:
bash-5.3-alpha$ uname=1
bash-5.3-alpha$ echo $(( uname - $(echo 1) ))
0
bash-5.3-alpha$ echo $(( uname - $(case x in x) echo 1;exit;;esac;echo 0)
On 5/24/24 1:43 AM, Oğuz wrote:
While you're at it take a look at this too:
true; for (( ; $? == 0; ${ ! break;} )); do uname; done
The arithmetic for command should probably check for breaking after it
evaluates the loop test. You have to admit this is not something people
are going to write
On 5/23/24 1:19 PM, Oğuz wrote:
See:
$ bash -c 'for (( $(case x in x) esac);; )); do :; done'
bash: -c: line 1: syntax error: `;' unexpected
bash: -c: line 1: syntax error: `(( $(case x in x)
;;
esac);; ))'
Thanks for the report. This should be a pretty easy fix; just use
extract_command
While you're at it take a look at this too:
true; for (( ; $? == 0; ${ ! break;} )); do uname; done
Once you run this command bash gets stuck in a state where it prints
the prompt string and reads commands but doesn't execute anything. If
you press Ctrl+C it returns to normal.
Oğuz
See:
$ bash -c 'for (( $(case x in x) esac);; )); do :; done'
bash: -c: line 1: syntax error: `;' unexpected
bash: -c: line 1: syntax error: `(( $(case x in x)
;;
esac);; ))'
This is reproducible on 5.3 alpha too.
Oğuz