Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/bin/sh Pull up following revision(s) (requested by kre in...



details:   https://anonhg.NetBSD.org/src/rev/cf7b1db9f47a
branches:  netbsd-8
changeset: 946751:cf7b1db9f47a
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 07 19:39:09 2020 +0000

description:
Pull up following revision(s) (requested by kre in ticket #1629):

        bin/sh/exec.c: revision 1.54

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)

diffstat:

 bin/sh/exec.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 9772d710a3c4 -r cf7b1db9f47a bin/sh/exec.c
--- a/bin/sh/exec.c     Mon Dec 07 19:35:50 2020 +0000
+++ b/bin/sh/exec.c     Mon Dec 07 19:39:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec.c,v 1.47.2.4 2018/08/25 14:48:22 martin Exp $     */
+/*     $NetBSD: exec.c,v 1.47.2.5 2020/12/07 19:39:09 martin 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.47.2.4 2018/08/25 14:48:22 martin Exp $");
+__RCSID("$NetBSD: exec.c,v 1.47.2.5 2020/12/07 19:39:09 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -667,6 +667,10 @@
                        cmdp = &loc_cmd;
                } else
                        cmdp = cmdlookup(name, 1);
+
+               if (cmdp->cmdtype == CMDFUNCTION)
+                       cmdp = &loc_cmd;
+
                cmdp->cmdtype = CMDNORMAL;
                cmdp->param.index = idx;
                INTON;



Home | Main Index | Thread Index | Old Index