search for: evalcommand

Displaying 20 results from an estimated 20 matches for "evalcommand".

2019 Jan 25
0
[klibc:update-dash] eval: Restore input files in evalcommand
...it;a=commit;h=2b231302b19d9213263d001b0c467e28ecc033f3 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Tue, 27 Mar 2018 00:39:35 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] eval: Restore input files in evalcommand When evalcommand invokes a command that modifies parsefile and then bails out without popping the file, we need to ensure the input file is restored so that the shell can continue to execute. Reported-by: Martijn Dekker <martijn at inlv.org> Signed-off-by: Herbert Xu <herbert at gondor.a...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Restore input files in evalcommand
...ommit;h=2f401db12f9ab163250c0feffd5c8fe3b0d9cf38 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Tue, 27 Mar 2018 00:39:35 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: eval: Restore input files in evalcommand [ dash commit 46d5a7fcea81b489819f753451c1ad2fe435f148 ] When evalcommand invokes a command that modifies parsefile and then bails out without popping the file, we need to ensure the input file is restored so that the shell can continue to execute. Reported-by: Martijn Dekker <martijn at inlv...
2019 Jan 25
0
[klibc:update-dash] [EVAL] Do not clobber exitstatus in evalcommand
...ommit;h=1fc5f5a5a8704d47b71b01cc0ab734a4d2976d37 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Fri, 3 Oct 2014 14:07:07 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] [EVAL] Do not clobber exitstatus in evalcommand All originators of EXERROR have been setting the exitstatus for a while now. So it is no longer appropriate to set it explicitly in evalcommand. In fact doing so may cause the original exitstatus to be lost. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hut...
2020 Mar 28
0
[klibc:update-dash] dash: [EVAL] Do not clobber exitstatus in evalcommand
...h=e49a1160b58933c257c27603aa3d020daf8e0943 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Fri, 3 Oct 2014 14:07:07 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [EVAL] Do not clobber exitstatus in evalcommand [ dash commit 0d1fb088a4a16569260de4266d4bd359491c6bcd ] All originators of EXERROR have been setting the exitstatus for a while now. So it is no longer appropriate to set it explicitly in evalcommand. In fact doing so may cause the original exitstatus to be lost. Signed-off-by: Herbert Xu &lt...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Replace with listsetvar with mklocal/setvareq
...+++++++++------------- usr/dash/var.c | 32 +++++--------------------------- usr/dash/var.h | 3 +-- 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index fc5a594a..77a8bded 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -737,6 +737,8 @@ evalcommand(union node *cmd, int flags) int execcmd; int status; char **nargv; + int vflags; + int vlocal; errlinno = lineno = cmd->ncmd.linno; if (funcline) @@ -745,7 +747,6 @@ evalcommand(union node *cmd, int flags) /* First expand the arguments. */ TRACE(("evalcommand(0x%lx, %d) call...
2019 Jan 25
0
[klibc:update-dash] eval: Return status in eval functions
...lloop(union node *, int); +STATIC int evalfor(union node *, int); +STATIC int evalcase(union node *, int); +STATIC int evalsubshell(union node *, int); STATIC void expredir(union node *); -STATIC void evalpipe(union node *, int); +STATIC int evalpipe(union node *, int); #ifdef notyet -STATIC void evalcommand(union node *, int, struct backcmd *); +STATIC int evalcommand(union node *, int, struct backcmd *); #else -STATIC void evalcommand(union node *, int); +STATIC int evalcommand(union node *, int); #endif STATIC int evalbltin(const struct builtincmd *, int, char **, int); STATIC int evalfun(struct...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Return status in eval functions
...lloop(union node *, int); +STATIC int evalfor(union node *, int); +STATIC int evalcase(union node *, int); +STATIC int evalsubshell(union node *, int); STATIC void expredir(union node *); -STATIC void evalpipe(union node *, int); +STATIC int evalpipe(union node *, int); #ifdef notyet -STATIC void evalcommand(union node *, int, struct backcmd *); +STATIC int evalcommand(union node *, int, struct backcmd *); #else -STATIC void evalcommand(union node *, int); +STATIC int evalcommand(union node *, int); #endif STATIC int evalbltin(const struct builtincmd *, int, char **, int); STATIC int evalfun(struct...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...p)) return 0; + sp = sp->next; break; } do { @@ -677,10 +698,10 @@ parse_command_args(char **argv, const char **path) } } while ((c = *cp++)); } - return argv; -} - + arglist->list = sp; + return DO_NOFUNC; +} /* * Execute a simple command. @@ -702,6 +723,7 @@ evalcommand(union node *cmd, int flags) struct arglist varlist; char **argv; int argc; + struct strlist *osp; struct strlist *sp; #ifdef notyet int pip[2]; @@ -711,6 +733,7 @@ evalcommand(union node *cmd, int flags) char *lastarg; const char *path; int spclbltin; + int cmd_flag; int execcmd;...
2020 Mar 28
0
[klibc:update-dash] dash: eval: avoid leaking memory associated with redirections
...rglist.list; expandarg(n->ncase.expr, &arglist, EXP_TILDE); for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) { @@ -459,8 +460,6 @@ evalcase(union node *n, int flags) } } out: - popstackmark(&smark); - return status; } @@ -717,7 +716,6 @@ evalcommand(union node *cmd, int flags) struct localvar_list *localvar_stop; struct parsefile *file_stop; struct redirtab *redir_stop; - struct stackmark smark; union node *argp; struct arglist arglist; struct arglist varlist; @@ -746,7 +744,6 @@ evalcommand(union node *cmd, int flags) /* First...
2019 Jan 25
0
[klibc:update-dash] [ERROR] Set exitstatus in onint
...Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Thu, 2 Oct 2014 21:07:55 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] [ERROR] Set exitstatus in onint Currently the exit status when we receive SIGINT is set in evalcommand which means that it doesn't always get set. For example, if you press CTRL-C at the prompt of an interactive dash, the exit status is not set to 130 as it is in many other Bourne shells. This patch fixes this by moving the setting of the exit status into onint which also simplifies evalcomman...
2020 Mar 28
0
[klibc:update-dash] dash: [ERROR] Set exitstatus in onint
...e: Thu, 2 Oct 2014 21:07:55 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [ERROR] Set exitstatus in onint [ dash commit b4ce4120f87d89476b2d6ab31df43900d2f5ce89 ] Currently the exit status when we receive SIGINT is set in evalcommand which means that it doesn't always get set. For example, if you press CTRL-C at the prompt of an interactive dash, the exit status is not set to 130 as it is in many other Bourne shells. This patch fixes this by moving the setting of the exit status into onint which also simplifies evalcomman...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Fail immediately with redirections errors for simple command
...utchings <ben at decadent.org.uk> --- usr/dash/eval.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 9e88fef2..fc5a594a 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -818,6 +818,17 @@ evalcommand(union node *cmd, int flags) redir_stop = pushredir(cmd->ncmd.redirect); status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH|REDIR_SAVEFD2); + if (status) { +bail: + exitstatus = status; + + /* We have a redirection error. */ + if (spclbltin > 0) + exraise(EXERROR); + + goto ou...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Always set localvar_stop
...uk> --- usr/dash/eval.c | 9 +++------ usr/dash/var.c | 12 +++++++++--- usr/dash/var.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 7bb636e1..6652ccc0 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -809,6 +809,8 @@ evalcommand(union node *cmd, int flags) vflags = VEXPORT; } + localvar_stop = pushlocalvars(vlocal); + /* Reserve one extra spot at the front for shellexec. */ nargv = stalloc(sizeof (char *) * (argc + 2)); argv = ++nargv; @@ -828,7 +830,6 @@ evalcommand(union node *cmd, int flags) status = red...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix old-style command substitution here-document crash
.... > #0 0x5768ec in openhere /home/jfe/dash/src/redir.c:305:29 > #1 0x574d92 in openredirect /home/jfe/dash/src/redir.c:230:7 > #2 0x5737fe in redirect /home/jfe/dash/src/redir.c:121:11 > #3 0x576017 in redirectsafe /home/jfe/dash/src/redir.c:424:3 > #4 0x522326 in evalcommand /home/jfe/dash/src/eval.c:828:11 > #5 0x520010 in evaltree /home/jfe/dash/src/eval.c:288:12 > #6 0x5270da in evaltreenr /home/jfe/dash/src/eval.c:332:2 > #7 0x526f04 in evalbackcmd /home/jfe/dash/src/eval.c:640:3 > #8 0x539020 in expbackq /home/jfe/dash/src/expand.c:522:...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Reset handler when entering a subshell
...CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: eval: Reset handler when entering a subshell [ dash commit 02a00569ba60e502f876c36d894ba0cc2d0682b3 ] As it is a subshell can execute code that is only meant for the parent shell when it executes a longjmp that is caught by something like evalcommand. This patch fixes it by resetting the handler when entering a subshell. Reported-by: Martijn Dekker <martijn at inlv.org> Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/eval.c | 4 ++++ usr/dash/ma...
2012 Jul 02
0
[klibc:master] [EVAL] Remove unused EV_BACKCMD flag
...osed only to affect subshells. eg. echo "`cd /`" - */ - if (n->type == NCMD) { - struct ifsregion saveifs; - struct ifsregion *savelastp; - struct nodelist *saveargbackq; - - saveifs = ifsfirst; - savelastp = ifslastp; - saveargbackq = argbackq; - - exitstatus = oexitstatus; - evalcommand(n, EV_BACKCMD, result); - - ifsfirst = saveifs; - ifslastp = savelastp; - argbackq = saveargbackq; - } else -#endif - { - int pip[2]; - struct job *jp; - - if (pipe(pip) < 0) - sh_error("Pipe call failed"); - jp = makejob(n, 1); - if (forkshell(jp, n, FORK_NOJOB) == 0) { -...
2010 Mar 22
1
[git pull] dash, sh4, README's
...reliminary LINENO support Roy Marples (1): [klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes Stefan Potyra (1): [klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd Steve Langasek (1): [klibc] [EVAL] Fix bad pointer arithmetic in evalcommand maximilian attems (5): [klibc] mv worthwile README's to ease packaging [klibc] document klibc dash sync procedure [klibc] dash update config.h [klibc] gitignore fixup for test dir [klibc] add testcase for future arch socket foo git diff -M --stat --summary mas...
2010 Apr 16
0
[git pull v4] dash, sh4, ipconfig, dprintf, fstype, README's
...reliminary LINENO support Roy Marples (1): [klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes Stefan Potyra (1): [klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd Steve Langasek (1): [klibc] [EVAL] Fix bad pointer arithmetic in evalcommand maximilian attems (13): [klibc] mv worthwile README's to ease packaging [klibc] document klibc dash sync procedure [klibc] dash update config.h [klibc] gitignore fixup for test dir [klibc] add testcase for future arch socket foo [klibc] README update arch st...
2010 Apr 16
0
[PATCH] pull faccessat() system call
...reliminary LINENO support Roy Marples (1): [klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes Stefan Potyra (1): [klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd Steve Langasek (1): [klibc] [EVAL] Fix bad pointer arithmetic in evalcommand maximilian attems (13): [klibc] mv worthwile README's to ease packaging [klibc] document klibc dash sync procedure [klibc] dash update config.h [klibc] gitignore fixup for test dir [klibc] add testcase for future arch socket foo [klibc] README update arch st...
2010 Mar 28
1
[git pull v3] dash, sh4, ipconfig, dprintf, fstype, README's
...reliminary LINENO support Roy Marples (1): [klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes Stefan Potyra (1): [klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd Steve Langasek (1): [klibc] [EVAL] Fix bad pointer arithmetic in evalcommand maximilian attems (10): [klibc] mv worthwile README's to ease packaging [klibc] document klibc dash sync procedure [klibc] dash update config.h [klibc] gitignore fixup for test dir [klibc] add testcase for future arch socket foo [klibc] README update arch st...