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

Paket fails to install nugets with paths longer than MAX_PATH #2832

Open
ylatuya opened this issue Oct 10, 2017 · 14 comments
Open

Paket fails to install nugets with paths longer than MAX_PATH #2832

ylatuya opened this issue Oct 10, 2017 · 14 comments

Comments

@ylatuya
Copy link

ylatuya commented Oct 10, 2017

Description

paket restore fails with PathTooLong when installing the package runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl. This package is included by NETStandard.Library package

This bug seems to have been addressed in #949 but this seems another use case that is not handled correctly.

Repro steps

  1. Create an empty project in a directory path long enough eg: C:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\

  2. Create a packet.dependencies with the package NETStandard.Library

  3. Run paket install

Expected behavior

The command detects that the path is too long and shortens the package ID

Actual behavior

The command fails with PathTooLong

Known workarounds

None

Logs

`
Paket version 5.113.1
paket.local override: nuget Couchbase.Lite.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
paket.local override: nuget Couchbase.Lite.Storage.SystemSQLite.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
paket.local override: nuget Sparkle group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
paket.local override: nuget WebKit group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
paket.local override: nuget Wibu group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
paket.local override: nuget EPPlus.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget
Something went wrong while downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
==> Trying again
Something went wrong while downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
==> Trying again
Downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Something went wrong while downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
==> Last trial
Downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Something went wrong while downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
==> Last trial
Downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1
Performance:

  • Disk IO: 1 minute, 52 seconds
  • Average Download Time: 560 milliseconds
  • Number of downloads: 4
  • Average Request Time: 901 milliseconds
  • Number of Requests: 4
  • Runtime: 33 seconds
    Paket failed with
    -> PathTooLongException: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
    -> PathTooLongException: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg
    -> PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
    make[3]: *** [restore] Error 1
    `
@forki
Copy link
Member

forki commented Oct 10, 2017

I fear you need to reduce z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master

@matthid
Copy link
Member

matthid commented Oct 10, 2017

We tried tackling this problem time and time again and someone is always complaining or the change is very intrusive (like #2584).
So we welcome suggestions otherwise we don't really know what we can do.

We have the same problem in AppVeyor and never found a viable solution. Please help ;)

@ylatuya
Copy link
Author

ylatuya commented Oct 17, 2017

I understand perfectly the issue can be hard to tackle from Paket's side since it's a combination of several external issues:

  • The lack of support in nuget to define platform and architecture for packages providing native dependencies so people need to include it in the package id.
  • The fact that some package maintainers use very long names for packages (sometimes caused by the first issue).
  • The 90's limitation of MAX_PATH which is absurd for modern file systems and operating systems.

A possible solution that would work for most people would be the option to override the package id with an alias:
alias runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl package_alias: ro132x64nSSCO

This solution would imply explicitly changing the package id with an alias so current users wouldn't be affected, but it wouldn't work out of the box for most people since it would imply having to provide the overrides for all packages with long names.

@sgallou
Copy link

sgallou commented Mar 27, 2019

Is this problem related to the .NET framework used ?
In this case, using .NET framework version >= 4.6.2 should solve this, as MAX_PATH limitation seems to be finally fixed.

@theoandry
Copy link

In this case, using .NET framework version >= 4.6.2 should solve this, as MAX_PATH limitation seems to be finally fixed.

UP PLEASE ! :)

@dustinlacewell
Copy link

I couldn't believe my eyes when I ran into this issue.

@PavelA85
Copy link

PavelA85 commented Jan 3, 2020

We had same issue with PathTooLongException :
-> PathTooLongException: Path too long: D:\APP\AzureDevOpsAgents\Y35286.6\_work\_tool\dncs\2.1.302\x64\sdk\NuGetFallbackFolder\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl\4.3.3\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.3.nupkg
In our case updating from 5.177.1 to 5.241.5 resolved our issue.

@jbaehr
Copy link

jbaehr commented Feb 25, 2020

I can confirm this. I had a PathTooLongException (while probing c:\Program Files\dotnet\sdk\NuGetFallbackFolder\ during install of a nuget with a long id) with 5.181.1, which is gone in 5.219.0

@jbaehr
Copy link

jbaehr commented Feb 26, 2020

An update to my last comment: Only if the symptom is related to the NuGetFallbackFolder updating to a more recent Paket version helps. In any case that's just a hint that you're dancing on a knife's edge. In other environments we still get PathTooLongExceptions, now of this kind:
C:\Users\some-long-username\.nuget\packages\some-long-package-id\some-version-with-long-prelrelease-tag\some-long-package-id.some-version-with-long-prelrelease-tag.nupkg

Luckily, we're in charge of the packages in question, so we can work around by shortening package-ids and pre-release labels.

@sgallou
Copy link

sgallou commented Oct 9, 2020

Still no solution to this 80's Windows limitation ? ? ?

@NightWatchman
Copy link

NightWatchman commented Nov 9, 2021

Just a quick note to express interest in getting this fixed. I'm having a real hard time using GitHub actions with a self-hosted runner now because github actions checks out my code into .../_work/long-repo-name/long-repo-name and when paket goes to restore NuGet dependencies I get paths like C:\actions-runner\_work\long-repo-name\long-repo-name\packages\test\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.3.nupkg which paket can't handle.

I'm targeting .NET 5.

@smoothdeveloper
Copy link
Contributor

@NightWatchman I'm not sure if you are aware of storage: none option in paket.dependencies and also if your project may be dependent on the nuget packages landing in ./packages/.

If the later answer is "it doesn't depend on that location", switching to storage: none will remove the long prefix, and the nuget packages end up just once in the cache, paket resolving it automatically from there rather than copying under ./packages.

@NightWatchman
Copy link

NightWatchman commented Nov 10, 2021

Thanks for the advice! I'm targeting .NET 5, soon to be .NET 6, with no odd custom references, so this worked just fine for me.

@TheDuQe
Copy link

TheDuQe commented Sep 14, 2023

Bug still opened. Cannot build.

System.IO.DirectoryNotFoundException: Could not find a part of the path '...\dependencies\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl\4.3.0\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.nuspec'

I'd like to know who's the guy who choose such a lovely name.

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

No branches or pull requests