* bug in select
@ 1996-12-29 3:28 Yamamoto Hirotaka
1996-12-29 23:15 ` Zoltan Hidvegi
0 siblings, 1 reply; 3+ messages in thread
From: Yamamoto Hirotaka @ 1996-12-29 3:28 UTC (permalink / raw)
To: zsh-workers
Hi,
I found a buggy feature in zsh's `select' built-in command.
here's the log.
verdy% select i in aaa bbb ccc
do echo $i
done
1) aaa 2) bbb 3) ccc
?# 1
0
1) aaa 2) bbb 3) ccc
?# 2
0
1) aaa 2) bbb 3) ccc
?# 3
0
1) aaa 2) bbb 3) ccc
?# 0
0
1) aaa 2) bbb 3) ccc
?# aaa
0
1) aaa 2) bbb 3) ccc
with zsh version 3.1.0, Linux-2.0.27 (Slakware-3.1)
ps) I cannot understand the usage of `&|' and `&!'.
could someone help me?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug in select
1996-12-29 3:28 bug in select Yamamoto Hirotaka
@ 1996-12-29 23:15 ` Zoltan Hidvegi
0 siblings, 0 replies; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-12-29 23:15 UTC (permalink / raw)
To: ymmt; +Cc: zsh-workers
> Hi,
>
> I found a buggy feature in zsh's `select' built-in command.
> here's the log.
>
> verdy% select i in aaa bbb ccc
> do echo $i
> done
> 1) aaa 2) bbb 3) ccc
> ?# 1
> 0
I bet that i is integer here. Look:
hzoli% select i in aaa bbb ccc
do echo $i
done
1) aaa 2) bbb 3) ccc
?# 1
aaa
1) aaa 2) bbb 3) ccc
?#
hzoli% integer i
hzoli% select i in aaa bbb ccc
do echo $i
done
1) aaa 2) bbb 3) ccc
?# 1
0
1) aaa 2) bbb 3) ccc
?#
Ksh behaves exactly the same way. This is not a bug. Add unset i before
select and it'll work. Note that i becomes integer if it is initialised
first in an arithmetic expression, like let i=0 or $((i=0)).
Zoltan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Bug in select
@ 1998-07-01 18:21 Bernd Eggink
0 siblings, 0 replies; 3+ messages in thread
From: Bernd Eggink @ 1998-07-01 18:21 UTC (permalink / raw)
To: Zsh-workers
Zsh-3.1.4 has a bug in 'select': An empty user input is not treated
correctly, due to a misconstructed do-loop (in do ... while(0) break and
continue have the same effect).
Here is a patch:
--- loop.c.old Wed Jul 1 19:19:26 1998
+++ loop.c Wed Jul 1 19:28:28 1998
@@ -156,7 +156,7 @@
inp = fdopen(dup((SHTTY == -1) ? 0 : SHTTY), "r");
selectlist(args);
for (;;) {
- do {
+ for (;;) {
if (empty(bufstack)) {
if (interact && SHTTY != -1 && isset(USEZLE))
str = (char *)zleread(prompt3, NULL, 0);
@@ -178,11 +178,10 @@
}
if ((s = strchr(str, '\n')))
*s = '\0';
- if(!*str) {
+ if(*str)
+ break;
selectlist(args);
- continue;
- }
- } while(0);
+ };
setsparam("REPLY", ztrdup(str));
i = atoi(str);
if (!i)
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-07-01 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-29 3:28 bug in select Yamamoto Hirotaka
1996-12-29 23:15 ` Zoltan Hidvegi
1998-07-01 18:21 Bug " Bernd Eggink
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).