NetBSD Problem Report #25044

Received: (qmail 16537 invoked by uid 605); 4 Apr 2004 00:00:06 -0000
Message-Id: <20040403235958.GA17218@cyclonus>
Date: Sun, 4 Apr 2004 01:59:58 +0200
From: Christian Biere <christianbiere@gmx.de>
Sender: gnats-bugs-owner@NetBSD.org
To: gnats-bugs@gnats.netbsd.org
Subject: Bash has current working directory in PATH by default
X-Send-Pr-Version: 3.95

>Number:         25044
>Category:       pkg
>Synopsis:       bash has current working in PATH by default
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    reed
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 04 00:01:01 +0000 2004
>Closed-Date:    Tue Dec 27 21:33:45 +0000 2005
>Last-Modified:  Tue Dec 27 21:35:01 +0000 2005
>Originator:     Christian Biere
>Release:        NetBSD 2.0B
>Organization:
>Environment:
System: NetBSD cyclonus 2.0B NetBSD 2.0B (STARSCREAM) #0: Wed Mar 31 19:33:12 CEST 2004 bin@cyclonus:/usr/obj/sys/arch/i386/compile/STARSCREAM i386
>Description:

Bash (2.05b) sets the environment variable PATH to a hardcoded default if it's
not set by the configuration files or not already set before execution.
First of all, this default path is quite non-standard for NetBSD. Worse,
it contains a dot i.e., the current working directory.
This situation (PATH unset, no login files) seems rather unlikely to me, so
I'd not rate this as critical.

>How-To-Repeat:

 o mv $HOME/.{profile,bashrc,bash_login,bash_profile} backup/
 o unset PATH
 o /usr/pkg/bin/bash
 o echo $PATH
   /usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.

>Fix:

Use sysctl user.cs_path instead of hardcoding a default path
(PATH_DEFAULT_VALUE)or hardcode a saner default e.g.,
'/bin:/usr/bin:/sbin:/usr/sbin' or _PATH_DEFPATH from /usr/include/paths.h
as /bin/sh. [ Although, I prefer to not have /usr/pkg/bin in my PATH as
root. ] Another workaround for login shells is to modify /etc/profile like
this:

if [ x$PATH = x ]; then
  PATH=/bin:/usr/bin:/sbin:/usr/bin
  export PATH
fi

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->reed
Responsible-Changed-By: reed@netbsd.org
Responsible-Changed-When: Sat, 15 Oct 2005 03:01:07 +0000
Responsible-Changed-Why:
I will look at this.


State-Changed-From-To: open->analyzed
State-Changed-By: reed@netbsd.org
State-Changed-When: Sun, 18 Dec 2005 03:32:23 +0000
State-Changed-Why:
After freeze I will commit for bash2 and bash with this addition:
CPPFLAGS+=             -DDEFAULT_PATH_VALUE="\"/usr/bin:/bin:${LOCALBASE}/bin:/usr/local/bin\""
This is a more sane default and is same as NetBSD's _PATH_DEFPATH.
The only difference I see between this and others is that I see /usr/local/bin
earlier -- but that doesn't matter.


State-Changed-From-To: analyzed->closed
State-Changed-By: reed@netbsd.org
State-Changed-When: Tue, 27 Dec 2005 21:33:45 +0000
State-Changed-Why:
Updated both bash and bash2 packages for this.
Thank you for this suggestion.


From: "Jeremy C. Reed" <reed@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/25044 CVS commit: pkgsrc/shells
Date: Tue, 27 Dec 2005 21:32:59 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	reed
 Date:		Tue Dec 27 21:32:59 UTC 2005

 Modified Files:
 	pkgsrc/shells/bash: Makefile
 	pkgsrc/shells/bash2: Makefile

 Log Message:
 For both bash packages, use CPP to define
 DEFAULT_PATH_VALUE as /usr/bin:/bin:${LOCALBASE}/bin:/usr/local/bin

 (Instead of having non-existent default PATH directories.)

 Bump PKGREVISION.

 This is for PR 25044.

 Okayed by bash2 maintainer.


 To generate a diff of this commit:
 cvs rdiff -r1.14 -r1.15 pkgsrc/shells/bash/Makefile
 cvs rdiff -r1.68 -r1.69 pkgsrc/shells/bash2/Makefile

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.