Skip to content

Install script unable to find on windows + latest curl (v8.8.0) #4813

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

Closed
6 of 7 tasks
Adjective-Object opened this issue Jun 11, 2024 · 2 comments · Fixed by #4814
Closed
6 of 7 tasks

Install script unable to find on windows + latest curl (v8.8.0) #4813

Adjective-Object opened this issue Jun 11, 2024 · 2 comments · Fixed by #4814
Assignees
Labels
area: install Issue relates to installation or downloading process bug Something isn't working dependencies Relates to an upstream dependency platform: windows Issue that is related to Windows

Comments

@Adjective-Object
Copy link

Adjective-Object commented Jun 11, 2024

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

Installation of golangci-lint is failing in one of my project's windows CI.

This reproduces for all requested installed versions, including latest.

I did some digging in by downloading the install script and adding some debug statements; it looks like the problem comes down to the use of curl -w in http_download_curl:

$ curl -w '%{http_code}' -sL -H "$header" https://github.com/golangci/golangci-lint/releases/v1.59.1
000

The same curl command works without -w, and 000 isn't a valid response code. I did some poking around:

$ curl -w '%{json}' -sL -H "$header" https://github.com/golangci/golangci-lint/releases/v1.59.1
{"certs":"Subject:CN=github.com\nIssuer:C=GB, ST=Greater Manchester, L=Salford, O=Sectigo Limited, CN=Sectigo ECC Domain Validation Secure Server CA\nVersion:2\nSerial Number:4e:28:f7:86:b6:6c:1a:3b:94:2c:d2:c4:0e:b7:42:a5:\n","content_type":null,"conn_id":0,"errormsg":"A libcurl function was given a bad argument","exitcode":43,"filename_effective":null,"ftp_entry_path":null,"http_code":0,"http_connect":0,"http_version":"0","local_ip":"172.20.20.20","local_port":55312,"method":"GET","num_certs":3,"num_connects":1,"num_headers":0,"num_redirects":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"140.82.112.3","remote_port":443,"response_code":0,"scheme":"https","size_download":0,"size_header":0,"size_request":0,"size_upload":0,"speed_download":0,"speed_upload":0,"ssl_verify_result":0,"time_appconnect":0.000000,"time_connect":0.131360,"time_namelookup":0.035237,"time_pretransfer":0.000000,"time_redirect":0.000000,"time_starttransfer":0.000000,"time_total":0.232505,"url":"https://github.com/golangci/golangci-lint/releases/v1.59.1","url.scheme":"https","url.user":null,"url.password":null,"url.options":null,"url.host":"github.com","url.port":"443","url.path":"/golangci/golangci-lint/releases/v1.59.1","url.query":null,"url.fragment":null,"url.zoneid":null,"urle.scheme":"https","urle.user":null,"urle.password":null,"urle.options":null,"urle.host":"github.com","urle.port":"443","urle.path":"/golangci/golangci-lint/releases/v1.59.1","urle.query":null,"urle.fragment":null,"urle.zoneid":null,"url_effective":"https://github.com/golangci/golangci-lint/releases/v1.59.1","urlnum":0,"xfer_id":0,"curl_version":"libcurl/8.8.0 Schannel zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0"}

And it's failing with A libcurl function was given a bad argument

This looks to be rooted in this issue in libcurl, as I'm also on curl 8.8.0, and I'm assuming github is as well from the other issues citing the linked issue.

curl/curl#13845

Unfortunately 8.8.0 is the latest release of curl so there's not an easy workaround, and I expect you will be getting similar issues soon.

I've worked around this in our CI with this snippet:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sed "s/-w '%{http_code}'//g" | sed 's/\[ "\$code" != "200" \]/[ "$?" != "0" ]/g' | sh -s -- -b $(go env GOPATH)/bin v1.59.1

The http_download_curl function in the install script should probably be updated to work around this bug by only checking the exit code when curl's version is 8.8.0.

Version of golangci-lint

N/A

Configuration

N/A

Go environment

$ go version && go env
go version go1.22.2 windows/amd64
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\mahuangh\AppData\Local\go-build
set GOENV=C:\Users\mahuangh\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\mahuangh\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\mahuangh\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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\mahuangh\AppData\Local\Temp\go-build4117220378=/tmp/go-build -gno-record-gcc-switches

Verbose output of running

N/A

A minimal reproducible example or link to a public repository

$ bash -c 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/d681d93d0ff9e4f55b14ec66937b98b8a0918287/install.sh | sh -s -- -b $(go env GOPATH)/bin latest'
golangci/golangci-lint info checking GitHub for tag 'latest'
golangci/golangci-lint crit unable to find 'latest' - use 'latest' or see https://github.com/golangci/golangci-lint/releases for details

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

@Adjective-Object Adjective-Object added the bug Something isn't working label Jun 11, 2024
Copy link

boring-cyborg bot commented Jun 11, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@Adjective-Object Adjective-Object changed the title Install script unable to find on windows Install script unable to find on windows + curl v8.8.0 Jun 11, 2024
@Adjective-Object Adjective-Object changed the title Install script unable to find on windows + curl v8.8.0 Install script unable to find on windows + latest curl (v8.8.0) Jun 11, 2024
@ldez ldez added area: install Issue relates to installation or downloading process platform: windows Issue that is related to Windows labels Jun 11, 2024
@ldez ldez self-assigned this Jun 11, 2024
@ldez
Copy link
Member

ldez commented Jun 11, 2024

Hello,

the problem seems related to curl and a fix has been merged curl/curl@eacec9a (curl/curl#13857)

@ldez ldez added the dependencies Relates to an upstream dependency label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: install Issue relates to installation or downloading process bug Something isn't working dependencies Relates to an upstream dependency platform: windows Issue that is related to Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants