ports/67529: patch for bsd.port.mk: OPTIONS can make 2/ directory

Hiroki Sato hrs at FreeBSD.org
Thu Jun 3 14:00:57 UTC 2004


>Number:         67529
>Category:       ports
>Synopsis:       patch for bsd.port.mk: OPTIONS can make 2/ directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 03 07:00:54 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hiroki Sato
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Tokyo University of Science
>Environment:
System: FreeBSD alph.allbsd.org 4.9-STABLE FreeBSD 4.9-STABLE #2: Fri Mar 19 04:20:12 JST 2004     hrs at alph.allbsd.org:/usr/obj/usr/src/sys/ALPH  i386

>Description:
	When OPTIONS is set and "make config" is invoked by a non-root user
	with no INSTALL_AS_USER, switching to the root user is occurred.
	However, if the root user uses csh as his login shell it can make
	a directory called "2" in the current directory.

	This is because the following code in bsd.port.mk calls
	/usr/bin/su root -c "mkdir -p foo 2> /dev/null":

	|4717 .if ${UID} != 0 && !defined(INSTALL_AS_USER)
	|4718	@${ECHO_MSG} "===>  Switching to root credentials to create `${DIRNAME} ${_OPTIONSFILE}`"
	|4719	@(${SU_CMD} "${MKDIR} `${DIRNAME} ${_OPTIONSFILE}` 2> /dev/null") || \
	|4720		(${ECHO_MSG} "===> Cannot create `${DIRNAME} ${_OPTIONSFILE}`, check permissions"; exit 1)
	|4721	@${ECHO_MSG} "===>  Returning to user credentials"
	|4722 .else

	csh interprets this command as "mkdir -p foo 2 > /dev/null" so
	it makes two directories foo and 2.  This is wrong behavior I think.

>How-To-Repeat:
	do "make config" as a non-root user.

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.490
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.490 bsd.port.mk
--- bsd.port.mk	31 May 2004 18:07:57 -0000	1.490
+++ bsd.port.mk	3 Jun 2004 13:42:10 -0000
@@ -4716,7 +4716,7 @@
 .endif
 .if ${UID} != 0 && !defined(INSTALL_AS_USER)
 	@${ECHO_MSG} "===>  Switching to root credentials to create `${DIRNAME} ${_OPTIONSFILE}`"
-	@(${SU_CMD} "${MKDIR} `${DIRNAME} ${_OPTIONSFILE}` 2> /dev/null") || \
+	@(${SU_CMD} "${SH} -c \"${MKDIR} `${DIRNAME} ${_OPTIONSFILE}` 2> /dev/null\"") || \
 		(${ECHO_MSG} "===> Cannot create `${DIRNAME} ${_OPTIONSFILE}`, check permissions"; exit 1)
 	@${ECHO_MSG} "===>  Returning to user credentials"
 .else
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list