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

Windows+Composer install fails due to "path too long" #129

Closed
ashnazg opened this issue Oct 24, 2013 · 11 comments
Closed

Windows+Composer install fails due to "path too long" #129

ashnazg opened this issue Oct 24, 2013 · 11 comments
Assignees
Labels
Milestone

Comments

@ashnazg
Copy link

ashnazg commented Oct 24, 2013

A handfull of the test files with long class names will cause the ZipArchive::extractTo() method to fail, due to the Windows zip file reader saying "Path too long".

This seems to be due to the combination of the long filenames and pathing, on top of the long zip filename being set by either Composer or Github on the download step (I cannot tell which it is), e.g. "6fcfb7666c95f341b42f02c94a47b3a51ed484e0.zip".

The resulting total paths look like this example:
C:\Users\cburgess\AppData\Local\Composer\files\pdepend\pdepend\6fcfb7666c95f341b42f02c94a47b3a51ed484e0\pdepend-pdepend-6fcfb76\src\test\resources\files\Code\ASTMemberPrimaryPrefix\testGraphDereferencedArrayFromStaticMethodCallAndMultipleMethodInvocations.php

It is simply pdepend-1.1.1 that my composer install step is trying to download and install, but the unzip step just can't succeed because of the some of the paths that Windows cannot unzip successfully ("path too long").

I realize it's probably not feasible for you to shorten your class names and path structure. However, no amount of searches I've done leads to anything close to mentioning this issue, so I wanted to make a record of it that people will be able to find.

@ashnazg
Copy link
Author

ashnazg commented Oct 24, 2013

The workaround here is to use the "--prefer-source" install option. However, it is a tedious option, since you cannot tell composer to just apply it to pdepend only. Thus, using it will force clones of all the other dependencies rather than reading them from cache.

@ashnazg
Copy link
Author

ashnazg commented Oct 24, 2013

As an aside, I see this issue on phpmd as well.

@ashnazg
Copy link
Author

ashnazg commented Oct 30, 2013

Actually, "--prefer-source" is not succeeding as a workaround. When the clone tries to check out the given tag, the long pathing seems to prevent the file creation, thus the checkout fails.

@manuelpichler
Copy link
Contributor

Hmmm, not sure how to handle this issue

@ashnazg
Copy link
Author

ashnazg commented Nov 8, 2013

Right, I couldn't think of anything clever either ;-) I mainly wanted to make it known, since it took some digging for me to figure out why it was failing, as the composer error didn't explain the actual failure point.

@manuelpichler
Copy link
Contributor

I should at least add a note to the README.md (okay I should add a READMD.md :-] ) and I should put a note in PDepend's documentation.

@beberlei
Copy link
Contributor

Its possible to use .gitattributes to skip the tests folders for Composer ZIP Archives

@beberlei
Copy link
Contributor

@tkdb
Copy link

tkdb commented Dec 12, 2013

Jup it's me :) Thanks for cross-linking. I can confirm there is still a problem, didn't knew about that limitation of ZipArchive, I think on Windows the limit is much larger nowadays. Ref: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath - Perhaps this is worth to report upstream to ZipArchive?

@manuelpichler manuelpichler added this to the 2.0.3 milestone Oct 8, 2014
@manuelpichler manuelpichler self-assigned this Oct 8, 2014
@ashnazg
Copy link
Author

ashnazg commented Oct 10, 2014

Hey @manuelpichler , can you add this fix to PHPMD also?

@boussou
Copy link

boussou commented Dec 29, 2014

Hi Guys, the answer is generally to move the related project folder (where it happens) upper (or even direcl to the root of the drive).
I just faced it on pdepend on Win8, the project was 3 folders deep, solved by reducing parent folder name (project folder) or moving it to the the root of the drive.

The only problem is that Composer fails & the error message (on ZipArchive) gives no clue about the cause.
Since it is an OS limitation changing the exception message would be more useful than adding a note in an never read readme file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

6 participants
@beberlei @manuelpichler @ashnazg @boussou @tkdb and others