ports/152024: skip non-existent users in GIDs

Max Khon fjoe at FreeBSD.org
Sun Nov 7 18:50:08 UTC 2010


>Number:         152024
>Category:       ports
>Synopsis:       skip non-existent users in GIDs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 07 18:50:07 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Max Khon
>Release:        FreeBSD 8.1-PRERELEASE i386
>Organization:
FreeBSD.org 
>Environment:
>Description:
Use-case:
port A creates group "portA"
port B creates user "portB" and group "portB", user "portB" should be in group "portA"
port C creates user "portC" and grouop "portC", user "portC" should be in group "portA" too

It can be implemented using the following:

GIDs:
portA:*:XX:portB,portC

portA:
GROUPS= portA

portB:
USERS=  portB
GROUPS= portB portA

portC:
USERS=  portC
GROUPS= portC portA

However, if portC is not installed (and there is not user portC), the installation of portB fails
because of missing user portC.

Example: freeswitch and asterisk ports (each uses own user/group)
and dahdi port (freeswitch and asterisk users should be in "dahdi" group).
>How-To-Repeat:
>Fix:
Index: Mk/bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.653
diff -u -p -r1.653 bsd.port.mk
--- Mk/bsd.port.mk	29 Oct 2010 12:41:29 -0000	1.653
+++ Mk/bsd.port.mk	7 Nov 2010 18:22:16 -0000
@@ -4164,10 +4164,12 @@ create-users-groups:
 	@IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \
 		gid=$$(($$gid+${GID_OFFSET})); \
 		IFS=","; for _login in $$members; do \
-			list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \
-			${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \
-			${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \
-			${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; ${PW} usermod $${_login} -G \$${list},${_group}" >> ${TMPPLIST}; \
+		    if ${PW} usershow $$_login >/dev/null 2>&1; then \
+			    list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \
+			    ${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \
+			    ${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \
+			    ${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; ${PW} usermod $${_login} -G \$${list},${_group}" >> ${TMPPLIST}; \
+			fi \
 		done; \
 	done
 .endfor
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list