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: discard stderr when querying vcs tools #9523

Closed
josharian opened this issue Jan 6, 2015 · 5 comments
Closed

cmd/go: discard stderr when querying vcs tools #9523

josharian opened this issue Jan 6, 2015 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

My copy of rsc.io/x86 contained an hgrc that pointed to a copy of codereview.py that has moved. hg commands on rsc.io/x86 thus yielded warnings. The go command interpreted the warning as part of the output, leading to a spurious import path violation:

$ go get -u rsc.io/pprof_mac_fix
package rsc.io/pprof_mac_fix
    imports rsc.io/x86/x86asm: /Users/jbleechersnyder/go/src/rsc.io/x86 is from *** failed to import extension codereview from /Users/jbleechersnyder/src/go/tip/lib/codereview/codereview.py: [Errno 2] No such file or directory: '/Users/jbleechersnyder/src/go/tip/lib/codereview/codereview.py'
https://code.google.com/p/rsc.x86, should be from https://code.google.com/p/rsc.x86

The fix is probably to only use stdout, not stdout+stderr. I have confirmed that the warning came on stderr and the useful output on stdout.

@speter
Copy link

speter commented Jan 8, 2015

An even safer option might be to bail when stderr from the vcs command is non-empty.

@rsc rsc changed the title cmd/go: vcs warning leads to spurious vanity import violation cmd/go: discard stderr when querying vcs tools Apr 10, 2015
@rsc rsc added this to the Go1.5 milestone Apr 10, 2015
@bradfitz
Copy link
Contributor

bradfitz commented Jul 7, 2015

The problem is in:

// run1 is the generalized implementation of run and runOutput.                                                           
func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) {

... which merges stderr and stdout.

@rsc
Copy link
Contributor

rsc commented Jul 14, 2015

I'd like to fix this, but it's too late to be making fundamental changes like
separating stderr from stdout in these command invocations.
I just don't know what will break.

Possibly Brad's fix for #11381 will make this easier.

@rsc rsc modified the milestones: Go1.6, Go1.5 Jul 14, 2015
@rsc
Copy link
Contributor

rsc commented Dec 17, 2015

Missed this again.

@rsc rsc modified the milestones: Go1.7, Go1.6 Dec 17, 2015
@rsc rsc modified the milestones: Go1.8, Go1.7 May 17, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 6, 2016
@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

I think unless there are more instances of this problem, we can just leave this alone. Git seems not to have this particular problem, and I can only assume that the hg codereview extension is dying out.

Reopen if you have a case that you believe is still compelling.

Thanks.

@rsc rsc closed this as completed Oct 21, 2016
@golang golang locked and limited conversation to collaborators Oct 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants