← Commit list

918a34b9e

Denis Vlasenko
Denis Vlasenko
2008-07-28
FAILED Duration: 20s

Subject

hush: fix "while false; ..." exitcode; add testsuites

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/hush.c+3 -1
@@ -2305,8 +2305,10 @@ static int run_list(struct pipe *pi)
#endif
#if ENABLE_HUSH_LOOPS
if (rword == RES_WHILE) {
- if (rcode)
+ if (rcode) {
+ rcode = 0; /* "while false; do...done" - exitcode 0 */
goto check_jobs_and_break;
+ }
}
if (rword == RES_UNTIL) {
if (!rcode) {
shell/hush_test/hush-misc/break4.right+6 -0
@@ -0,0 +1,6 @@
+A
+AA
+TRUE
+A
+AA
+OK:0
shell/hush_test/hush-misc/break4.tests+12 -0
@@ -0,0 +1,12 @@
+cond=true
+while $cond; do
+ echo A
+ if test "$cond" = true; then
+ cond='echo TRUE'
+ else
+ cond=false
+ fi
+ while true; do echo AA; continue 2; echo BB; done
+ echo B
+done
+echo OK:$?
shell/hush_test/hush-misc/while1.right+1 -0
@@ -0,0 +1 @@
+OK:0
shell/hush_test/hush-misc/while1.tests+2 -0
@@ -0,0 +1,2 @@
+while false; do echo NOT SHOWN; done
+echo OK:$?