Subject: toolchain/36048: [dM] build.sh vs . in $PATH
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 03/20/2007 14:35:00
>Number:         36048
>Category:       toolchain
>Synopsis:       build.sh  fails sub-optimally with . early in $PATH
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 20 14:35:00 +0000 2007
>Originator:     der Mouse
>Release:        NetBSD 3.1
>Organization:
	Dis-
>Environment:
	Any 3.1, and possibly others; noticed on
System: NetBSD NetBSD-3-1.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (GENERIC) #0: Thu Mar 8 22:46:51 EST 2007 mouse@NetBSD-3-1.Rodents.Montreal.QC.CA:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	If . is early in $PATH, and you're cross-building or otherwise
	running under a kernel that won't run the newly-built
	executables (eg, building a system to a non-/ DESTDIR before
	installing the corresponding kernel), the build ticks along
	until it builds mv, then fails because it runs "mv" unadorned;
	with . early in $PATH, this tries to run the new mv, which
	fails.

	Yes, having . early in $PATH is arguably a bad idea, but this
	is a rather impressively bad way for the build system to react,
	especially for someone new to Unix, to whom the failure mode is
	pretty much certain to be cryptic and baffling.
>How-To-Repeat:
	env PATH=.:$PATH build.sh ... build
	(or "distribution", or anything else that implies "build").
>Fix:
	After a little discussion on tech-toolchain, the favoured fix
	seems to be (I'm quoting from a list message)

	Change build.sh to error out with a *descriptive* message if .
	is in the PATH.  [...] perhaps any non-absolute path in $PATH
	should produce similar errors [...]  (I'd argue the ". in
	$PATH" (or perhaps "non-absolute path in $PATH") check should
	be overridden, or at least downgraded to a warning, by -E.)

	I don't have patches to implement this; if and when I produce
	them, I'll append them to this PR.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B