search for: exitcmd

Displaying 6 results from an estimated 6 matches for "exitcmd".

Did you mean: editcmd
2020 Mar 28
0
[klibc:update-dash] dash: main: Only set savestatus in exitcmd
...ommit;h=bb0a62dfa61fec6497f1409c3cdfe8ceec94f1fa Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:38 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: main: Only set savestatus in exitcmd [ dash commit d17dacd0f0499a8c77d810e211e8ff96b8898c48 ] Currently exitcmd sets exitstatus and then savestatus if the latter was previously set. In fact, as exitcmd always raises an exception and will either end up in the setjmp call in main() or exitshell(), where exitstatus is always replaced...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Reset handler when entering a subshell
...+ if (unlikely(setjmp(main_handler.loc))) { int e; int s; @@ -137,7 +137,7 @@ main(int argc, char **argv) else goto state4; } - handler = &jmploc; + handler = &main_handler; #ifdef DEBUG opentrace(); trputs("Shell args: "); trargs(argv); @@ -353,3 +353,8 @@ exitcmd(int argc, char **argv) exraise(EXEXIT); /* NOTREACHED */ } + +void reset_handler(void) +{ + handler = &main_handler; +} diff --git a/usr/dash/main.h b/usr/dash/main.h index 19e49835..51f1604c 100644 --- a/usr/dash/main.h +++ b/usr/dash/main.h @@ -52,3 +52,4 @@ extern int *dash_errno; void...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Only restore exit status on exit/return
...lt;ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: eval: Only restore exit status on exit/return [ dash commit 62cf6955f8abe875752d7163f6f3adbc7e49ebae ] We unconditionally restore the saved status in exitreset, which is incorrect as we only want to do it for exitcmd and returncmd. This patch fixes the problem by introducing EXEND. Reported-by: Martijn Dekker <martijn at inlv.org> Fixes: da30b4b78769 ("[BUILTIN] Exit without arguments in a trap...") Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings &l...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Mark more regular built-ins
...ben at decadent.org.uk> --- usr/dash/builtins.def.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/dash/builtins.def.in b/usr/dash/builtins.def.in index e1169632..e65749fd 100644 --- a/usr/dash/builtins.def.in +++ b/usr/dash/builtins.def.in @@ -69,25 +69,25 @@ exitcmd -s exit exportcmd -as export -as readonly falsecmd -u false getoptscmd -u getopts -hashcmd hash +hashcmd -u hash jobscmd -u jobs localcmd -as local printfcmd printf -pwdcmd pwd +pwdcmd -u pwd readcmd -u read returncmd -s return setcmd -s set shiftcmd -s shift trapcmd -s trap tr...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Exit without arguments in a trap should use status outside traps
...status of backquoted command */ +extern int savestatus; /* exit status of last command outside traps */ struct backcmd { /* result of evalbackcmd */ diff --git a/usr/dash/main.c b/usr/dash/main.c index f79ad7dd..29a258d3 100644 --- a/usr/dash/main.c +++ b/usr/dash/main.c @@ -339,8 +339,15 @@ exitcmd(int argc, char **argv) { if (stoppedjobs()) return 0; - if (argc > 1) - exitstatus = number(argv[1]); + + if (argc > 1) { + int status = number(argv[1]); + + exitstatus = status; + if (savestatus >= 0) + savestatus = status; + } + exraise(EXEXIT); /* NOTREACHED */ } diff -...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Exit without arguments in a trap should use status outside traps
...status of backquoted command */ +extern int savestatus; /* exit status of last command outside traps */ struct backcmd { /* result of evalbackcmd */ diff --git a/usr/dash/main.c b/usr/dash/main.c index f79ad7dd..29a258d3 100644 --- a/usr/dash/main.c +++ b/usr/dash/main.c @@ -339,8 +339,15 @@ exitcmd(int argc, char **argv) { if (stoppedjobs()) return 0; - if (argc > 1) - exitstatus = number(argv[1]); + + if (argc > 1) { + int status = number(argv[1]); + + exitstatus = status; + if (savestatus >= 0) + savestatus = status; + } + exraise(EXEXIT); /* NOTREACHED */ } diff -...