Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: do not recompile packages outside current root #3149

Closed
dlintw opened this issue Feb 28, 2012 · 18 comments
Closed

cmd/go: do not recompile packages outside current root #3149

dlintw opened this issue Feb 28, 2012 · 18 comments
Milestone

Comments

@dlintw
Copy link

dlintw commented Feb 28, 2012

What steps will reproduce the problem?
1. GOROOT=/opt/go # I install go as readonly like general C/C++/java system library
2. GOPATH=$HOME/go  # here I put my 3rd party packages
3. go get -x -u github.com/dlintw/goconf

What is the expected output?
OK

What do you see instead?
open /opt/go/pkg/linux_amd64/runtime.a: permission denied

Which compiler are you using (5g, 6g, 8g, gccgo)?
go

Which operating system are you using?
Archlinux x86_64

Which revision are you using?  (hg identify)
1c2e5d6d7660

Please provide any additional information below.

I found it is required to have write permission on these files under
/opt/go/pkg/linux_amd64:
math.a runtime.a sort.a unicode.a unicode/utf8.a
@robpike
Copy link
Contributor

robpike commented Feb 28, 2012

Comment 1:

Don't you need write permission as a rule when writing to system directories?

@dlintw
Copy link
Author

dlintw commented Feb 28, 2012

Comment 2:

In this case github.com/dlintw/goconf is installed into $HOME/go instead of /opt/go.
I don't understand why it require /opt/go write permission.
As a linux distribution package maker, I think the installed package should NOT be
changed by user.  Just like gcc/java system library.
But, if user want their 3rd party package, they can use GOPATH to include their local
packages.
So, for normal user, it is not necessary to have write permission to system library (I
mean in my case /opt/go)
The build script of go-hg is put on https://aur.archlinux.org/packages/go/go-hg/PKGBUILD

@rsc
Copy link
Contributor

rsc commented Feb 28, 2012

Comment 3:

This is a known bug.  I can't find it on the issue tracker so renaming
to match what we're going to fix.

Labels changed: added priority-go1, removed priority-triage.

Owner changed to builder@golang.org.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Mar 1, 2012

Comment 4:

This issue was closed by revision b03a5f6.

Status changed to Fixed.

@peterh
Copy link

peterh commented Mar 1, 2012

Comment 5:

Re comment 3, I reported this issue in reply to 1739 "Make goinstall work without
mingw". Perhaps that is what you are thinking of.

@rsc
Copy link
Contributor

rsc commented Mar 1, 2012

Comment 6:

Thanks!

@dlintw
Copy link
Author

dlintw commented Mar 2, 2012

Comment 7:

I've tested on 8592a2140513,
This problem still exist.
GOPATH=$home/go
GOROOT=/opt/go
$go get -x -u github.com/ajstarks/svgo
...
cp $WORK/obj/runtime.a $GOROOT/pkg/linux_amd64/runtime.a
open /opt/go/pkg/linux_amd64/runtime.a: permission denied

@rsc
Copy link
Contributor

rsc commented Mar 2, 2012

Comment 8:

What does go list -json github.com/ajstarks/svgo say?

@dlintw
Copy link
Author

dlintw commented Mar 3, 2012

Comment 9:

$go list -json github.com/ajstarks/svgo
{
    "Dir": "/home/dlin/go/src/github.com/ajstarks/svgo",
    "ImportPath": "github.com/ajstarks/svgo",
    "Name": "svg",
    "Doc": "Package svg provides an API for generating Scalable Vector Graphics (SVG)",
    "Target": "/home/dlin/go/pkg/linux_amd64/github.com/ajstarks/svgo.a",
    "Stale": true,
    "Root": "/home/dlin/go",
    "GoFiles": [
        "svg.go"
    ],
    "Imports": [
        "encoding/xml",
        "fmt",
        "io",
        "strings"
    ],
    "Deps": [
        "bufio",
        "bytes",
        "encoding/xml",
        "errors",
        "fmt",
        "io",
        "math",
        "os",
        "reflect",
        "runtime",
        "strconv",
        "strings",
        "sync",
        "sync/atomic",
        "syscall",
        "time",
        "unicode",
        "unicode/utf8",
        "unsafe"
    ]
}

@gopherbot
Copy link

Comment 10 by salviati@freeconsole.org:

I don't think this bug is fixed; I'm having the problem here (using ArchLinux). go
install gives
...
cp $WORK/runtime.a $GOROOT/pkg/linux_amd64/runtime.a
open /opt/go/pkg/linux_amd64/runtime.a: permission denied
for a package under $GOPATH/src. (go version weekly.2012-03-04 +2bc5447d7858)

@gopherbot
Copy link

Comment 11 by salviati.gnu:

I don't think this bug is fixed; I'm having the problem here (using ArchLinux). go
install gives
...
cp $WORK/runtime.a $GOROOT/pkg/linux_amd64/runtime.a
open /opt/go/pkg/linux_amd64/runtime.a: permission denied
for a package under $GOPATH/src. (go version weekly.2012-03-04 +2bc5447d7858)

@dlintw
Copy link
Author

dlintw commented Mar 6, 2012

Comment 12:

I've tried touch solution, it can NOT work.
r=$GOROOT/bin/go
find $GOROOT/pkg/ -name "*.a" -exec touch -r $r {} \;

@dlintw
Copy link
Author

dlintw commented Mar 6, 2012

Comment 13:

About the subject of this issue,
"cmd/go: do not recompile packages outside current root"
is not provide by me.
I think it will be better if change to
"cmd/go: do not recompile packages in $GOROOT if $GOPATH provide"

@dlintw
Copy link
Author

dlintw commented Mar 7, 2012

Comment 14:

I solved it by 
sudo go install std
But, if it can just copy the library without do such thing is better.

@gopherbot
Copy link

Comment 15 by meetkraju:

This issue bite me today. 
Fortunate that i found this issue page and solved by sudo go install std.
I think at least this issue should be reopened to remind.

@rsc
Copy link
Contributor

rsc commented Aug 3, 2012

Comment 16:

Can you say what directory you are in and what 'go list -json' prints
in that directory? What package does the go command want to install?
Can you also try 'go list -json <that-package>'?
If you are inside $GOROOT then go install should install the standard
packages. If you are outside $GOROOT it should not, unless they are
not present at all.
Russ

@gopherbot
Copy link

Comment 17 by breeze773:

Which version was this foxed in?  I'm currently using the 1.0.3 release and coming
across this issue with the released OS X pkg.

@adg
Copy link
Contributor

adg commented Mar 22, 2013

Comment 18:

@breeze773: try building from source at tip: http://golang.org/doc/install/source

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants