[git commit] ash: exec: Never rehash regular built-ins
Denys Vlasenko
vda.linux at googlemail.com
Mon Feb 17 15:20:05 UTC 2020
commit: https://git.busybox.net/busybox/commit/?id=22c75924daa41b7ea097796afd4baafa2fc99d05
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Upstream commit:
Date: Sat, 19 May 2018 02:39:51 +0800
exec: Never rehash regular built-ins
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: Denys Vlasenko <vda.linux at googlemail.com>
---
shell/ash.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index c383cccda..389db3cd0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8284,7 +8284,10 @@ clearcmdentry(void)
pp = tblp;
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDNORMAL
- || (cmdp->cmdtype == CMDBUILTIN && builtinloc > 0)
+ || (cmdp->cmdtype == CMDBUILTIN
+ && !IS_BUILTIN_REGULAR(cmdp->param.cmd)
+ && builtinloc > 0
+ )
) {
*pp = cmdp->next;
free(cmdp);
@@ -8403,7 +8406,11 @@ hashcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
cmdp = cmdlookup(name, 0);
if (cmdp != NULL
&& (cmdp->cmdtype == CMDNORMAL
- || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))
+ || (cmdp->cmdtype == CMDBUILTIN
+ && !IS_BUILTIN_REGULAR(cmdp->param.cmd)
+ && builtinloc > 0
+ )
+ )
) {
delete_cmd_entry();
}
@@ -13556,7 +13563,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
bit = DO_NOFUNC;
break;
case CMDBUILTIN:
- bit = DO_ALTBLTIN;
+ bit = IS_BUILTIN_REGULAR(cmdp->param.cmd) ? 0 : DO_ALTBLTIN;
break;
}
if (act & bit) {
More information about the busybox-cvs
mailing list