← Commit list

a5db1d735

Denys Vlasenko
Denys Vlasenko
2018-07-28
SUCCESS Duration: 146s

Subject

hush: fix another case where empty "for" wasn't setting exitcode to 0

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/ash_test/ash-misc/empty_for1.right+1 -0
@@ -0,0 +1 @@
+Zero:0
shell/ash_test/ash-misc/empty_for1.tests+5 -0
@@ -0,0 +1,5 @@
+false
+for v; do
+ exit 2
+done
+echo Zero:$?
shell/hush.c+1 -1
@@ -9391,11 +9391,11 @@ static int run_list(struct pipe *pi)
}; /* argv list with one element: "$@" */
char **vals;
+ G.last_exitcode = rcode = EXIT_SUCCESS;
vals = (char**)encoded_dollar_at_argv;
if (pi->next->res_word == RES_IN) {
/* if no variable values after "in" we skip "for" */
if (!pi->next->cmds[0].argv) {
- G.last_exitcode = rcode = EXIT_SUCCESS;
debug_printf_exec(": null FOR: exitcode EXIT_SUCCESS\n");
break;
}
shell/hush_test/hush-misc/empty_for1.right+1 -0
@@ -0,0 +1 @@
+Zero:0
shell/hush_test/hush-misc/empty_for1.tests+5 -0
@@ -0,0 +1,5 @@
+false
+for v; do
+ exit 2
+done
+echo Zero:$?