Op 29-11-18 om 15:48 schreef Herbert Xu:
The problem is that in evalsubshell we end up in exitshell again
which restores the old exit status. So we need to come up with
a way to differentiate the exitshell from the original shell vs.
a subshell.
Isn't it much simpler than that? Upon forking a subshell, traps are
reset, so it would make sense that any flag that says "we are currently
in the process of executing a trap" is also reset.
Which, from a look at the source code, seems to be the -1 value of
savestatus. So this oneliner fixes it for me:
diff --git a/src/trap.c b/src/trap.c
index ab0ecd4..7740955 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -168,6 +168,7 @@ clear_traps(void)
}
}
trapcnt = 0;
+ savestatus = -1;
INTON;
}
Thanks,
- M.