Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2008 22:53:00 +0200 (CEST)
From:      Dimitry Andric <dimitry@andric.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/122306: compat5x port fails to extract if you're root
Message-ID:  <20080331205300.59B8D5E@tensor.andric.com>
Resent-Message-ID: <200803312100.m2VL05LE013469@freefall.freebsd.org>

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

>Number:         122306
>Category:       ports
>Synopsis:       compat5x port fails to extract if you're root
>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 Mar 31 21:00:05 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dimitry Andric
>Release:        FreeBSD 7.0-STABLE i386
>Organization:
n/a
>Environment:
System: FreeBSD tensor.andric.com 7.0-STABLE FreeBSD 7.0-STABLE #0: Sun Mar 30 22:41:26 CEST 2008 dim@vfbsd7.home.andric.com:/usr/obj/usr/src/sys/TENSOR i386
>Description:
If you are building the misc/compat5x port as root, it can fail to
extract properly, if your ports dir is not owned by root:wheel, but for
example by root:src.

# make -C /usr/ports/misc/compat5x extract
===>  Vulnerability check disabled, database not found
===>  Extracting for compat5x-i386-5.4.0.8_9
=> MD5 Checksum OK for compat5x-i386-5.4.0.8.tar.bz2.
=> SHA256 Checksum OK for compat5x-i386-5.4.0.8.tar.bz2.
chown: /usr/ports/misc/compat5x/work/compat5x/libcrypt.so.2:
Operation not permitted
chown: /usr/ports/misc/compat5x/work/compat5x/libc.so.5:
Operation not permitted
chown: /usr/ports/misc/compat5x/work/compat5x/libthr.so.1:
Operation not permitted
chown: /usr/ports/misc/compat5x/work/compat5x/libpthread.so.1:
Operation not permitted
chown: /usr/ports/misc/compat5x/work/compat5x/libc_r.so.5:
Operation not permitted
*** Error code 1

This is caused by rev 1.591 of bsd.port.mk, which (among others) fixes
PR 117507: "Reverse the condition so EXTRACT_PRESERVE_OWNERSHIP now
work as advertised".

E.g. it now extracts by default with tar --no-same-owner, so if your
ports dir is group-owned by src, you'll get:

...
-r--r--r--  1 root  src  -      62308 Oct 24  2005 libbz2.so.1
-r--r--r--  1 root  src  schg  884972 Oct 24  2005 libc.so.5
-r--r--r--  1 root  src  schg  103176 Oct 24  2005 libc_r.so.5
...

The next thing bsd.port.mk tries to do is

.if !defined(EXTRACT_PRESERVE_OWNERSHIP)
	@if [ `${ID} -u` = 0 ]; then \
		${CHMOD} -R ug-s ${WRKDIR}; \
		${CHOWN} -R 0:0 ${WRKDIR}; \
	fi
.endif

which fails, apparently because chgrp'ing a schg file is not allowed.
>How-To-Repeat:
make -C /usr/ports/misc/compat5x extract
>Fix:
Possibly the following, which prevents the chmod/chown -R from above
(it's useless anyway, if you are root the tar file is extracted with
these permissions and ownerships, and they are also irrelevant for the
installation of the port).

Index: misc/compat5x/Makefile
===================================================================
RCS file: /home/ncvs/ports/misc/compat5x/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- misc/compat5x/Makefile	22 Dec 2007 15:12:55 -0000	1.17
+++ misc/compat5x/Makefile	31 Mar 2008 20:51:05 -0000
@@ -68,6 +68,8 @@
 PLIST_SUB+=	SPARC64="@comment "
 .endif
 
+EXTRACT_PRESERVE_OWNERSHIP=yes
+
 post-extract:
 	@chflags -R noschg ${WRKSRC} || ${TRUE}
 
>Release-Note:
>Audit-Trail:
>Unformatted:



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