Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 2009 12:45:50 GMT
From:      Artis Caune <Artis.Caune@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/130184: [patch] mail/exim: fix user/group creation order and errors
Message-ID:  <200901051245.n05Cjohs025099@www.freebsd.org>
Resent-Message-ID: <200901051250.n05Co1rQ081627@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         130184
>Category:       ports
>Synopsis:       [patch] mail/exim: fix user/group creation order and errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 05 12:50:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Artis Caune
>Release:        stable/7
>Organization:
>Environment:
FreeBSD builder 7.1-STABLE FreeBSD 7.1-STABLE #0 r186761: Mon Jan  5 11:46:44 EET 2009     root@builder:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
- If using EXIM_USER and EXIM_GROUP with packages, install script will fail because it will first try to add user and then group. You can not add user without existing group.

- Install script use ${EXIM_USER}, ${EXIM_GROUP} variables, which are only used in ports, not packages.
>How-To-Repeat:
# make EXIM_USER=exim EXIM_GROUP=exim package clean

# pkg_delete exim-4.69_2
# pw group del exim
# pw user del exim

# pkg_add ./exim-4.69_2.tbz

>Fix:


Patch attached with submission follows:

--- pkg-install.orig	2007-08-04 14:41:00.000000000 +0300
+++ pkg-install	2009-01-05 14:29:08.999104684 +0200
@@ -18,12 +18,12 @@
 logdir=%%LOGDIR%%
 
 if [ "$2" = "PRE-INSTALL" ]; then
-	if ! /usr/bin/id ${user} > /dev/null; then
-		/usr/sbin/pw useradd ${EXIM_USER} -g ${EXIM_GROUP} -u 125 \
-		-h - -d /var/spool/exim -s /nonexistent -c "Exim User"
+	if ! /usr/sbin/pw groupshow ${group} >/dev/null; then
+		/usr/sbin/pw groupadd ${group} -g 125
 	fi
-	if ! /usr/bin/grep -q "^${group}:" /etc/group; then
-		/usr/sbin/pw groupadd ${EXIM_GROUP} -g 125
+	if ! /usr/sbin/pw usershow ${user} >/dev/null; then
+		/usr/sbin/pw useradd ${user} -g ${group} -u 125 \
+		-h - -d /var/spool/exim -s /nonexistent -c "Exim User"
 	fi
 	/bin/mkdir -p ${logdir}
 	/usr/sbin/chown ${user}:${group} ${logdir}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901051245.n05Cjohs025099>