ports/173318: bsd.port.mk assumes UID_FILES has 10 columns

Adam McDougall mcdouga9 at egr.msu.edu
Sat Nov 3 03:20:01 UTC 2012


>Number:         173318
>Category:       ports
>Synopsis:       bsd.port.mk assumes UID_FILES has 10 columns
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 03 03:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Adam McDougall
>Release:        9-STABLE amd64
>Organization:
MSU
>Environment:
FreeBSD build9 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Fri Oct  5 14:36:52 EDT 2012     root at build9:/usr/obj/usr/src/sys/BUILD9  amd64
>Description:
Short version: bsd.port.mk assumes UID_FILES points to a file where all lines have 10 columns.  Certain port install operations fail if the user entry it is trying to look up has less than 10 columns.  It assumes 10 columns are defined but if not, columns can be used for the wrong variables or are assigned null.

Details: I was trying to use poudriere to make a pkg of mailman, but we use a custom user account for mailman.  Its been a number of months now that listing a custom user and uid in make.conf has been insufficient for building mailman, it insists on the user being listed in /usr/ports/UIDS or whatever file the UID_FILES make variable points to.  I eventually had success specifying a custom file for UID_FILES, but I made a mistake at first that took me a while to debug.  It turns out for many months I was appending a 'passwd' style entry to /usr/ports/UIDs which had insufficient columns but I unknowingly worked around it by ensuring certain /usr/local/mailman dirs existed with the proper ownership before building.  In the clean poudriere build environment, I couldn't use the same workaround so I was struggling with it until I dug deep and found that bsd.port.mk would read the user from UID_FILES, assigning var1=column1, var2=column2, etc without checking if the line even had 10 column
 s.  I had missed a couple columns in the middle (for user class etc) and so the remaining columns were being assigned to the wrong variables.
>How-To-Repeat:
The essence of my /usr/local/etc/poudriere.d/90amd64-make.conf file is:
WITH_PKGNG=yes
.if ${.CURDIR:M*/mail/mailman}
MM_USERNAME=custom
MM_USERID=2012
MM_GROUPNAME=custom
MM_GROUPID=2012
MAIL_GID=custom
GID_FILES=/usr/ports/distfiles/decs/GIDs-custom
UID_FILES=/usr/ports/distfiles/decs/UIDs-custom
.endif

Initially I had copied a passwd style entry for the custom user to UIDs-custom without enough columns.  The entry for GIDs-custom came from the group file.
>Fix:
When reading from the file specified by UID_FILES, verify that the 10th column is defined since no well-defined account entry should not have a shell defined.  If no 10th column is defined (no shell), it is probably safe to say the entry is faulty.  That will at least avoid the problem of insufficient columns.  Or at least check for 9 colons?  Better yet, try to make sure all the essential columns exist?

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


More information about the freebsd-ports-bugs mailing list