PR bin/55526
Fix a bug that has existed since the "command" command was added in 2003. "command foo" would cause the definition of a function "foo" to be lost (not freed, simply discarded) if "foo" is (in addition to being a function) a filesystem command. The case where "foo" is a builtin was handled. For now, when a function exists with the same name as a filesystem command, the latter can never appear in the command hash table, and when used (which can only be via "command foo", just "foo" finds the function) will always result in a full PATH search. XXX pullup everything (from NetBSD 2.0 onwards). (really -8 and -9)
This commit is contained in:
parent
a99e4a0c7c
commit
b76256406d
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: exec.c,v 1.53 2018/07/25 14:42:50 kre Exp $ */
|
||||
/* $NetBSD: exec.c,v 1.54 2020/08/01 17:51:18 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: exec.c,v 1.53 2018/07/25 14:42:50 kre Exp $");
|
||||
__RCSID("$NetBSD: exec.c,v 1.54 2020/08/01 17:51:18 kre Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -667,6 +667,10 @@ loop:
|
||||
cmdp = &loc_cmd;
|
||||
} else
|
||||
cmdp = cmdlookup(name, 1);
|
||||
|
||||
if (cmdp->cmdtype == CMDFUNCTION)
|
||||
cmdp = &loc_cmd;
|
||||
|
||||
cmdp->cmdtype = CMDNORMAL;
|
||||
cmdp->param.index = idx;
|
||||
INTON;
|
||||
|
Loading…
Reference in New Issue
Block a user