-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Long paths under windows dont work #58
Comments
@x29a ... I have a pull request contribution pending and no other contributions. or, second solution: the use of semicolins is the reason these solutions exist for your issue. The solutions are splitting your large command into many small commands using the semicolin. Windows does less work per command and you should not have further problems. |
OK, shame on me for leaving this open nearly a year. The main issue is that I don't have ready access to a Windows machine--these days I resort to using an Amazon Web Services Windows instance, a bit of a hassle--so that diminishes my enthusiasm on tacking this.n I'm now thinking I should be able to duplicate this on Linux, via some sym link trickery. I believe the ext4 file system, what I'm currently using, has a 255 limit on paths. I can make a legal <255 path with, for example, /tmp/aa/ab/ac/ .. then exceed the 255 by symlinking one of the middle directories to something with a longer name. I'll pursue that, and if no progress there I'll actually use a Windows machine. |
Have there been any developments on this? Would using https://metacpan.org/pod/Win32::LongPath help to work around the issue on Windows? |
There hasn't been progress. However, it is easier for me to get access to Windows now that it was in the past so there's hope. I looked at Win32::LongPath and wasn't able to see a long enhancement to the |
I spent the past two hours researching and trying different techniques to run the However, that technique may be the only way to get Perl on Windows to get a file listing. Here's my offer: if anyone can devise a Perl subroutine which accepts a Windows directory name as input and returns as output a list (or hash) of file paths (leading subdirectory name + file name) relative to the input directory, then I'll integrate this into cloc. |
Not working with cloc under windows currently but i came across a windows filesystem specific workaround. By using the UNC prefix, the path limit might be circumvented. Can anybody give this a try? The question would be if cloc should detect the filesystem and use the workaround or if users should just pass in the UNC'd path when facing problems. |
cloc already detects the OS and does different path munging depending on Windows or Unix-like. I'm open to adding the UNC prefix for Windows in if anyone can vouch that it works through cloc. |
Hi All, |
I was able to work around @AlDanial Would you be open to a PR using Win32::LongPath for these when running on Windows (and also maybe behind a flag), so that at least when using |
@RyanMcC I welcome the PR you describe! |
Hello any update on this? Thought I would ask. Thank you. |
Great question. Sorry. I am on Windows 10 Trying to do diff
and it did not work. I saw errors like "Can't cd to xxx". Unfortunately I already uninstalled and cleaned up things. Our repo has very long filenames/depth. I googled and got to this issue and it seemed similar/same to what I was seeing. I was going to try doing the diff on linux later today hoping to work around the issue. |
@tfadler : give the 1.96.1 Windows executable at https://github.com/AlDanial/cloc/releases a try. It includes PR #686 by @RyanMcC that uses |
Thank you @AlDanial I got 1.96.1 from scoop. Let me know if you think that is stale. I checked and that is the reported version. Note I tried and my commands are fine on Linux. Just thought I would mention that. I looked the documentation and I did not see any param I needed to provide for long path but please correct me if I am wrong. Here is a section of the output.
I had to obfuscate some but kept the file length the same. There are more similar lines after that. I am not blocked since I can run on linux too. I am running this in PowerShell 7.3.6. If that helps. Let me know any thoughts. Thank you. |
I've just tried cloc 1.98 on Windows 10 and faced the same error. We also have a large codebase with very deep folder structure. |
Two thoughts came to mind: try running cloc at the parent directory of your deep structure 1) from WSL or 2) using the "Git for Bash" terminal that comes with the Git for Windows installation. I wonder if these approaches ride on top of the Windows filesystem or have a different mechanism. |
I am facing https://sourceforge.net/p/cloc/bugs/101/ under Windows 7 SP1, 64bit with the bundled EXE version 1.62 and also 1.66 on NTFS filesystem.
Windows has a limit on the length of filenames. Perls Find::Find inherently has to deal with the limitation and therefor also cloc.
I am running cloc on a huge codebase, unfortunately, i cant create a minimal example presenting the problem or disclose the project structure. Running cloc on just the directory structure which poses the problem works fine, so i assume it has something todo when recursing through lots of folders.
Cloc is invoked with
--by-file --ignored ignored.log --found found.log --xml --out src.xml <relative path>
The error i get is:
Can't cd to ../../../.. from
<relative path with length of 222>
: No such file or directory at C:/StrawberryPerl/perl/lib/File/Find.pm line 469.Note, i am running the .pl against Strawberry Perl 5.22.1.2-32bit instead of the .exe for debugging reasons .
The relative path is prepended by a path of length 35, resulting in a total length of 256 for the directory. The error results in not output file, therefor missing results.
One temporary fix is to
subst
the first part of the path to a new drive letter and hence save 33 chars.The text was updated successfully, but these errors were encountered: