tech-userlevel archive

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

sh(1) and ksh(1) default PATH



A problem many new NetBSD users encounter is that a default shell
without an initialized home directory containing a ~/.profile
does not include some system PATH entries that would otherwise be
provided from /etc/skel/.profile.

This came up during the recent El Reg "review" of NetBSD 9.3.

This patch synchronizes the defaults for sh(1) and ksh(1)
with /etc/skel/.profile.
Index: bin/sh/eval.c
===================================================================
RCS file: /cvsroot/src/bin/sh/eval.c,v
retrieving revision 1.188
diff -u -p -u -r1.188 eval.c
--- bin/sh/eval.c	5 Jan 2022 15:25:44 -0000	1.188
+++ bin/sh/eval.c	13 Aug 2022 20:58:10 -0000
@@ -815,7 +815,7 @@ syspath(void)
 {
 	static char *sys_path = NULL;
 	static int mib[] = {CTL_USER, USER_CS_PATH};
-	static char def_path[] = "PATH=/usr/bin:/bin:/usr/sbin:/sbin";
+	static char def_path[] = "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin";
 	size_t len;
 
 	if (sys_path == NULL) {
Index: bin/ksh/config.h
===================================================================
RCS file: /cvsroot/src/bin/ksh/config.h,v
retrieving revision 1.53
diff -u -p -u -r1.53 config.h
--- bin/ksh/config.h	30 Jun 2017 04:22:22 -0000	1.53
+++ bin/ksh/config.h	13 Aug 2022 20:58:10 -0000
@@ -68,9 +68,9 @@
 
 /* Default PATH */
 #ifdef RESCUEDIR
-#define DEFAULT_PATH RESCUEDIR ":/bin:/usr/bin:/sbin:/usr/sbin"
+#define DEFAULT_PATH RESCUEDIR ":/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin"
 #else
-#define DEFAULT_PATH "/bin:/usr/bin:/sbin:/usr/sbin"
+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin"
 #endif
 
 /* Include ksh features? */


Home | Main Index | Thread Index | Old Index