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

net/http/cgi: TestEnvOverride fails with non-standard 'perl' command #27790

Closed
LeGEC opened this issue Sep 21, 2018 · 11 comments
Closed

net/http/cgi: TestEnvOverride fails with non-standard 'perl' command #27790

LeGEC opened this issue Sep 21, 2018 · 11 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@LeGEC
Copy link

LeGEC commented Sep 21, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/gvarouchas/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/gvarouchas/golib"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build117805775=/tmp/go-build -gno-record-gcc-switches"

Operating system is Ubuntu xenial 16.04.5

What did you do?

From the go source directory, run the tests for "net/http/cgi" package

What did you expect to see?

$ ../bin/go test net/http/cgi
ok net/http/cgi

What did you see instead?

# "../bin/go" is the built go command :
$ ../bin/go version
go version go1.11 linux/amd64

$ ../bin/go test net/http/cgi

2018/09/21 10:20:51 cgi: copy error: write tcp 127.0.0.1:33176->127.0.0.1:47778: write: connection reset by peer
/usr/bin/env: 'bash': No such file or directory
2018/09/21 10:20:51 cgi: no headers
--- FAIL: TestEnvOverride (0.00s)
    host_test.go:84: for key "env-REQUEST_URI" got ""; expected "/foo/bar"
    host_test.go:84: for key "env-PATH" got ""; expected "/wibble"
    host_test.go:84: for key "cwd" got ""; expected "/home/gvarouchas/go/src/net/http/cgi"
    host_test.go:84: for key "env-SCRIPT_FILENAME" got ""; expected "/home/gvarouchas/go/src/net/http/cgi/testdata/test.cgi"
2018/09/21 10:20:51 cgi: copy error: past write limit
2018/09/21 10:20:51 cgi: no headers
2018/09/21 10:20:51 cgi: missing required Content-Type in headers
2018/09/21 10:20:51 cgi: no headers
FAIL
FAIL	net/http/cgi	0.206s

I guess this issue is linked to the setup of my local machine (especially the "connection reset by peer" on a local connection), but I don't know where to start looking ?

@bcmills bcmills added the Testing An issue that has been verified to require only test changes, not just a test failure. label Sep 22, 2018
@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2018

CC @bradfitz

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 22, 2018
@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2018

Any idea whether it is also failing in 1.10?

@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2018

@dmitshur, do/should we have a Xenial builder?

@bcmills bcmills added this to the Go1.12 milestone Sep 22, 2018
@slb5427
Copy link

slb5427 commented Sep 22, 2018

@LeGEC I created a Xenial environment to try and reproduce, but was unable to. I used a fresh setup. Were you working on a change for net/http/cgi?
@bcmills I also tested agains go1.10.4 and still didn't see the issue.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 22, 2018
@agnivade
Copy link
Contributor

I am unable to reproduce it. Using 16.04 too. From the error, it looks like you don't have bash ? That is strange because ubuntu comes with bash.

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@LeGEC LeGEC changed the title Failing test for "net/http/cgi" on Ubuntu Xenial (16.04) Failing test for "net/http/cgi" ~~on Ubuntu Xenial (16.04)~~ when using non standard perl install Jun 13, 2019
@LeGEC LeGEC changed the title Failing test for "net/http/cgi" ~~on Ubuntu Xenial (16.04)~~ when using non standard perl install Failing test for "net/http/cgi" on Ubuntu Xenial (16.04) Jun 13, 2019
@LeGEC
Copy link
Author

LeGEC commented Jun 13, 2019

Ok, so I tried to update go from source, and tumbled on the same failing TestEnvOverride test, and I had a better look at it :

one line says :

perl, err = exec.LookPath("perl")

It turns out that, for work, we use perl, and we use plenv to wrap different versions of perl, so my perl command points to $HOME/.plenv/shims/perl, and apparently the environment of the process used to serve cgi does not match the excpectations of TestEnvOverride.

This issue with this test is not linked to Ubuntu Xenial (16.04), it is probably linked to a non standard perl installation.

If you are interested in narrowing the issue, I can try to investigate further, but I think I can leave this issue closed and live with it.

@LeGEC
Copy link
Author

LeGEC commented Jun 13, 2019

Should I update the issue's title ?

@bcmills bcmills reopened this Jun 13, 2019
@bcmills bcmills changed the title Failing test for "net/http/cgi" on Ubuntu Xenial (16.04) net/http/cgi: TestEnvOverride fails with non-standard 'perl' command Jun 13, 2019
@bcmills bcmills modified the milestones: Go1.12, Unplanned Jun 13, 2019
@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 13, 2019
@bcmills
Copy link
Contributor

bcmills commented Jun 13, 2019

@LeGEC, if you can reasonably update the test to work with your perl variant (or vice-versa), you're welcome to send a fix.

Since the rest of us don't have that wrapper, we can't test the potential fix against it — so I don't think anyone else will work on this if you don't.

@lufia
Copy link
Contributor

lufia commented Sep 26, 2019

Plenv's perl is implemented in bash script that starts with #!/usr/bin/env bash.
And TestEnvOverride sets PATH to /wibble.
Thus path to a perl command is resolved to points to plenv's perl in TestEnvOverride, but that perl can't find bash command because PATH is overwritten.

@gopherbot
Copy link

Change https://golang.org/cl/196845 mentions this issue: net/http/cgi: lookup perl from ordinary paths

@golang golang locked and limited conversation to collaborators Oct 1, 2020
@rsc rsc unassigned LeGEC Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

6 participants