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: TestDirWindows fails on Windows when perl is installed #63800

Closed
qiulaidongfeng opened this issue Oct 28, 2023 · 3 comments
Closed
Labels
help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@qiulaidongfeng
Copy link
Contributor

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

$ go version
tip

Does this issue reproduce with the latest release?

yes.

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

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=D:\tmp\go-build
set GOENV=C:\Users\26454\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\file\gofile\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\file\gofile
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\file\gofile\gogit\go1
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=local
set GOTOOLDIR=D:\file\gofile\gogit\go1\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.22-2968f56 Fri Oct 20 03:00:06 2023 +0000
set GCCGO=gccgo
set GOAMD64=v3
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\file\gofile\gogit\go1\src\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\26454\AppData\Local\Temp\go-build532945110=/tmp/go-build -gno-record-gcc-switches

What did you do?

Install Git-2.42.0.2-64-bit.exe,There's perl in here.
go test net/http/cgi

What did you expect to see?

test passed.

What did you see instead?

--- FAIL: TestDirWindows (0.16s)
    host_test.go:67: Unexpected response from invalid line number 25: "(c) Microsoft Corporation\xa1\xa3\xb1\xa3\xc1\xf4\xcb\xf9\xd3\xd0Ȩ\xc0\xfb\xa1\xa3\r\n"; existing map=map[_body:test=Hello CGI
        env-COMSPEC=C:\Windows\system32\cmd.exe
        env-GATEWAY_INTERFACE=CGI/1.1
        env-HOME=/c/Users/26454
        env-HTTP_HOST=example.com
        env-PATH=/d/file/gofile/gogit/go1/bin:/tmp/system32:/tmp:/tmp/System32/Wbem:/tmp/System32/WindowsPowerShell/v1.0:/tmp/System32/OpenSSH:/d/file/gofile/bin:/c/Users/26454/.go/current/bin:/d/cloc:/bin:/usr/bin:/d/goup:/d/Graphviz/bin:/d/pandoc:/d/mingw64/bin:/c/Users/26454/AppData/Local/Microsoft/WindowsApps:/c/Users/26454/AppData/Local/GitHubDesktop/bin
        env-PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
        env-PATH_INFO=
        env-QUERY_STRING=
        env-REMOTE_ADDR=1.2.3.4
        env-REMOTE_HOST=1.2.3.4
        env-REMOTE_PORT=1234
        env-REQUEST_METHOD=GET
        env-REQUEST_URI=/test.cgi
        env-SCRIPT_FILENAME=D:\file\gofile\gogit\go1\src\net\http\cgi\testdata\test.cgi
        env-SCRIPT_NAME=/test.cgi
        env-SERVER_NAME=example.com
        env-SERVER_PORT=80
        env-SERVER_PROTOCOL=HTTP/1.1
        env-SERVER_SOFTWARE=go
        env-SYSTEMROOT=C:\Windows
        env-TERM=xterm-256color
        env-WINDIR=C:\Windows
        cwd=Microsoft Windows [�汾 10.0.22621.2428]
        (c) Microsoft Corporation����������Ȩ����

        D:\file\gofile\gogit\go1\src\net\http\cgi>
         cwd:Microsoft Windows [�汾 10.0.22621.2428] env-COMSPEC:C:\Windows\system32\cmd.exe env-GATEWAY_INTERFACE:CGI/1.1 env-HOME:/c/Users/26454 env-HTTP_HOST:example.com env-PATH:/d/file/gofile/gogit/go1/bin:/tmp/system32:/tmp:/tmp/System32/Wbem:/tmp/System32/WindowsPowerShell/v1.0:/tmp/System32/OpenSSH:/d/file/gofile/bin:/c/Users/26454/.go/current/bin:/d/cloc:/bin:/usr/bin:/d/goup:/d/Graphviz/bin:/d/pandoc:/d/mingw64/bin:/c/Users/26454/AppData/Local/Microsoft/WindowsApps:/c/Users/26454/AppData/Local/GitHubDesktop/bin env-PATHEXT:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL env-PATH_INFO: env-QUERY_STRING: env-REMOTE_ADDR:1.2.3.4 env-REMOTE_HOST:1.2.3.4 env-REMOTE_PORT:1234 env-REQUEST_METHOD:GET env-REQUEST_URI:/test.cgi env-SCRIPT_FILENAME:D:\file\gofile\gogit\go1\src\net\http\cgi\testdata\test.cgi env-SCRIPT_NAME:/test.cgi env-SERVER_NAME:example.com env-SERVER_PORT:80 env-SERVER_PROTOCOL:HTTP/1.1 env-SERVER_SOFTWARE:go env-SYSTEMROOT:C:\Windows env-TERM:xterm-256color env-WINDIR:C:\Windows test:Hello CGI]
2023/10/28 19:33:32 cgi: copy error: past write limit
2023/10/28 19:33:32 cgi: no headers
2023/10/28 19:33:32 cgi: missing required Content-Type in headers
2023/10/28 19:33:32 cgi: no headers
FAIL
exit status 1
FAIL    net/http/cgi    2.277s
@mauri870 mauri870 added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 28, 2023
@bcmills
Copy link
Contributor

bcmills commented Oct 30, 2023

It looks like this comes from a bad Perl script here:
https://cs.opensource.google/go/go/+/master:src/net/http/cgi/testdata/test.cgi;l=50-62;drc=45d334ecf1b2bcbf0f8667d4c772ef3db0e03587

(attn @golang/windows)

@bcmills bcmills added this to the Backlog milestone Oct 30, 2023
@bcmills bcmills added the Testing An issue that has been verified to require only test changes, not just a test failure. label Oct 30, 2023
@bcmills bcmills changed the title net/http/cgi: TestDirWindows fail net/http/cgi: TestDirWindows fails on Windows when perl is installed Oct 30, 2023
@bcmills
Copy link
Contributor

bcmills commented Oct 30, 2023

Perhaps the test's Perl script could be fixed, but I think it would be better still to rewrite the test CGI handler in Go, for which I have filed #63828.

aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some of its tests,
which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped on builders
without Perl installed.
However, this reliance on Perl made it more challenging for Go maintainers
to review and maintain the code since not everyone was familiar with Perl.

To address this issue and improve maintainability, I have removed the dependency
on Perl in the tests.
Instead, the tests now build a handler written in Go, ensuring consistent behavior
across different environments.

This change aligns with previous efforts to minimize or eliminate the use of
Perl in various parts of the Go codebase golang#20032,golang#25586,golang#25669,golang#27779. By eliminating
the Perl script from net/http/cgi tests, we can enhance the reliability and ease
of maintenance for these tests going forward.

Fixes golang#63800
Fixes golang#63828
@gopherbot
Copy link

Change https://go.dev/cl/538861 mentions this issue: net/http/cgi: eliminate use of Perl in tests

qiulaidongfeng pushed a commit to qiulaidongfeng/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some of its tests,
which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped on builders
without Perl installed.
However, this reliance on Perl made it more challenging for Go maintainers
to review and maintain the code since not everyone was familiar with Perl.

To address this issue and improve maintainability, I have removed the dependency
on Perl in the tests.
Instead, the tests now build a handler written in Go, ensuring consistent behavior
across different environments.

This change aligns with previous efforts to minimize or eliminate the use of
Perl in various parts of the Go codebase golang#20032,golang#25586,golang#25669,golang#27779. By eliminating
the Perl script from net/http/cgi tests, we can enhance the reliability and ease
of maintenance for these tests going forward.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: b652d18
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some of its tests,
which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped on builders
without Perl installed.
However, this reliance on Perl made it more challenging for Go maintainers
to review and maintain the code since not everyone was familiar with Perl.

To address this issue and improve maintainability, I have removed the dependency
on Perl in the tests.
Instead, the tests now build a handler written in Go, ensuring consistent behavior
across different environments.

This change aligns with previous efforts to minimize or eliminate the use of
Perl in various parts of the Go codebase golang#20032,golang#25586,golang#25669,golang#27779. By eliminating
the Perl script from net/http/cgi tests, we can enhance the reliability and ease
of maintenance for these tests going forward.

Fixes golang#63800
Fixes golang#63828
aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some of its
tests, which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped on builders
without Perl installed.
However, this reliance on Perl made it more challenging for Go maintainers
to review and maintain the code since not everyone was familiar with Perl.

To address this issue and improve maintainability,
I have removed the dependency on Perl in the tests.
Instead, the tests now build a handler written in Go, ensuring consistent
behavior across different environments.

This change aligns with previous efforts to minimize or eliminate
the use of Perl in various parts of the  Go codebase
golang#20032,golang#25586,golang#25669,golang#27779.
By eliminating the Perl script from net/http/cgi tests, we can enhance
the reliability and ease of maintenance for these tests going forward.

Fixes golang#63800
Fixes golang#63828
aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some
of its tests,
which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped
on builders without Perl installed.
However, this reliance on Perl made it more challenging
for Go maintainers to review and maintain the code since not
everyone was familiar with Perl.

To address this issue and improve maintainability,
I have removed the dependency on Perl in the tests.
Instead, the tests now build a handler written in Go,
ensuring consistent behavior across different environments.

This change aligns with previous efforts to minimize or eliminate
the use of Perl in various parts of the Go codebase
By eliminating the Perl script from net/http/cgi tests,
we can enhance the reliability and ease of maintenance for
these tests going forward.

Fixes golang#63800
Fixes golang#63828
aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
The net/http/cgi package previously relied on a Perl script for some
of its tests,
which caused sporadic failures due to bugs in the Perl script.
These failures were often masked because the tests were skipped
on builders without Perl installed.
However, this reliance on Perl made it more challenging
for Go maintainers to review and maintain the code since not
everyone was familiar with Perl.

To address this issue and improve maintainability,
I have removed the dependency on Perl in the tests.
Instead, the tests now build a handler written in Go,
ensuring consistent behavior across different environments.

This change aligns with previous efforts to minimize or eliminate
the use of Perl in various parts of the Go codebase
By eliminating the Perl script from net/http/cgi tests,
we can enhance the reliability and ease of maintenance for
these tests going forward.

Fixes golang#63800
Fixes golang#63828
aimuz added a commit to aimuz/go that referenced this issue Nov 1, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 2, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 3, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 3, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 4, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 7, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
aimuz added a commit to aimuz/go that referenced this issue Nov 7, 2023
Previously, a Perl script was used to test the net/http/cgi package.
This sometimes led to hidden failures as these tests were not run
on builders without Perl.
Also, this approach posed maintenance difficulties for those
unfamiliar with Perl.

We have now replaced Perl-based tests with a Go handler to simplify
maintenance and ensure consistent testing environments.
It's part of our ongoing effort to reduce reliance on Perl throughout
the Go codebase (see golang#20032,golang#25586,golang#25669,golang#27779),
thus improving reliability and ease of maintenance.

Fixes golang#63800
Fixes golang#63828

Change-Id: I8d554af93d4070036cf0cc3aaa9c9b256affbd17
GitHub-Last-Rev: c44cd69
GitHub-Pull-Request: golang#63869
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants