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

Help needed: Looking for an "official" workaround for Path Too Long #57

Closed
am11 opened this issue Apr 1, 2015 · 5 comments
Closed

Help needed: Looking for an "official" workaround for Path Too Long #57

am11 opened this issue Apr 1, 2015 · 5 comments
Labels

Comments

@am11
Copy link
Member

am11 commented Apr 1, 2015

Related:

This is a universally known truth that the Windows limitation of Path Too Long is affecting almost every runtime and programming paradigm. Unfortunately, MSBuild is not different in that regard. Hopefully, someday we will see it get actually fixed by Windows team.. :)

Over at Web Essentials 2013, we are having issues packaging node.js modules into a .visx image, due to too nested dependencies. We are able to mitigate it using Pri.LongPath assembly via reflection(madskristensen/WebEssentials2013#1387 & madskristensen/WebEssentials2013#1803), which worked for a while in PreBuildTask, but now it is causing PathTooLong issue with <Copy> task on packaging the assets to visx (WebEssentials2013.csproj#L1038). Is there a way we can override the default copying behavior and use hacks like "Pri.LongPath via reflection" there as well?

This is main blocker for WE2013's vNext, which is overdue for quite some now. Any help would be much appreciated by all consumers of Web Essentials! 🎉

//cc @madskristensen, @SLaks.

@rockstardev
Copy link

+1

@amanda-mitchell
Copy link
Contributor

Duplicate of #53?

@ariccio
Copy link

ariccio commented Apr 1, 2015

Yes, duplicate. Well, mostly - NTFS' limitations of a 260-character-long-path-component won't change anytime soon (probably, ever).

And the Windows team can't just redefine MAX_PATH as 33000u, because then all the programs that did:

_Null_terminated_ wchar_t path_str[ MAX_PATH ] = { 0 };

...would be at risk of a stack overflow (66,000 bytes is way beyond the default stack commit size of 4K).

A better C++ workaround is to (when MAX_PATH isn't enough) do something like:

if ( MAX_PATH_not_enough ) {
    const rsize_t path_buffer_number_characters = 33000u;
    std::unique_ptr<_Null_terminated_ wchar_t[]> path_buffer = std::make_unique< wchar_t []>( path_buffer_number_characters);
    const rsize_t size_in_bytes = ( path_buffer_number_characters * sizeof( path_buffer[ 0 ] );
    memset( path_buffer.get( ), 0, size_in_bytes );
    //Use the buffer
    //Prepend "\\?\" if not done already.
    }

Sure, you're using heap - but only in the (hopefully) rare situation when you're dealing with long paths.

@AndyGerlicher
Copy link
Contributor

Closing as duplicate of #53. This is something we would like to have, but not at this time.

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

No branches or pull requests

7 participants
@amanda-mitchell @ariccio @am11 @rockstardev @AndyGerlicher @AR-May and others