zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.33k stars 644 forks source link

Error with git clone: file name too long #2389

Open patitieso opened 1 year ago

patitieso commented 1 year ago

On Ubuntu Linux: uname -a Linux ... 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Before installation, running a simple git clone https://github.com/zellij-org/zellij.git from a working directory with very few characters in the path, I get

error: unable to create file zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_swapping_floating_layouts_in_an_undamaged_state_with_no_focus_node_pane_focuses_on_deepest_node.snap: File name too long
error: unable to create file zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_swapping_tiled_layouts_in_an_undamaged_state_with_no_focus_node_pane_focuses_on_deepest_node.snap: File name too long
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.

The remainder of the repo seems to have cloned properly.

Maybe a fix could be simply make some of these file names shorter?

raphCode commented 1 year ago

Most common linux fs allow 255 characters per filename, and no limit on the total path length. The mentioned file has 148 characters in its name. Are you using a nonstandard filesystem? Maybe eCryptfs with filename encryption?

Can you work on a different fs? Or continue without these files? They are only related to some tests.

patitieso commented 1 year ago

I was able to do a complete clone from a subdirectory of one character, from root directory, as described above.

The filesystem is EXT4.

assarbad commented 10 months ago

Most common linux fs allow 255 characters per filename, and no limit on the total path length.

You can ask your system. Try it getconf -a|grep PATH_MAX. Example:

$ getconf -a|grep PATH_MAX
PATH_MAX                           4096
_POSIX_PATH_MAX                    4096

So yeah, there is an upper limit and -- for comparison -- it's about one eighth of what you get on NT-based Windows. And using ecryptfs, for example, is a likely reason for busting that limit. Check out the actual storage, e.g. at /home/.ecryptfs/$(whoami)/.Private, and you will notice that the names are all pretty long, despite the names of the respective encrypted files. Therefore it's surprisingly easy to hit the ceiling.

The mentioned file has 148 characters in its name. Are you using a nonstandard filesystem? Maybe eCryptfs with filename encryption?

I would also presume this is ecryptfs I run into this on a regular basis. And the actual underlying issue is that the overall path length is limited to 4096 (configurable, but this seems to be widely used as a default).

My workaround was to build from another file system location which is on plain ext4. However, this is impractical, because this means I have to work around cargo install (and cargo install-update).

PS: all of the various maximums: getconf -a|awk '$1 ~ /_MAX$/ {print}'