Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interp: heredocs get consumed by the first command process executed #1085

Closed
fungaren opened this issue Jul 24, 2024 · 1 comment
Closed

Comments

@fungaren
Copy link

fungaren commented Jul 24, 2024

POC:

while read -r FOO BAR; do
  echo $FOO $BAR >/dev/stderr
  cat /not_exist_file
done <<EOF
  AAA BBB
  CCC DDD
EOF
fang@debian:~$ gosh test.sh 
AAA BBB
cat: /not_exist_file: No such file or directory
fang@debian:~$ bash test.sh 
AAA BBB
cat: /not_exist_file: No such file or directory
CCC DDD
cat: /not_exist_file: No such file or directory
@fungaren fungaren changed the title [BUG] misbehavior when process while read -r; do [BUG] misbehave while read -r; do Jul 24, 2024
@mvdan mvdan changed the title [BUG] misbehave while read -r; do interp: heredocs get consumed by the first command process executed Aug 8, 2024
@mvdan
Copy link
Owner

mvdan commented Aug 8, 2024

Thanks for reporting; this is a pretty severe bug actually, and I'm surprised it had not been spotted yet.

@mvdan mvdan closed this as completed in 980b6fc Aug 8, 2024
This was referenced Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants