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: 'Filename too long' when cloning a repo into the module cache #46692

Closed
bcmills opened this issue Jun 10, 2021 · 2 comments
Closed

cmd/go: 'Filename too long' when cloning a repo into the module cache #46692

bcmills opened this issue Jun 10, 2021 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jun 10, 2021

TestScript/mod_convert fails on Windows when starting from a clean module cache, due to a Filename too long error when cloning a Git repository.

    --- FAIL: TestScript/mod_convert (167.75s)
        script_test.go:252:
            > [short] skip
            > [!net] skip
            > [!exec:git] skip
            > env GO111MODULE=on
            > env GOPROXY=
            > env GOSUMDB=
            > go mod download github.com/docker/distribution@v0.0.0-20150410205453-85de3967aa93
            > mkdir x/Godeps
            > cp $GOPATH/pkg/mod/github.com/docker/distribution@v0.0.0-20150410205453-85de3967aa93/Godeps/Godeps.json x/Godeps
            > cd x
            $WORK\gopath\src\x
            > go mod init github.com/docker/distribution
            [stderr]
            go: creating new go.mod: module github.com/docker/distribution
…
            go: converting Godeps\Godeps.json: stat github.com/MSOpenTech/azure-sdk-for-go/storage@d90753bcad2ed782fcead7392d1e831df29aa2bb: github.com/MSOpenTech/azure-sdk-for-go/storage@d90753bcad2ed782fcead7392d1e831df29aa2bb: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in $WORK\gopath\pkg\mod\cache\vcs\554a64a2fb0fb08170d1660c0d3aa6fdd6c397908453fe3dffa37224977b38b5: exit status 1:
                From https://github.com/MSOpenTech/azure-sdk-for-go
…
                 * [new branch]          sync-eng/common-draft-pr-support-1488 -> origin/sync-eng/common-draft-pr-support-1488
72/script-mod_convert/gopath/pkg/mod/cache/vcs/554a64a2fb0fb08170d1660c0d3aa6fdd6c397908453fe3dffa37224977b38b5/./refs/remotes/origin/sync-eng/common-feature/skip_feature_branch_apireview-1483.lock': Filename too long
…
            > cmpenv go.mod go.mod.want
            [diff -go.mod +go.mod.want]
             module github.com/docker/distribution

             go 1.17

             require (
                github.com/AdRoll/goamz v0.0.0-20150130162828-d3664b76d905
            +   github.com/MSOpenTech/azure-sdk-for-go v0.0.0-20150323223030-d90753bcad2e
                github.com/Sirupsen/logrus v0.7.3
                github.com/bugsnag/bugsnag-go v1.0.3-0.20141110184014-b1d153021fcd
                github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b
                github.com/codegangsta/cli v1.4.2-0.20150131031259-6086d7927ec3
                github.com/docker/docker v1.4.2-0.20150204013315-165ea5c158cf
                github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1
                github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7
                github.com/gorilla/context v0.0.0-20140604161150-14f550f51af5
                github.com/gorilla/handlers v0.0.0-20140825150757-0e84b7d810c1
                github.com/gorilla/mux v0.0.0-20140926153814-e444e69cbd2e
                github.com/jlhawn/go-crypto v0.0.0-20150401213827-cd738dde20f0
                github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43
                github.com/yvasiyarov/gorelic v0.0.7-0.20141212073537-a9bba5b9ab50
                github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f
                golang.org/x/net v0.0.0-20150202051010-1dfe7915deaf
                gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789
                gopkg.in/yaml.v2 v2.0.0-20150116202057-bef53efd0c76
             )

The error occurs when creating a file for a branch that is not actually needed by the test, so the test passes on subsequent runs. However, a similar error could occur for users.

This error may have been suppressed before CL 297950 (for #42751), so this might be a regression in Go 1.17.

CC @jayconrod @matloob @kevinburkemeter

@bcmills bcmills added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jun 10, 2021
@bcmills bcmills added this to the Go1.17 milestone Jun 10, 2021
@bcmills bcmills self-assigned this Jun 10, 2021
@bcmills
Copy link
Contributor Author

bcmills commented Jun 11, 2021

From https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows, I think this is arguably a bug in git, and it seems to have a workaround that can be applied by improving the system's Git configuration:

git config --system core.longpaths true

Closing as not a Go issue, but perhaps a usability wrinkle that we should document. (If we get many user reports about this, we can consider applying a local workaround within the Git repos in the module cache.)

@bcmills
Copy link
Contributor Author

bcmills commented Nov 7, 2023

We ended up explicitly setting core.longpaths in https://go.dev/cl/482819 (Go 1.21).

@bcmills bcmills modified the milestones: Go1.17, Go1.21 Nov 7, 2023
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants