Module Name:    src
Committed By:   kre
Date:           Tue May  3 03:16:55 UTC 2016

Modified Files:
        src/bin/sh: parser.c

Log Message:
Allow function names to be any shell word not containing '/'.
This allows anything that could be a filesystem command to be
implemented as a function instead.  The restriction on '/'
is because of the way that functions are (required to be) searched
for relative to PATH searching - a function with a name containing '/'
could never be executed, so simply prohibit defining such a thing.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.117 src/bin/sh/parser.c:1.118
--- src/bin/sh/parser.c:1.117	Mon May  2 01:46:31 2016
+++ src/bin/sh/parser.c	Tue May  3 03:16:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.117 2016/05/02 01:46:31 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.118 2016/05/03 03:16:55 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.117 2016/05/02 01:46:31 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.118 2016/05/03 03:16:55 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -597,7 +597,7 @@ simplecmd(union node **rpp, union node *
 				synexpect(TRP, 0);
 			funclinno = plinno;
 			rmescapes(n->narg.text);
-			if (!goodname(n->narg.text))
+			if (strchr(n->narg.text, '/'))
 				synerror("Bad function name");
 			n->type = NDEFUN;
 			n->narg.next = command();

Reply via email to