mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-18 21:14:11 +01:00
17673: Fix bug with &&s and ||s in complex constructs
This commit is contained in:
parent
49bfbc1248
commit
41b50445ea
@ -1,3 +1,10 @@
|
||||
2002-09-17 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 17673: Src/exec.c, Test/A01grammar.ztst:
|
||||
for X in Y; true || B; done && X
|
||||
executed X on every iteration. Same bug with true -> false,
|
||||
|| -> &&, && -> ||.
|
||||
|
||||
2002-09-16 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 17678: Src/builtin.c: ignore initial `--' argument to printf
|
||||
|
18
Src/exec.c
18
Src/exec.c
@ -851,8 +851,15 @@ execlist(Estate state, int dont_change_job, int exiting)
|
||||
* for this sublist. */
|
||||
donetrap = 1;
|
||||
goto sublist_done;
|
||||
} else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END)
|
||||
} else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END) {
|
||||
donetrap = 1;
|
||||
/*
|
||||
* Treat this in the same way as if we reached
|
||||
* the end of the sublist normally.
|
||||
*/
|
||||
state->pc = next;
|
||||
goto sublist_done;
|
||||
}
|
||||
}
|
||||
cmdpush(CS_CMDAND);
|
||||
break;
|
||||
@ -877,8 +884,15 @@ execlist(Estate state, int dont_change_job, int exiting)
|
||||
* for this sublist. */
|
||||
donetrap = 1;
|
||||
goto sublist_done;
|
||||
} else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END)
|
||||
} else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END) {
|
||||
donetrap = 1;
|
||||
/*
|
||||
* Treat this in the same way as if we reached
|
||||
* the end of the sublist normally.
|
||||
*/
|
||||
state->pc = next;
|
||||
goto sublist_done;
|
||||
}
|
||||
}
|
||||
cmdpush(CS_CMDOR);
|
||||
break;
|
||||
|
@ -319,3 +319,21 @@
|
||||
done < /dev/null | { read name; print done }
|
||||
0:Bug regression: `while' loop with redirection and pipeline
|
||||
>done
|
||||
|
||||
# This used to be buggy and print X at the end of each iteration.
|
||||
for f in 1 2 3 4; do
|
||||
print $f || break
|
||||
done && print X
|
||||
0:Handling of ||'s and &&'s with a for loop in between
|
||||
>1
|
||||
>2
|
||||
>3
|
||||
>4
|
||||
>X
|
||||
|
||||
# Same bug for &&, used to print `no' at the end of each iteration
|
||||
for f in 1 2 3 4; do
|
||||
false && print strange
|
||||
done || print no
|
||||
0:Handling of &&'s and ||'s with a for loop in between
|
||||
>no
|
||||
|
Loading…
Reference in New Issue
Block a user