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)
Auto-assigned to maintainer emulation@FreeBSD.org
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)
This may be a bug in libarchive / bsdtar
*** Bug 197138 has been marked as a duplicate of this bug. ***
(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.
Created attachment 154809 [details] proposed workaround to enable build as unprivileged user, tested w/ poudriere for 9.3/10.1 amd64
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 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
(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.