Consensys/gnark-crypto

bug: cannot use module on linux due to too long file names

Closed this issue · 6 comments

jbsv commented

Too long file names in repository.

Description

On linux: go get or git clone cannot use 'github.com/consensys/gnark-crypto' due to unzip not able to handle too long file names.

Expected Behavior

git clone or go mod tidy can download and unzip the repository

Actual Behavior

git clone git@github.com:Consensys/gnark-crypto.git
Cloning into 'gnark-crypto'...
remote: Enumerating objects: 70877, done.
remote: Counting objects: 100% (19537/19537), done.
remote: Compressing objects: 100% (2695/2695), done.
remote: Total 70877 (delta 17573), reused 17767 (delta 16669), pack-reused 51340 (from 1)
Receiving objects: 100% (70877/70877), 35.89 MiB | 13.81 MiB/s, done.
Resolving deltas: 100% (56461/56461), done.
error: unable to create file internal/generator/addchain/1eed5b76b77315c55824fc3c6ad19eb92f19a5f5859d13f7e464428aa2c74d998d5ce788548db3d6059025d409f55414fd63967a0dcc8dc5259a2bdb6c8d4a860554784b1bcfbda16d0bd0d0a49d80678fcc7f0d0: File name too long
error: unable to create file internal/generator/addchain/24cc67981e6bec7f8342e9e03ae556b51f9b18ebaf3a58e9cb2ed35b377b45f02a54d81f5bd492171b53ebd07eaf892fc1d10a1db7b480faf6b9cf57073844a7a6d37a6228fee79ae922dd48ae0001: File name too long
error: unable to create file internal/generator/addchain/48ba093ee0f382b461f250013ebfcfae49861aa07451a214a09d7be021ef905c1ee98e39613a4640f3aebfc96d08c121a2723b44be7f641c7734f71cfaffcba62845b09599ea3e05833e2bbabc290df9a44f9a1c000020bd27400000000023: File name too long
error: unable to create file internal/generator/addchain/7bb56ddaddcc57156093f0f1ab467ae4bc6697d616744fdf91910a2a8b1d366635739e215236cf581640975027d55053f58e59e8373237149668af6db2352a181551e12c6f3ef685b42f43429276019e3f31fc34200000000000000000000: File name too long
error: unable to create file internal/generator/addchain/9174127dc1e70568c3e4a0027d7f9f5c930c3540e8a34429413af7c043df20b83dd31c72c2748c81e75d7f92da11824344e476897cfec838ee69ee39f5ff974c508b612b33d47c0b067c577578521bf3489f34380000417a4e800000000045: File name too long
error: unable to create file internal/generator/addchain/93319e6079afb1fe0d0ba780eb955ad47e6c63aebce963a72cbb4d6cdded17c0a953607d6f52485c6d4faf41fabe24bf07442876ded203ebdae73d5c1ce1129e9b4de988a3fb9e6ba48b7522b80006: File name too long
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

Possible Fix

Use shorter file names.

Steps to Reproduce

Use git clone git@github.com:consensys/gnark-crypto.git on linux.

Context

I was originally trying to use 'go mod tidy' in my repo:
go mod tidy

go: finding module for package github.com/consensys/gnark-crypto/ecc/bn254
-> unzip /home/jean/go/pkg/mod/cache/download/github.com/consensys/gnark-crypto/@v/v0.14.0.zip: open /home/jean/go/pkg/mod/github.com/consensys/gnark-crypto@v0.14.0/internal/generator/addchain/1eed5b76b77315c55824fc3c6ad19eb92f19a5f5859d13f7e464428aa2c74d998d5ce788548db3d6059025d409f55414fd63967a0dcc8dc5259a2bdb6c8d4a860554784b1bcfbda16d0bd0d0a49d80678fcc7f0d0: file name too long

Your Environment

Linux 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
git version 2.34.1
go version go1.23.2 linux/amd64
gnark-crypto v0.12.0 or v0.14.0

Hey -- I suspect that's a issue not related to this repo; we (and other projects importing gnark-crypto) use Linux/Ubuntu in various settings with no problem on that front.
Couldn't reproduce on a clean AWS machine.

Can you also provide unzip -v? I think that for example when running in a Alpine image you may be using busybox version of unzip.

Hmm - this has also appeared before - see golang/go#58915. And indeed in some cases the full filename (e.g. in the current report "/home/jean/go/pkg/mod/github.com/consensys/gnark-crypto@v0.14.0/internal/generator/addchain/1eed5b76b77315c55824fc3c6ad19eb92f19a5f5859d13f7e464428aa2c74d998d5ce788548db3d6059025d409f55414fd63967a0dcc8dc5259a2bdb6c8d4a860554784b1bcfbda16d0bd0d0a49d80678fcc7f0d0" has 261 characters) is bigger than 256. Generally the name limit is 256, but path limit is usually bigger. What does getconf PATH_MAX / say?

Hmm - this has also appeared before - see golang/go#58915. And indeed in some cases the full filename (e.g. in the current report "/home/jean/go/pkg/mod/github.com/consensys/gnark-crypto@v0.14.0/internal/generator/addchain/1eed5b76b77315c55824fc3c6ad19eb92f19a5f5859d13f7e464428aa2c74d998d5ce788548db3d6059025d409f55414fd63967a0dcc8dc5259a2bdb6c8d4a860554784b1bcfbda16d0bd0d0a49d80678fcc7f0d0" has 261 characters) is bigger than 256. Generally the name limit is 256, but path limit is usually bigger. What does getconf PATH_MAX / say?

There is also indication that the user used eCryptfs - are you also by any chance using it? In that case, have a look at the mitigation there (setting GOMODCACHE env variable to a location outside of the encrypted filesystem)

Closing for now, seems to be a filesystem issue.

jbsv commented

Indeed my GOMODCACHE env variable points to an ecryptfs folder. This is where the limit comes from. Thanks a lot!