- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 33.7k
 
win: fix fs.realpath.native for long paths #44536
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
          
     Merged
      
      
            nodejs-github-bot
  merged 1 commit into
  nodejs:main
from
JaneaSystems:mefi-realpath-longpath
  
      
      
   
  Sep 13, 2022 
      
    
                
     Merged
            
            win: fix fs.realpath.native for long paths #44536
                    nodejs-github-bot
  merged 1 commit into
  nodejs:main
from
JaneaSystems:mefi-realpath-longpath
  
      
      
   
  Sep 13, 2022 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: nodejs#39721
              
                    lpinca
  
              
              approved these changes
              
                  
                    Sep 6, 2022 
                  
              
              
            
            
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
| 
           Supersedes #44522.  | 
    
      
        
      
      
  
    15 tasks
  
              
                    Flarna
  
              
              approved these changes
              
                  
                    Sep 7, 2022 
                  
              
              
            
            
  This was referenced Sep 8, 2022 
      
| 
           Hello everyone, is there anything else I can do to help move this forward?  | 
    
| 
           Landed in 8b50160  | 
    
    
  Fyko 
      pushed a commit
        to Fyko/node
      that referenced
      this pull request
    
      Sep 15, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: nodejs#39721 PR-URL: nodejs#44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  RafaelGSS 
      pushed a commit
      that referenced
      this pull request
    
      Sep 26, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
      
     Merged
  
    
  RafaelGSS 
      pushed a commit
      that referenced
      this pull request
    
      Sep 26, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  RafaelGSS 
      pushed a commit
      that referenced
      this pull request
    
      Sep 26, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 4, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 4, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
      
     Merged
  
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 4, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 7, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 10, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  juanarbol 
      pushed a commit
      that referenced
      this pull request
    
      Oct 11, 2022 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: #39721 PR-URL: #44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  guangwong 
      pushed a commit
        to noslate-project/node
      that referenced
      this pull request
    
      Jan 3, 2023 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: nodejs/node#39721 PR-URL: nodejs/node#44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
    
  guangwong 
      pushed a commit
        to noslate-project/node
      that referenced
      this pull request
    
      Jan 3, 2023 
    
    
      
  
    
      
    
  
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: nodejs/node#39721 PR-URL: nodejs/node#44536 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
      
        
      
      
  
    7 tasks
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    author ready
  PRs that have at least one approval, no pending requests for changes, and a CI started. 
  
    fs
  Issues and PRs related to the fs subsystem / file system. 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
On windows when using
fs.realpath.native,fs.realpathSync.nativeandfs.promises.realpathon long path, ENOENT is thrown. On the other hand, long paths work well withfs.realpathandfs.realpathSync. On Linux, all of the mentionedrealpathversions work as expected.The problem is that windows API functions do not work with paths longer then 260 characters by default. There is a way to enable long path support via application manifest file, but it only works starting from Windows 10 version 1607 and it relies on registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabledbeing set. Since that is not necessarily always the case with machines running node, this approach wouldn't work. The other way to enable working with long paths is to add a\\?\prefix to the path prior to using it in windows API functions. This approach is used by allfsfunctions working with paths, with the exception offs.realpath.nativeandfs.realpathSync.native.Fix is made in
fs.jsimplementation offs.realpath.native,fs.realpathSync.native, so their path preprocessing matches to the other functions.An existing windows long path test is improved to cover the issue that is fixed by these changes.
Fixes: #39721