Bug 226039 - sysutils/beats cgo.a: permission denied
Summary: sysutils/beats cgo.a: permission denied
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: Palle Girgensohn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-19 11:26 UTC by Eugene V. Lyapin
Modified: 2018-03-02 17:21 UTC (History)
2 users (show)

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


Attachments
build log for beats-6.2.1 (10.20 KB, text/plain)
2018-02-19 11:26 UTC, Eugene V. Lyapin
no flags Details
go-1.10 build log (9.96 KB, text/plain)
2018-02-19 12:13 UTC, Eugene V. Lyapin
no flags Details
Patch to fix core golang lib overwrite (415 bytes, patch)
2018-03-02 11:31 UTC, Steven Hartland
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene V. Lyapin 2018-02-19 11:26:19 UTC
Created attachment 190789 [details]
build log for beats-6.2.1

I tried to build port sysutils/beats, but got build error:

===>  Building for beats-6.2.1
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.2.1/filebeat'
go build -i
go build runtime/cgo: open /usr/local/go/pkg/freebsd_amd64/runtime/cgo.a: permission denied
gmake[1]: *** [../libbeat/scripts/Makefile:95: filebeat] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.2.1/filebeat'
*** Error code 2

Stop.
make: stopped in /usr/ports/sysutils/beats

portsree: 18.02.2018
Comment 1 Palle Girgensohn freebsd_committer freebsd_triage 2018-02-19 11:31:01 UTC
Hello,

I saw this from the exp-run, but cannot reproduce it. What version of FreeBSD are you running?

Which version of GO is installed?

$ ls -l /usr/local/go/pkg/freebsd_amd64/runtime/cgo.a
-rw-r--r--  1 root  wheel  30730 nov. 11 00:16 /usr/local/go/pkg/freebsd_amd64/runtime/cgo.a
$ pkg which  /usr/local/go/pkg/freebsd_amd64/runtime/cgo.a
/usr/local/go/pkg/freebsd_amd64/runtime/cgo.a was installed by package go-1.9.2,1


What the permission mode of cgo.a on your system?

Best regards,
Palle
Comment 2 Palle Girgensohn freebsd_committer freebsd_triage 2018-02-19 11:47:14 UTC
It *looks* like something is bad in the new go-1.10. @jlaffaye do you have any idea why building beats get permission denied for cgo.a ?

Palle
Comment 3 Eugene V. Lyapin 2018-02-19 12:12:10 UTC
Hello Palle,

I built it by poudriere in standard environment, jail was created automatically, no special permissions was made, go-1.10 built by dependencies from this portstree (18.02.2018) with no errors.
Comment 4 Eugene V. Lyapin 2018-02-19 12:13:05 UTC
Created attachment 190790 [details]
go-1.10 build log
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-02-19 14:10:27 UTC
A commit references this bug:

Author: girgen
Date: Mon Feb 19 14:09:36 UTC 2018
New revision: 462321
URL: https://svnweb.freebsd.org/changeset/ports/462321

Log:
  Mark port as broken since it overwrites files from go-1.10

  PR:	226039

Changes:
  head/sysutils/beats/Makefile
Comment 6 Palle Girgensohn freebsd_committer freebsd_triage 2018-02-19 14:47:08 UTC
I see now, with an up to date ports tree, it overwrites files in 

/usr/local/go/pkg/freebsd_386/
/usr/local/go/pkg/freebsd_386/
/usr/local/go/pkg/freebsd_386/

that are owned by go-1.10.

I'm setting the port as broken until I find a way to fix this.

Palle
Comment 7 Palle Girgensohn freebsd_committer freebsd_triage 2018-02-19 14:53:04 UTC
I have narrowed this down to the go-1.9.x -> go 1.10 update

With go-1.9.4,1 it works fine:

$ pwd; svn switch ^/head/lang/go@461268 
/usr/ports/lang/go
At revision 461268.
$


but with go-1.10, it fails. It seems like something in the go build toolchain makes some atrange decisions? jlaffaye@, do you have any ideas?

poudriere testport sysutils/beats # fails

but

cd /usr/ports/lang/go; svn switch ^/head/lang/go@461268 ; poudriere testport sysutils/beats # works

since the port rewrites files in /usr/local/go/pkg/freebsd_386/ that are owned by go. There is notghin in the build description AFAIKS that makes the beats port do this, so my suspicion is that something changed in lang/go version 1.10.

Palle
Comment 8 Palle Girgensohn freebsd_committer freebsd_triage 2018-02-19 14:56:39 UTC
just for reference, poudriere finds this problem with the build_fs_violation target:

===>  Building for beats-6.1.2
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/filebeat'
go build -i
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/filebeat'
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/heartbeat'
go build -i
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/heartbeat'
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/metricbeat'
go build -i
# _/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/metricbeat
cc: warning: argument unused during compilation: '-nopie'
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/metricbeat'
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/packetbeat'
go build -i
# _/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/packetbeat
cc: warning: argument unused during compilation: '-nopie'
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.1.2/packetbeat'
===========================================================================
=>> Checking for filesystem violations... done
=>> Error: Filesystem touched during build:
usr/local/go/pkg/freebsd_386/net.a:
        size (1140462, 1128886)
usr/local/go/pkg/freebsd_386/runtime/cgo.a:
        size (36088, 16646)
usr/local/go/pkg/freebsd_386/os/user.a:
        size (94840, 81780)
build of sysutils/beats | beats-6.1.2 ended at Mon Feb 19 15:39:28 CET 2018
build time: 00:01:16
!!! build failure encountered !!!
[00:01:20] Error: Build failed in phase: build_fs_violation
[00:01:20] Cleaning up
103i386-default: removed
103i386-default-n: removed
[00:01:22] Unmounting file systems
Comment 9 Steven Hartland freebsd_committer freebsd_triage 2018-03-02 11:31:25 UTC
Created attachment 191130 [details]
Patch to fix core golang lib overwrite

The problem is that the beats libbeat Makefile has:
GOBUILD_FLAGS?=-i

This make it run "go build -i" instead of just "go build" hence the issue.

Setting GOBUILD_FLAGS="" prevents the install.
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-03-02 14:55:40 UTC
A commit references this bug:

Author: girgen
Date: Fri Mar  2 14:55:27 UTC 2018
New revision: 463408
URL: https://svnweb.freebsd.org/changeset/ports/463408

Log:
  Update to  6.2.2

  Fix the broken build with help from Steven Hartland.

  PR:		226039
  Submitted by:	Steven Hartland

Changes:
  head/sysutils/beats/Makefile
  head/sysutils/beats/distinfo