ports/57259: Building a port as root using an NFS-mounted /usr/ports fails

Andrew Heybey ath at niksun.com
Fri Sep 26 19:40:37 UTC 2003


>Number:         57259
>Category:       ports
>Synopsis:       Building a port as root using an NFS-mounted /usr/ports
>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:   Fri Sep 26 12:40:18 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Heybey <ath at niksun.com>
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
>Environment:
System: FreeBSD celis.niksun.com 4.8-RELEASE FreeBSD 4.8-RELEASE #3: Sat
Aug 23 21:29:00 EDT 2003 ath at celis.niksun.com:/y/src/sys/compile/CELIS
i386

>Description:

You cannot build a port as root using an NFS-mounted /usr/ports if the
server maps root to a UID other than root.  When extracting the
source, tar thinks that it is root and attempts to chown the files
that it extracts to the owner in the tar file.  The chown fails,
tar fails and thus the build fails.

>How-To-Repeat:

Mount /usr/ports on a client from a server with the following in
/etc/exports:

/usr/ports -maproot=ports:src

(where the ports directory tree is writeable by ports:src).  From a
client machiine, mount /usr/ports over NFS then choose any port and do
(as root):

make EXTRACT_PRESERVE_OWNERSHIP=yes extract

It will fails with messages that tar cannot change ownership of the
files that it extracts.  (EXTRACT_PRESERVE_OWNERSHIP needs to be
defined to prevent bsd.port.mk from chowning the extracted tree to
root).

>Fix:

Put tar's attempt to change ownership under control of the same
EXTRACT_PRESERVE_OWNERSHIP variable:

--- ports/Mk/bsd.port.mk.~1.461.~       Fri Aug  8 09:39:41 2003
+++ porst/Mk/bsd.port.mk        Fri Sep 26 13:09:05 2003
@@ -1609,7 +1609,11 @@
 EXTRACT_AFTER_ARGS?=   -d ${WRKDIR}
 .else
 EXTRACT_BEFORE_ARGS?=  -dc
+.if defined(EXTRACT_PRESERVE_OWNERSHIP)
+EXTRACT_AFTER_ARGS?=   | ${TAR} -xf - --no-same-owner
+.else
 EXTRACT_AFTER_ARGS?=   | ${TAR} -xf -
+.endif
 .if defined(USE_BZIP2)
 EXTRACT_CMD?=                  ${BZIP2_CMD}
 .else
>Release-Note:
>Audit-Trail:
>Unformatted:
 >fails Severity:      non-critical



More information about the freebsd-ports-bugs mailing list