Bug 215150 - net/openntpd won't build - configure phase chmod not permitted
Summary: net/openntpd won't build - configure phase chmod not permitted
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Christian Weisgerber
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-08 12:17 UTC by Marko Cupać
Modified: 2016-12-14 16:39 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (naddy)


Attachments
poudriere log for failed openntpd build (186.38 KB, text/plain)
2016-12-08 12:25 UTC, Marko Cupać
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Cupać 2016-12-08 12:17:32 UTC
Hi,

a build of openntpd-6.0p1_2,2 fails in poudriere. The problem appears to be related to inability to chmod files in configure phase due to permissions.

I have attached poudriere log.

Thank you in advance,
Comment 1 Marko Cupać 2016-12-08 12:25:11 UTC
Created attachment 177796 [details]
poudriere log for failed openntpd build

Sorry I didn't check max attachment size, original log is more than 3Mb. I have deleted lots of lines in the middle.
Comment 2 Christian Weisgerber freebsd_committer 2016-12-08 18:00:03 UTC
This is very odd. The errors are from ${COPYTREE_SHARE} in pre-configure. This macro first copies a directory tree and then fixes up the permissions with chmod. But if it just created those files, why can't it change their permissions? Those commands run as the same user. Can you look at the actual directory trees and determine why the chmod fails?
Comment 3 Marko Cupać 2016-12-13 11:54:47 UTC
I'm fairly new to troubleshooting build issues, maybe I'm gonna need a little more guidance.

So far, I've done testport with:
`sudo poudriere testport -j 11:x86:64 -w -z server net/openntpd'

I don't have DEFAULT_VERSIONS+= ssl=libressl in jail's make conf - it used to be mandatory but if I'm not mistaken that's not the case anymore. I also have 'BUILD_AS_NON_ROOT=yes' in poudriere.conf

Build failed, this time I got the message on console:

chmod: ./share/licenses/libressl-2.4.4/LICENSE: Operation not permitted
*** Error code 1

Stop.
make: stopped in /usr/ports/net/openntpd
[00:01:27] ====>> Saved openntpd-6.0p1_2,2 wrkdir to: /home/poudriere/data/wrkdirs/11:x86:64-default-server/default/openntpd-6.0p1_2,2.tbz

I have extracted openntpd-6.0p1_2,2.tbz, and noticed that dirs are owned by nobody:wheel, but files are owned by root:wheel, eg.:

pacija@efreet:~/Desktop/work/libressl/share/licenses/libressl-2.4.4 % ls -alh
total 24
drwxr-xr-x  2 nobody  wheel   512B 13 dec 12:23 .
drwxr-xr-x  3 nobody  wheel   512B 13 dec 12:23 ..
-rw-r--r--  1 root    wheel   6,3K 13 dec 12:23 BSD4CLAUSE
-rw-r--r--  1 root    wheel   201B 13 dec 12:23 catalog.mk
-rw-r--r--  1 root    wheel    86B 13 dec 12:23 LICENSE

Perhaps this will give some more hints.

Do not hesitate to contact me for further testing, but take into account I'm just a sysadmin using this stuff, not writing it, so please give as detailed instruction as possible :)
Comment 4 Matthew Seaman freebsd_committer 2016-12-14 15:40:01 UTC
Is your build area on an NFS partition by any chance?

poudriere does run as root for parts of the build process so that it can manipulate file ownership and permissions.  This is defeated by the standard mapping of 'root' to 'nobody' on an NFS mount.
Comment 5 Mathieu Arnold freebsd_committer 2016-12-14 16:20:02 UTC
I see what the problem is, I'll try and see if I can fix it.
Comment 6 Mathieu Arnold freebsd_committer 2016-12-14 16:21:47 UTC
(Note that what the port is doing in order to be built when libressl is not the default was a bad idea to begin with)
Comment 7 Mathieu Arnold freebsd_committer 2016-12-14 16:25:31 UTC
The problem is that poudriere does all the builds as a regular user, except for installing dependencies, which are done as root.

So, it runs make stage in security/libressl as root, and then it complains it has trouble copying files that are owned by root as a regular user.
Comment 8 Mathieu Arnold freebsd_committer 2016-12-14 16:34:53 UTC
And because COPYTREE_SHARE uses cpio -dump*l* so it hard links files to save time and space, so the files in WRKDIR/libressl end up being owned by root.
Comment 9 commit-hook freebsd_committer 2016-12-14 16:39:12 UTC
A commit references this bug:

Author: mat
Date: Wed Dec 14 16:38:27 UTC 2016
New revision: 428572
URL: https://svnweb.freebsd.org/changeset/ports/428572

Log:
  Fix building when libressl is not the default.

  PR:		215150
  Sponsored by:	Absolight

Changes:
  head/net/openntpd/Makefile