Unexpected Errno::ENAMETOOLONG on Windows#4020
Open
rellampec wants to merge 18 commits intoShopify:mainfrom
Open
Unexpected Errno::ENAMETOOLONG on Windows#4020rellampec wants to merge 18 commits intoShopify:mainfrom
rellampec wants to merge 18 commits intoShopify:mainfrom
Conversation
This reverts commit 9c5b8c1.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
The ruby built (ruby executable path:
C:\ruby\Ruby32-x64\bin\ruby.exe) of RubyInstaller (for Windows machines) triggers an error onDir.globfor wide inclusive patterns.x64version hasn't been compiled by taking into account what follows further down.In
ruby-lspthis translates into:index_all(ln:Dir.glob(File.join(@workspace_path, pattern), flags)).load_addons(ln:Dir.glob("#{global_state.workspace_path}/**/ruby_lsp/**/addon.rb")).Windows has a registry entry, under the path
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem, calledLongPathsEnabledto enabling support for file paths over 260 characters, that defaults to0, but that can be changed to1.There have been a couple of bugs reported in ruby-core:
And one fix has been merged: [Win32] long path name support [Bug #12551]#4505 (article of the author of the fix).
However, the fix can only make its way to the executable if the Windows application manifest that is embedded to it during the built has this entry:
None of the ruby installer repos (old or new) has any reported issue on this matter.
On the other hand, although
ruby-lspallows to declare an indexation configuration parameter with this settings keyrubyLsp.indexing: {excludedPatterns: []}, excluding the root folder of the deepest part of the working directory does not prevent the error to popup. Although such an error shouldn't be reason forruby-lspto stop indexing, it does stop indexing.Vs Code extension Settings:
{ "rubyLsp.indexing": { "excludedPatterns": [ "**/test/**/*.rb", "frontends/**/*.rb", "vendor/**/*", ".bundle/**/*", "gitlab-ci/**/*", "deb/**/*", "graphql-docs/**/", "deployment/**/*" ] }"frontends/**/*.rb"is excluded, and nevertheless the indexer ended up failing.Implementation
My changes involve all the below in order of priority:
Ruby LSP output) on indexation and addons loading.load_addonsandindex_allcontinue by logging any error when it occurs (instead of completely failing). This is implemented with error handling and logging.globonload_addonsprovided that it globs on per main space/root-folder basis (same approach as used in the indexer withtop_level_directories(line)included_patternsvariable, and subtracting from theArraytheexcluded_patterns, before theDir.globis run.Automated Tests
I haven't, because I do not know how to do it, and I do not know if the changes I implemented are really part of the test suit.
Manual Tests
ruby-lspGemfile, I pointed theruby-lspgem to the feature branch of this PR.reload windowon VS Code, and checked theview > outputterminal.