From utisoft@hotmail.com  Sun Jun  5 10:10:20 2011
Return-Path: <utisoft@hotmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49D2A106566C
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  5 Jun 2011 10:10:20 +0000 (UTC)
	(envelope-from utisoft@hotmail.com)
Received: from blu0-omc1-s7.blu0.hotmail.com (blu0-omc1-s7.blu0.hotmail.com [65.55.116.18])
	by mx1.freebsd.org (Postfix) with ESMTP id 009CE8FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  5 Jun 2011 10:10:19 +0000 (UTC)
Received: from BLU0-SMTP181 ([65.55.116.9]) by blu0-omc1-s7.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675);
	 Sun, 5 Jun 2011 03:10:19 -0700
Received: from zeus.bayofrum.net ([90.221.7.100]) by BLU0-SMTP181.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675);
	 Sun, 5 Jun 2011 03:10:17 -0700
Received: from zeus.bayofrum.net (crees@localhost [127.0.0.1])
	by zeus.bayofrum.net (8.14.4/8.14.4) with ESMTP id p55A9Vh8054558
	(version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 5 Jun 2011 11:09:32 +0100 (BST)
	(envelope-from chris@zeus.bayofrum.net)
Received: (from crees@localhost)
	by zeus.bayofrum.net (8.14.4/8.14.4/Submit) id p55A9VkY054528;
	Sun, 5 Jun 2011 11:09:31 +0100 (BST)
	(envelope-from chris)
Message-Id: <BLU0-SMTP1819D4C0812F2EA765F3425A9610@phx.gbl>
Date: Sun, 5 Jun 2011 11:09:31 +0100
From: Chris Rees <utisoft@gmail.com>
Sender: <utisoft@hotmail.com>
Reply-To: Chris Rees <utisoft@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Fix port: mail/qmail should use USERS
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         157622
>Category:       ports
>Synopsis:       [PATCH] Fix port: mail/qmail should use USERS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    garga
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 05 10:20:07 UTC 2011
>Closed-Date:    Mon Jul 18 20:55:47 UTC 2011
>Last-Modified:  Mon Jul 18 21:00:26 UTC 2011
>Originator:     Chris Rees
>Release:        FreeBSD 8.2-RELEASE-p1 i386
>Organization:
bayofrum
>Environment:
System: FreeBSD zeus.bayofrum.net 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0: Sat Apr 30 15:09:06 BST 2011 root@zeus.bayofrum.net:/usr/obj/usr/src/sys/ZEUS i386


	
>Description:
	

	This port uses pkg-install to create new users instead of using USERS= and GROUPS=

	I've modified the Makefile in qmail to use our hardcoded UIDs to stop it erroring out when it can't find the usernames there.

>How-To-Repeat:
	
>Fix:

	- Use USERS and GROUPS
	- Stop touching system before install

	Submitted by: Chris Rees (utisoft@gmail.com)

	Please note that I've added files/patch-Makefile and files/patch-auto_uids-c-dist


--- mail-qmail.patch begins here ---
Index: Makefile
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/mail/qmail/Makefile,v
retrieving revision 1.152
diff -u -r1.152 Makefile
--- Makefile	20 Sep 2010 13:35:44 -0000	1.152
+++ Makefile	4 Jun 2011 19:52:25 -0000
@@ -26,6 +26,12 @@
 
 PORTSCOUT=	skipv:1.04
 
+USERS=		alias
+.for usersuffix in d l p q r s
+USERS+=		${PORTNAME}${usersuffix}
+.endfor
+GROUPS=		${PORTNAME} qnofiles
+
 .if defined(SLAVE_LDAP) || \
     defined(SLAVE_MYSQL)
 BARRIER_MAILDIRQUOTA_PATCH=	yes
@@ -246,10 +252,8 @@
 SLAVEPORT_LINE=	spamcontrol
 .endif
 
-SUB_FILES+=	mailer.conf.sample bootfiles.sed enable-qmail
-SUB_LIST+=	ECHO_CMD=${ECHO_CMD}
-# pkg-install could not be added to SUB_FILES because it's executed on do-configure:
-PKGINSTALL?=	${WRKDIR}/pkg-install
+SUB_FILES+=	mailer.conf.sample bootfiles.sed enable-qmail pkg-install
+SUB_LIST+=	ECHO_CMD=${ECHO_CMD} RCDLINK=${RCDLINK}
 
 .if defined(PKGMESSAGE_SUFFIX)
 SUB_FILES+=	pkg-message-${PKGMESSAGE_SUFFIX}
@@ -724,9 +728,6 @@
 .endif
 
 do-configure:
-	@${SED} -e 's,%%RCDLINK%%,${RCDLINK},g; s,%%LOCALBASE%%,${LOCALBASE},g' \
-		${FILESDIR}/pkg-install.in > ${WRKDIR}/pkg-install
-	@${SETENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
 	@${ECHO_CMD} "${CC} ${CFLAGS}" > ${WRKSRC}/conf-cc
 	@${ECHO_CMD} ${PREFIX} > ${WRKSRC}/conf-qmail
 .if defined(WITH_BIG_CONCURRENCY_PATCH) \
Index: files/patch-Makefile
===================================================================
RCS file: files/patch-Makefile
diff -N files/patch-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Makefile	5 Jun 2011 09:06:55 -0000
@@ -0,0 +1,31 @@
+$FreeBSD$
+
+This turns off the auto-finding of UIDs -- we shouldn't have the users
+until pre-install!
+
+We use a new file, auto_uids.c.dist to record our UIDs
+
+--- Makefile.orig	2011-06-05 10:00:58.752481173 +0100
++++ Makefile	2011-06-05 10:04:27.265135390 +0100
+@@ -110,19 +110,8 @@
+ compile auto_split.c
+ 	./compile auto_split.c
+ 
+-auto_uids.c: \
+-auto-uid auto-gid conf-users conf-groups
+-	( ./auto-uid auto_uida `head -1 conf-users` \
+-	&&./auto-uid auto_uidd `head -2 conf-users | tail -1` \
+-	&&./auto-uid auto_uidl `head -3 conf-users | tail -1` \
+-	&&./auto-uid auto_uido `head -4 conf-users | tail -1` \
+-	&&./auto-uid auto_uidp `head -5 conf-users | tail -1` \
+-	&&./auto-uid auto_uidq `head -6 conf-users | tail -1` \
+-	&&./auto-uid auto_uidr `head -7 conf-users | tail -1` \
+-	&&./auto-uid auto_uids `head -8 conf-users | tail -1` \
+-	&&./auto-gid auto_gidq `head -1 conf-groups` \
+-	&&./auto-gid auto_gidn `head -2 conf-groups | tail -1` \
+-	) > auto_uids.c.tmp && mv auto_uids.c.tmp auto_uids.c
++auto_uids.c:
++	mv auto_uids.c.dist auto_uids.c
+ 
+ auto_uids.o: \
+ compile auto_uids.c
Index: files/patch-auto_uids-c-dist
===================================================================
RCS file: files/patch-auto_uids-c-dist
diff -N files/patch-auto_uids-c-dist
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-auto_uids-c-dist	5 Jun 2011 09:36:57 -0000
@@ -0,0 +1,16 @@
+--- /dev/null		1970-01-01 01:00:00.000000000 +0100
++++ auto_uids.c.dist	2011-06-05 10:29:16.425936277 +0100
+@@ -0,0 +1,13 @@
++/* These values are hard-coded here, which looks bad until you *
++ * realise that they're hard-coded in ${PORTSDIR}/?IDs anyway. */
++/* $FreeBSD$ */
++int auto_uida = 81;
++int auto_uidd = 82;
++int auto_uidl = 83;
++int auto_uido = 0;
++int auto_uidp = 84;
++int auto_uidq = 85;
++int auto_uidr = 86;
++int auto_uids = 87;
++int auto_gidq = 82;
++int auto_gidn = 81;
Index: files/pkg-install.in
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/mail/qmail/files/pkg-install.in,v
retrieving revision 1.8
diff -u -r1.8 pkg-install.in
--- files/pkg-install.in	19 Aug 2008 13:13:46 -0000	1.8
+++ files/pkg-install.in	4 Jun 2011 19:46:18 -0000
@@ -6,66 +6,8 @@
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
 PREFIX=${PKG_PREFIX:-%%PREFIX%%}
-UID=`id -u`
 
-addGroup() {
-	NGROUP=$1
-	NGID=$2
-
-	if ! pw groupshow ${NGROUP} >/dev/null 2>&1; then
-		if ! pw groupadd ${NGROUP} -g ${NGID} >/dev/null 2>&1; then
-			echo "Failed to add group '${NGROUP}' as gid '${NGID}'"
-			exit 1
-		fi
-	fi
-
-	CHECKGID=`pw groupshow ${NGROUP} 2>/dev/null | cut -d: -f3`
-	if [ "${CHECKGID}" != "${NGID}" ]; then
-		echo "Group '$NGROUP' should have gid '$NGID'"
-		exit 1
-	fi
-}
-
-addUser() {
-	NUSER=$1
-	NUID=$2
-	NGROUP=$3
-	NHOME=${4:-${PREFIX}}
-
-	if ! pw usershow ${NUSER} >/dev/null 2>&1; then
-		if ! pw useradd ${NUSER} -g ${NGROUP} -d ${NHOME} -s /nonexistent -u ${NUID} >/dev/null 2>&1; then
-			echo "Failed to add user '${NUSER}' as uid '${NUID}'"
-			exit 1
-		fi
-	fi
-
-	CHECKUID=`pw usershow ${NUSER} 2>/dev/null | cut -d: -f3`
-	if [ "${CHECKUID}" != "${NUID}" ]; then
-		echo "User '$NUSER' should have uid '$NUID'"
-		exit 1
-	fi
-}
-
-if [ "$UID" != "0" ]; then
-	echo "It is necessary to add missing qmail users/groups at"
-	echo "this stage.  Please either add them manually or retry"
-	echo "as root."
-	exit 1
-fi
-
-if [ "$2" = "PRE-INSTALL" ]; then
-	addGroup qmail    82
-	addGroup qnofiles 81
-
-	addUser alias  81 qnofiles ${PREFIX}/alias
-	addUser qmaild 82 qnofiles
-	addUser qmaill 83 qnofiles
-	addUser qmailp 84 qnofiles
-	addUser qmailq 85 qmail
-	addUser qmailr 86 qmail
-	addUser qmails 87 qmail
-
-elif [ "$2" = "POST-INSTALL" ]; then
+if [ "$2" = "POST-INSTALL" ]; then
 	${PREFIX}/configure/install x
 
 	[ -e ${PREFIX}/control/me ] || (cd ${PREFIX}/configure && ./config)
--- mail-qmail.patch ends here ---



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->garga 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jun 5 10:20:17 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157622 

From: Chris Rees <crees@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/157622: [PATCH] Fix port: mail/qmail should use USERS
Date: Sun, 10 Jul 2011 18:43:41 +0100

 Hey,
 
 Is the patch at [1] OK? If you don't have time I'll commit it -- it 
 Tinderboxes fine.
 
 Thanks!
 
 Chris
 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/157622
 
 -- 
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 

From: Chris Rees <crees@freebsd.org>
To: Renato Botelho do Couto <garga@freebsd.org>
Cc: "bug-followup@freebsd.org" <bug-followup@freebsd.org>
Subject: Re: ports/157622: [PATCH] Fix port: mail/qmail should use USERS
Date: Mon, 11 Jul 2011 12:22:17 +0100

 --00221532cee457552d04a7c96590
 Content-Type: text/plain; charset=ISO-8859-1
 
 > I'm working on this, it's not so easy to say if a change on qmail port
 > is fine, you need to test all slave ports with all patch combinations to
 > be sure the change doesn't break anything.
 
 Oops, we already had this conversation.... sorry for nagging!
 
 Chris
 
 --00221532cee457552d04a7c96590
 Content-Type: text/html; charset=ISO-8859-1
 
 <p><br>
 &gt; I&#39;m working on this, it&#39;s not so easy to say if a change on qmail port<br>
 &gt; is fine, you need to test all slave ports with all patch combinations to<br>
 &gt; be sure the change doesn&#39;t break anything.</p>
 <p>Oops, we already had this conversation.... sorry for nagging!</p>
 <p>Chris</p>
 
 --00221532cee457552d04a7c96590--

From: Chris Rees <crees@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/157622: [PATCH] Fix port: mail/qmail should use USERS
Date: Mon, 18 Jul 2011 21:29:38 +0100

 Hey Renato,
 
 I noticed that the build problem with qmail-spamcontrol is simply 
 because the patches from the UIDs fix aren't included in the build 
 because of the PATCHDIR=       ${.CURDIR}/files.
 
 I've added the relevant patchfiles to EXTRA_PATCHES. It now builds fine.
 
 http://www.bayofrum.net/~crees/patches/qmail-spamcontrol.diff
 
 Chris
 
 -- 
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 
State-Changed-From-To: open->closed 
State-Changed-By: garga 
State-Changed-When: Mon Jul 18 20:55:46 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157622 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/157622: commit references a PR
Date: Mon, 18 Jul 2011 20:55:43 +0000 (UTC)

 garga       2011-07-18 20:55:29 UTC
 
   FreeBSD ports repository
 
   Modified files:
     mail/qmail           Makefile 
     mail/qmail/files     pkg-install.in 
     mail/qmail-spamcontrol Makefile 
     mail/qmail-ldap      Makefile 
   Added files:
     mail/qmail/files     patch-Makefile patch-auto_uids-c-dist 
   Log:
   - Make qmail use USERS and GROUPS [1]
   - Add my local_distfiles as a MASTER_SITES to ucspi-ssl
   
   PR:             ports/157622 [1]
   Submitted by:   crees [1]
   
   Revision  Changes    Path
   1.51      +3 -0      ports/mail/qmail-ldap/Makefile
   1.41      +3 -1      ports/mail/qmail-spamcontrol/Makefile
   1.153     +11 -8     ports/mail/qmail/Makefile
   1.1       +31 -0     ports/mail/qmail/files/patch-Makefile (new)
   1.1       +16 -0     ports/mail/qmail/files/patch-auto_uids-c-dist (new)
   1.9       +2 -60     ports/mail/qmail/files/pkg-install.in
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
