ports/146816: [patch] Mk/bsd.port.mk: loosen SU_CMD & su(1) cohesion for make {, rm}config

Anonymous swell.k at gmail.com
Sat May 22 06:30:04 UTC 2010


>Number:         146816
>Category:       ports
>Synopsis:       [patch] Mk/bsd.port.mk: loosen SU_CMD & su(1) cohesion for make {,rm}config
>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:   Sat May 22 06:30:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Anonymous
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
__MAKE_CONF=~/.make.conf
PORTSDIR=/a/freebsd-ports, owned by regular user
>Description:
Allow using sudo(1) directly in SU_CMD, e.g.

  SU_CMD=eval sudo -E

instead of

  SU_CMD=sudo -E sh -c

This removes some specific cases that presume `su -c' or `sh -c', e.g.

  $ su -c 'cmd1; cmd2'
  $ su -c 'cmd > file'

This shouldn't affect default usage

  SU_CMD=su root -c

>How-To-Repeat:
>Fix:
--- a.diff begins here ---
Index: Mk/bsd.port.mk
===================================================================
RCS file: /a/.cvsup/ports/Mk/bsd.port.mk,v
retrieving revision 1.638
diff -u -p -r1.638 bsd.port.mk
--- Mk/bsd.port.mk	12 May 2010 19:57:57 -0000	1.638
+++ Mk/bsd.port.mk	22 May 2010 06:16:43 -0000
@@ -6073,7 +6073,7 @@ config:
 .if ${UID} != 0 && !defined(INSTALL_AS_USER)
 	@optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \
 	${ECHO_MSG} "===>  Switching to root credentials to create $${optionsdir}"; \
-	(${SU_CMD} "${SH} -c \"${MKDIR} $${optionsdir} 2> /dev/null\"") || \
+	${SU_CMD} "${MKDIR} $${optionsdir} 2> /dev/null" || \
 		(${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \
 	${ECHO_MSG} "===>  Returning to user credentials"
 .else
@@ -6133,7 +6133,8 @@ config:
 	done; \
 	if [ `${ID} -u` != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \
 		${ECHO_MSG} "===>  Switching to root credentials to write ${OPTIONSFILE}"; \
-		${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}"; \
+		${SU_CMD} "${CP} $${TMPOPTIONSFILE} ${OPTIONSFILE}"; \
+		${SU_CMD} "${CHMOD} +r $${TMPOPTIONSFILE} ${OPTIONSFILE}"; \
 		${ECHO_MSG} "===>  Returning to user credentials"; \
 	else \
 		${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}; \
@@ -6226,8 +6227,8 @@ rmconfig:
 	optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \
 	if [ `${ID} -u` != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \
 		${ECHO_MSG} "===> Switching to root credentials to remove ${OPTIONSFILE} and $${optionsdir}"; \
-		${SU_CMD} "${RM} -f ${OPTIONSFILE} ; \
-			${RMDIR} $${optionsdir}"; \
+		${SU_CMD} "${RM} -f ${OPTIONSFILE}"; \
+		${SU_CMD} "${RMDIR} $${optionsdir}"; \
 		${ECHO_MSG} "===> Returning to user credentials"; \
 	else \
 		${RM} -f ${OPTIONSFILE}; \
--- a.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list