Bug 122306 - misc/compat5x port fails to extract if you're root
Summary: misc/compat5x port fails to extract if you're root
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-31 22:00 UTC by Dimitry Andric
Modified: 2008-05-28 13:30 UTC (History)
0 users

See Also:


Attachments
file.diff (463 bytes, patch)
2008-03-31 22:00 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric 2008-03-31 22:00:05 UTC
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.

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).
How-To-Repeat: make -C /usr/ports/misc/compat5x extract
Comment 1 Ryan 2008-05-16 22:57:23 UTC
Why is this bug still present in this port?

Attached patched of compat5x's "Makefile" works but obviously will be lost
with any port update.
Comment 2 dfilter service freebsd_committer freebsd_triage 2008-05-28 13:25:19 UTC
edwin       2008-05-28 12:25:15 UTC

  FreeBSD ports repository

  Modified files:
    misc/compat5x        Makefile 
  Log:
  compat5x port can fail to extract if you're root.
  
          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.
  
  This is because the files in the distfile archive have the schg flag set.
  That flag is killed btw in the post-extract phase.
  
  PR:             ports/122306
  Submitted by:   Dimitry Andric <dimitry@andric.com>
  
  Revision  Changes    Path
  1.18      +2 -0      ports/misc/compat5x/Makefile
_______________________________________________
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"
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2008-05-28 13:25:23 UTC
State Changed
From-To: open->closed

Committed, thanks!