klibc-bot for Herbert Xu
2020-Mar-28 21:49 UTC
[klibc] [klibc:update-dash] dash: exec: Never rehash regular built-ins
Commit-ID: e8b1ed5d253922aeb880518f27312b112e360f09 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=e8b1ed5d253922aeb880518f27312b112e360f09 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:51 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: exec: Never rehash regular built-ins [ dash commit 59e62c9a3c67eef2bf9dc86e5bf0b2c88d6e8571 ] As regular (including special) built-ins can never be overridden, we should never remove them from the hash table. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/exec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/usr/dash/exec.c b/usr/dash/exec.c index 8948754b..6c0a64f6 100644 --- a/usr/dash/exec.c +++ b/usr/dash/exec.c @@ -287,9 +287,11 @@ hashcmd(int argc, char **argv) } c = 0; while ((name = *argptr) != NULL) { - if ((cmdp = cmdlookup(name, 0)) != NULL - && (cmdp->cmdtype == CMDNORMAL - || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))) + if ((cmdp = cmdlookup(name, 0)) && + (cmdp->cmdtype == CMDNORMAL || + (cmdp->cmdtype == CMDBUILTIN && + !(cmdp->param.cmd->flags & BUILTIN_REGULAR) && + builtinloc > 0))) delete_cmd_entry(); find_command(name, &entry, DO_ERR, pathval()); if (entry.cmdtype == CMDUNKNOWN) @@ -377,7 +379,8 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) bit = DO_NOFUNC; break; case CMDBUILTIN: - bit = DO_ALTBLTIN; + bit = cmdp->param.cmd->flags & BUILTIN_REGULAR ? + 0 : DO_ALTBLTIN; break; } if (act & bit) { @@ -601,7 +604,9 @@ clearcmdentry(void) pp = tblp; while ((cmdp = *pp) != NULL) { if (cmdp->cmdtype == CMDNORMAL || - (cmdp->cmdtype == CMDBUILTIN && builtinloc > 0)) { + (cmdp->cmdtype == CMDBUILTIN && + !(cmdp->param.cmd->flags & BUILTIN_REGULAR) && + builtinloc > 0)) { *pp = cmdp->next; ckfree(cmdp); } else {
Apparently Analagous Threads
- [klibc:update-dash] dash: eval: Add assignment built-in support again
- [klibc:update-dash] dash: exec: Stricter pathopt parsing
- [klibc:update-dash] dash: eval: Replace with listsetvar with mklocal/setvareq
- [klibc:update-dash] builtin: describe_command - fix incorrect path
- [klibc:update-dash] dash: builtin: describe_command - fix incorrect path