[BusyBox-cvs] busybox/shell hush.c,1.67,1.68
Erik Andersen
andersen at busybox.net
Mon Apr 12 21:41:32 UTC 2004
Update of /var/cvs/busybox/shell
In directory nail:/tmp/cvs-serv19701/shell
Modified Files:
hush.c
Log Message:
Wolfgang Denk writes:
He,
there is a bug in HUSH's handling of "if" / "elif" commands:
$ if true
> then
> echo 1
> elif
> true
> then
> echo 2
> elif
> true
> then
> echo 3
> else
> echo 4
> fi
1
2
3
$
The same bug exists in all versions of HUSH from BB v0.60.x up to and
including v1.00-pre9. The attached patch fixes this:
$ if true
> then
> echo 1
> elif
> true
> then
> echo 2
> elif
> true
> then
> echo 3
> else
> echo 4
> fi
1
$
Best regards,
Wolfgang Denk
Index: hush.c
===================================================================
RCS file: /var/cvs/busybox/shell/hush.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- a/hush.c 12 Apr 2004 17:59:24 -0000 1.67
+++ b/hush.c 12 Apr 2004 21:41:29 -0000 1.68
@@ -1557,7 +1557,7 @@
if (rmode == RES_THEN || rmode == RES_ELSE) if_code = next_if_code;
if (rmode == RES_THEN && if_code) continue;
if (rmode == RES_ELSE && !if_code) continue;
- if (rmode == RES_ELIF && !if_code) continue;
+ if (rmode == RES_ELIF && !if_code) break;
if (rmode == RES_FOR && pi->num_progs) {
if (!list) {
/* if no variable values after "in" we skip "for" */
More information about the busybox-cvs
mailing list