Bug 196414 - x11-toolkits/linux-c6-tk85 doesn't build as unprivileged user.
Summary: x11-toolkits/linux-c6-tk85 doesn't build as unprivileged user.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Andree
URL:
Keywords:
: 197138 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-01 05:04 UTC by Peter Jeremy
Modified: 2015-03-26 00:00 UTC (History)
3 users (show)

See Also:


Attachments
proposed workaround to enable build as unprivileged user, tested w/ poudriere for 9.3/10.1 amd64 (1.47 KB, patch)
2015-03-25 23:46 UTC, Matthias Andree
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy freebsd_committer freebsd_triage 2015-01-01 05:04:59 UTC
It should be possible to build ports as a non-privileged user and the build scripts should elevate privileges to the minimal extent required to test or install ports.  x11-toolkits/linux-c6-tk85 fails this test.

server% cd /usr/ports/x11-toolkits/linux-c6-tk85
server% sudo make clean 
===>  Cleaning for linux-c6-tk85-8.5.7_1
server% make
===>   linux-c6-tk85-8.5.7_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by linux-c6-tk85-8.5.7_1 for building
===>  Extracting for linux-c6-tk85-8.5.7_1
=> SHA256 Checksum OK for rpm/i686/centos/6.6/tk-8.5.7-5.el6.i686.rpm.
./usr/share/man/mann/tk_getSaveFile.n.gz: Can't create 'usr/share/man/mann/tk_getSaveFile.n.gz'
./usr/share/man/mann/tk_focusPrev.n.gz: Can't create 'usr/share/man/mann/tk_focusPrev.n.gz'
./usr/share/man/mann/tk_setPalette.n.gz: Can't create 'usr/share/man/mann/tk_setPalette.n.gz'
./usr/share/man/mann/tk_menuBar.n.gz: Can't create 'usr/share/man/mann/tk_menuBar.n.gz'
./usr/share/man/mann/tk_textPaste.n.gz: Can't create 'usr/share/man/mann/tk_textPaste.n.gz'
./usr/share/man/mann/tk_menuSetFocus.n.gz: Can't create 'usr/share/man/mann/tk_menuSetFocus.n.gz'
tar: Error exit delayed from previous errors.
*** Error code 1

Stop.
make: stopped in /usr/ports/x11-toolkits/linux-c6-tk85
server% sudo make clean
===>  Cleaning for linux-c6-tk85-8.5.7_1
server% sudo make      
===>   linux-c6-tk85-8.5.7_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by linux-c6-tk85-8.5.7_1 for building
===>  Extracting for linux-c6-tk85-8.5.7_1
=> SHA256 Checksum OK for rpm/i686/centos/6.6/tk-8.5.7-5.el6.i686.rpm.
===>  Patching for linux-c6-tk85-8.5.7_1
===>  Configuring for linux-c6-tk85-8.5.7_1
===>  Staging for linux-c6-tk85-8.5.7_1
===>   linux-c6-tk85-8.5.7_1 depends on file: /compat/linux/bin/sh - found
===>   linux-c6-tk85-8.5.7_1 depends on file: /compat/linux/lib/libexpat.so.1 - found
===>   linux-c6-tk85-8.5.7_1 depends on file: /compat/linux/usr/lib/libfontconfig.so.1.4.4 - found
===>   linux-c6-tk85-8.5.7_1 depends on file: /compat/linux/usr/lib/libXrandr.so.2.2.0 - found
===>   Generating temporary packing list
cd /tank/obj/usr/ports/x11-toolkits/linux-c6-tk85/work && /usr/bin/find * ! -path "stage*" -type d -exec /bin/mkdir -p "/tank/obj/usr/ports/x11-toolkits/linux-c6-tk85/work/stage/compat/linux/{}" \;
cd /tank/obj/usr/ports/x11-toolkits/linux-c6-tk85/work && /usr/bin/find * ! -path "stage/*" ! -type d | /usr/bin/cpio -pm -R root:wheel /tank/obj/usr/ports/x11-toolkits/linux-c6-tk85/work/stage/compat/linux
6684 blocks
====> Compressing man pages (compress-man)
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-01 05:04:59 UTC
Auto-assigned to maintainer emulation@FreeBSD.org
Comment 2 Rene Ladan freebsd_committer freebsd_triage 2015-01-01 15:00:34 UTC
The distribution file is extracted with /usr/bin/tar ( make -V EXTRACT_CMD ) and that program does not seem to understand links, or the distribution file is malformed:

-r--r--r--  2 0      0           0 Nov 11  2010 ./usr/share/man/mann/tk_getOpenFile.n.gz
-r--r--r--  2 0      0        5182 Nov 11  2010 ./usr/share/man/mann/tk_getSaveFile.n.gz link to ./usr/share/man/mann/tk_getOpenFile.n.gz

Note the file sizes of the actual file (0) and the link (5182)
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2015-01-01 17:01:10 UTC
This may be a bug in libarchive / bsdtar
Comment 4 Johannes Jost Meixner freebsd_committer freebsd_triage 2015-01-27 20:58:11 UTC
*** Bug 197138 has been marked as a duplicate of this bug. ***
Comment 5 Matthias Andree freebsd_committer freebsd_triage 2015-03-25 23:45:45 UTC
(In reply to Rene Ladan from comment #2)
Not sure, but the file size and the link size are strange:

...
-r--r--r--  2 0      0           0 11 Nov  2010 ./usr/share/man/mann/tk_getOpenFile.n.gz
-r--r--r--  2 0      0        5182 11 Nov  2010 ./usr/share/man/mann/tk_getSaveFile.n.gz link to ./usr/share/man/mann/tk_getOpenFile.n.gz
...

we should see this instead (rpm2cpio ... | pax -v), the 5182 bytes attributed to the file, and the link gets 0-size:

-r--r--r--  1 root         wheel             5182 11 Nov  2010 ./usr/share/man/mann/tk_getOpenFile.n.gz
-r--r--r--  2 root         wheel                0 11 Nov  2010 ./usr/share/man/mann/tk_getSaveFile.n.gz == ./usr/share/man/mann/tk_getOpenFile.n.gz

or this (rpm2archive ... | tar tzvf -):

-r--r--r--  0 root   root     5182 11 Nov  2010 ./usr/share/man/mann/tk_getOpenFile.n.gz
hr--r--r--  0 root   root        0 11 Nov  2010 ./usr/share/man/mann/tk_getSaveFile.n.gz link to ./usr/share/man/mann/tk_getOpenFile.n.gz

however neither rpm2cpio nor rpm2cpio.pl generate archives that pax, cpio, tar could extract properly.  The man pages end up empty.


The workaround seems to be to use rpm2archive, gzip -cd and tar.
Comment 6 Matthias Andree freebsd_committer freebsd_triage 2015-03-25 23:46:28 UTC
Created attachment 154809 [details]
proposed workaround to enable build as unprivileged user, tested w/ poudriere for 9.3/10.1 amd64
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-03-25 23:58:18 UTC
A commit references this bug:

Author: mandree
Date: Wed Mar 25 23:57:32 UTC 2015
New revision: 382279
URL: https://svnweb.freebsd.org/changeset/ports/382279

Log:
  Fix build as unprivileged user.
  Add rpm4 as extract requisite, and use rpm2archive to get something that
  yields non-zero-sized manual pages.
  While here, clean up pkg-plist a bit.
  Bump PORTREVISION.

  PR:		196414
  Submitted by:	peterj
  Reviewed by:	xmj
  Approved by:	emulation (eadler)

Changes:
  head/x11-toolkits/linux-c6-tk85/Makefile
  head/x11-toolkits/linux-c6-tk85/pkg-plist
Comment 8 Matthias Andree freebsd_committer freebsd_triage 2015-03-25 23:58:27 UTC
Comment on attachment 154809 [details]
proposed workaround to enable build as unprivileged user, tested w/ poudriere for 9.3/10.1 amd64

approval received with the request to bump PORTREVISION on IRC from eadler
Comment 9 Matthias Andree freebsd_committer freebsd_triage 2015-03-26 00:00:40 UTC
(In reply to Rene Ladan from comment #2)
Someone should check the RPM.  Normally I'd expect to extract the contents first, and then create the 2nd filename (hard link) for the same inode, but apparently the distfile triggers these options in reverse order, and once we have the 0-sized mode 0444 file in place, cpio/tar can no longer write to the file because it can not open it for writing, and reports permission denied.