* case bugfix
@ 1996-12-28 19:10 Zoltan Hidvegi
1996-12-28 21:11 ` Richard Coleman
0 siblings, 1 reply; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-12-28 19:10 UTC (permalink / raw)
To: Zsh hacking and development
There is quite serious bug in case:
case * in
\*) echo yes;;
esac
This should print yes but you get `zsh: too many arguments to case' if
there are more than one files in the current directory.
Fix is included below. This should be applied to zsh-3.0.2 as well.
Zoltan
*** Src/parse.c 1996/12/21 02:35:32 3.1.1.0
--- Src/parse.c 1996/12/28 18:38:33
***************
*** 481,487 ****
{
int brflag;
LinkList pats, lists;
! int n = 0;
char **pp;
List *ll;
LinkNode no;
--- 481,487 ----
{
int brflag;
LinkList pats, lists;
! int n = 1;
char **pp;
List *ll;
LinkNode no;
***************
*** 492,498 ****
yylex();
if (tok != STRING)
YYERRORV;
! addlinknode(c->args, tokstr);
incmdpos = 1;
yylex();
while (tok == SEPER)
--- 492,499 ----
yylex();
if (tok != STRING)
YYERRORV;
! pats = newlinklist();
! addlinknode(pats, tokstr);
incmdpos = 1;
yylex();
while (tok == SEPER)
***************
*** 504,510 ****
incmdpos = 0;
yylex();
cc = c->u.casecmd = (struct casecmd *)make_casecmd();
- pats = newlinklist();
lists = newlinklist();
for (;;) {
char *str;
--- 505,510 ----
*** Src/exec.c 1996/12/27 01:31:33 3.1.1.2
--- Src/exec.c 1996/12/28 18:39:38
***************
*** 1208,1215 ****
}
/* Do prefork substitutions */
! prefork(args, (((type == CCASE) ? 4 : 0)
! | (assign ? 2 : isset(MAGICEQUALSUBST))));
if (type == SIMPLE) {
int unglobbed = 0;
--- 1208,1214 ----
}
/* Do prefork substitutions */
! prefork(args, assign ? 2 : isset(MAGICEQUALSUBST));
if (type == SIMPLE) {
int unglobbed = 0;
*** Src/loop.c 1996/12/21 02:35:32 3.1.1.0
--- Src/loop.c 1996/12/28 18:41:19
***************
*** 374,397 ****
{
struct casecmd *node;
char *word;
- LinkList args;
List *l;
char **p;
node = cmd->u.casecmd;
- args = cmd->args;
l = node->lists;
p = node->pats;
lastval = 0;
! if (firstnode(args) && nextnode(firstnode(args))) {
! zerr("too many arguments to case", NULL, 0);
! return 1;
! }
! if (empty(args))
! word = dupstring("");
! else
! word = (char *)peekfirst(args);
if (node) {
while (*p) {
--- 374,390 ----
{
struct casecmd *node;
char *word;
List *l;
char **p;
node = cmd->u.casecmd;
l = node->lists;
p = node->pats;
lastval = 0;
! word = *p++;
! singsub(&word);
! untokenize(word);
if (node) {
while (*p) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: case bugfix
1996-12-28 19:10 case bugfix Zoltan Hidvegi
@ 1996-12-28 21:11 ` Richard Coleman
1996-12-29 2:42 ` Zoltan Hidvegi
0 siblings, 1 reply; 3+ messages in thread
From: Richard Coleman @ 1996-12-28 21:11 UTC (permalink / raw)
To: zsh-workers
> There is quite serious bug in case:
>
> case * in
> \*) echo yes;;
> esac
>
> This should print yes but you get `zsh: too many arguments to case' if
> there are more than one files in the current directory.
>
> Fix is included below. This should be applied to zsh-3.0.2 as well.
>
> Zoltan
You probably should release a zsh-3.0.3, since this bug is
fairly fundamental.
rc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: case bugfix
1996-12-28 21:11 ` Richard Coleman
@ 1996-12-29 2:42 ` Zoltan Hidvegi
0 siblings, 0 replies; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-12-29 2:42 UTC (permalink / raw)
To: Richard Coleman; +Cc: zsh-workers
Richard Coleman write:
> > There is quite serious bug in case:
> >
> > case * in
> > \*) echo yes;;
> > esac
[...]
> You probably should release a zsh-3.0.3, since this bug is
> fairly fundamental.
I agree. And the other buffer overflow bug is also quite bad. I'll
probably make zsh-3.0.3 later next year :-).
Zoltan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-12-29 2:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-28 19:10 case bugfix Zoltan Hidvegi
1996-12-28 21:11 ` Richard Coleman
1996-12-29 2:42 ` Zoltan Hidvegi
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).