Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: subtle `echo' bug



On Tue, Jun 14, 2005 at 10:12:23PM +0400, Andrey Borzenkov wrote:
> This happens randomly:
> 
> {pts/3}% seq 1 3 |while read n; do { echo |echo } |echo $n; done
> 1
> 2
> 3
> {pts/3}% seq 1 3 |while read n; do { echo |echo } |echo $n; done
> 1
> {pts/3}% seq 1 3 |while read n; do { echo |echo } |echo $n; done
> 1
> {pts/3}% seq 1 3 |while read n; do { echo |echo } |echo $n; done
> 1
> 2
> 3
> {pts/3}% echo $ZSH_VERSION
> 4.2.5

I can't reproduce this, I always get "1".  And here is even more subtle
bug: I cannot go into infinite loop in order to prove that I always get "1".

$ while :; do seq 1 3 |while read n; do { echo |echo } |echo $n; done ; done
1
$ while :; do seq 1 3 |while read n; do { echo |echo } |echo $n; done ; done
1
$ while :; do seq 1 3 |while read n; do { echo |echo } |echo $n; done ; done
1
$ while :; do seq 1 3 |while read n; do { echo |echo } |echo $n; done ; done
1
$ while :; do seq 1 3 |while read n; do { echo |echo } |echo $n; done ; done
1
$

But:

$ while :; do seq 1 3 |while read n; do { echo |echo } |/bin/echo $n; done ; done
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
...
^C
$

Attachment: pgprV3rqb5BhF.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author