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

Running Helix from a directory that cannot be canonicalized does not work #12880

Open
GoldenGuy1000 opened this issue Feb 15, 2025 · 3 comments · May be fixed by #12879
Open

Running Helix from a directory that cannot be canonicalized does not work #12880

GoldenGuy1000 opened this issue Feb 15, 2025 · 3 comments · May be fixed by #12879
Labels
C-bug Category: This is a bug

Comments

@GoldenGuy1000
Copy link

GoldenGuy1000 commented Feb 15, 2025

Summary

Cargo is also not a fan when a directory cannot be canonicalized, but here Helix does a cheeky .unwrap() after calling the std::fs method to canonicalize the executable directory (This is inside Helix/Loader, and right on startup). I have created a pull request (#12879) which allows Helix to launch in this situation, but according to my log it looks like the LSP still fails to load which might be related.

Reproduction Steps

I tried this:

  1. Creating a RAM disk via ImDisk on Windows 10
  2. Installing Helix on it
  3. Running Helix

I expected this to happen:

Helix launches

Instead, this happened:

> .\hx.exe -vv
thread 'main' panicked at helix-loader\src\lib.rs:74:10:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Helix log

~/.cache/helix/helix.log
2025-02-14T01:52:41.794 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-14T01:52:41.795 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-14T01:52:41.795 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-14T01:52:41.795 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-14T01:52:42.529 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-14T01:52:42.558 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-14T01:52:42.558 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-14T01:54:04.199 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-14T14:41:49.309 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-14T14:42:05.409 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-14T14:43:40.800 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-14T14:43:40.801 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-14T14:43:40.801 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-14T14:43:40.801 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-14T14:43:41.522 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-14T14:43:41.554 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-14T14:43:41.554 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-14T14:48:26.427 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-14T14:49:14.309 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-14T14:49:14.309 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-14T14:49:14.309 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-14T14:49:14.309 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-14T14:49:15.004 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-14T14:49:15.035 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-14T14:49:15.036 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-15T03:14:36.083 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-15T03:14:36.084 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-15T03:14:36.084 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-15T03:14:36.089 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-15T03:14:36.856 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-15T03:14:36.890 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-15T03:14:36.890 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-15T03:15:17.124 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-15T03:15:29.512 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-15T03:15:29.513 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-15T03:15:29.513 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-15T03:15:29.513 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-15T03:15:30.232 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-15T03:15:30.268 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-15T03:15:30.269 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-15T03:15:51.830 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-15T03:15:58.924 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-15T03:15:58.925 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-15T03:15:58.925 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-15T03:15:58.925 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-15T03:15:59.635 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-15T03:15:59.670 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-15T03:15:59.670 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-15T03:16:10.742 helix_view::document [ERROR] Failed to copy metadata on write: Incorrect function. (os error 1)
2025-02-15T04:01:11.285 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader\\src'\n"
2025-02-15T04:01:11.286 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\helix-loader'\n"
2025-02-15T04:01:11.286 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix'\n"
2025-02-15T04:01:11.286 helix_lsp::transport [ERROR] rust-analyzer err <- "warning: could not canonicalize path: 'R:\\helix\\rust-toolchain.toml'\n"
2025-02-15T04:01:11.996 helix_lsp::transport [ERROR] rust-analyzer err <- "error: Unknown binary 'rust-analyzer.exe' in official toolchain '1.76.0-x86_64-pc-windows-msvc'.\n"
2025-02-15T04:01:12.027 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
2025-02-15T04:01:12.027 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/Dockerfile.*", re: "(?-u)^.*/Dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('D'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/dockerfile.*", re: "(?-u)^.*/dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('d'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/Containerfile.*", re: "(?-u)^.*/Containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('C'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/containerfile.*", re: "(?-u)^.*/containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/.*ignore", re: "(?-u)^.*/\\..*ignore$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), ZeroOrMore, Literal('i'), Literal('g'), Literal('n'), Literal('o'), Literal('r'), Literal('e')]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/BUILD.*", re: "(?-u)^.*/BUILD\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('B'), Literal('U'), Literal('I'), Literal('L'), Literal('D'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/.env.*", re: "(?-u)^.*/\\.env\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/.envrc.*", re: "(?-u)^.*/\\.envrc\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('r'), Literal('c'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/conf/*/*.{inc,conf}", re: "(?-u)^.*/conf/.*/.*\\.(?:conf|inc)$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('f'), Literal('/'), ZeroOrMore, Literal('/'), ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('o'), Literal('n'), Literal('f')]), Tokens([Literal('i'), Literal('n'), Literal('c')])])]) }
2025-02-15T04:13:57.047 globset [DEBUG] glob converted to regex: Glob { glob: "*/Jenkinsfile.*", re: "(?-u)^.*/Jenkinsfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('J'), Literal('e'), Literal('n'), Literal('k'), Literal('i'), Literal('n'), Literal('s'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:13:57.047 globset [DEBUG] built glob set; 1 literals, 0 basenames, 0 extensions, 0 prefixes, 145 suffixes, 11 required extensions, 10 regexes
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/Dockerfile.*", re: "(?-u)^.*/Dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('D'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/dockerfile.*", re: "(?-u)^.*/dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('d'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/Containerfile.*", re: "(?-u)^.*/Containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('C'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/containerfile.*", re: "(?-u)^.*/containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/.*ignore", re: "(?-u)^.*/\\..*ignore$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), ZeroOrMore, Literal('i'), Literal('g'), Literal('n'), Literal('o'), Literal('r'), Literal('e')]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/BUILD.*", re: "(?-u)^.*/BUILD\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('B'), Literal('U'), Literal('I'), Literal('L'), Literal('D'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/.env.*", re: "(?-u)^.*/\\.env\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/.envrc.*", re: "(?-u)^.*/\\.envrc\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('r'), Literal('c'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/conf/*/*.{inc,conf}", re: "(?-u)^.*/conf/.*/.*\\.(?:conf|inc)$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('f'), Literal('/'), ZeroOrMore, Literal('/'), ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('o'), Literal('n'), Literal('f')]), Tokens([Literal('i'), Literal('n'), Literal('c')])])]) }
2025-02-15T04:17:35.416 globset [DEBUG] glob converted to regex: Glob { glob: "*/Jenkinsfile.*", re: "(?-u)^.*/Jenkinsfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: false, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('J'), Literal('e'), Literal('n'), Literal('k'), Literal('i'), Literal('n'), Literal('s'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T04:17:35.416 globset [DEBUG] built glob set; 1 literals, 0 basenames, 0 extensions, 0 prefixes, 145 suffixes, 11 required extensions, 10 regexes

Platform

Windows

Terminal Emulator

Powershell 7

Installation Method

source / releases page

Helix Version

Current master / 25.01.1

@pascalkuthe
Copy link
Member

What does cannot be cannonicalized mean? That would usually mean that the directory does note exist. Helix does not support running in a directory that has been deleted

@GoldenGuy1000
Copy link
Author

GoldenGuy1000 commented Feb 15, 2025

It's a proper path on a mounted (temporary) filesystem. The files still exist as of the time of running .\hx.exe
& I mean that's the error. Windows doesn't like the path & will not give you a canonical version of it.

See the linked PR for how I was able to get Helix to run, it is very simple.

@GoldenGuy1000
Copy link
Author

@pascalkuthe I added some more context to the repro section. I am using ImDisk to create a RAM disk & installing+running Helix on that, which causes Helix to crash immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
2 participants