nushell / nushell/nushell

Windows - Changing into directory by omitting `cd` results in instant crash `exit code 0x65`

Open
#9,871 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category:bug deprecated:platform-specific panic platform:windows
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Describe the bug

I have a symlinked directory, dir_a. If I call cd dir_a, I get directory not found. If I call ./dir_a, my WezTerm terminal closes.
Same thing happens with Windows Terminal Preview:

❯ ./dir_a
thread 'main' panicked at 'internal error: cannot canonicalize known path: Os { code: 1, kind: Uncategorized, message: "Incorrect function." }', crates\nu-cli\src\repl.rs:507:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

[process exited with code 101 (0x00000065)]
You can now close this terminal with Ctrl+D, or press Enter to restart.

I tried calling the following, and got the following error:

❯ with-env { RUST_BACKTRACE: 1 } { ./dir_a }
Error: nu::shell::external_command

  × External command failed
   ╭─[entry #1:1:1]
 1 │ with-env { RUST_BACKTRACE: 1 } { ./dir_a }
   ·                                  ───┬───
   ·                                     ╰── can't run executable
   ╰────
  help: Access is denied. (os error 5)

Calling the above command but with cd ./dir_a instead results in directory not found.

How to reproduce
  1. Create a symlinked directory.
  2. Call cd symlinked_dir
  3. Get directory not found error
  4. Try calling ./symlinked_dir
  5. Experience crashing terminal
Expected behavior

I expected to change directory to where the symlink points to.

Screenshots

No response

Configuration
key value
version 0.83.1
branch
commit_hash bf5bd3ff102689a3cae78ea5dfe2e67dfa92f4cd
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.69.0 (84c898d65 2023-04-16)
rust_channel 1.69.0-x86_64-pc-windows-msvc
cargo_version cargo 1.69.0 (6e9a83356 2023-04-12)
build_time 2023-07-30 18:20:17 +00:00
build_rust_channel release
allocator standard
features default, sqlite, trash, which, zip
installed_plugins
Additional context

I am currently playing around with starship, but the behaviour was consistent before I installed it IIRC.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the symlinked-directory commands on Windows, then start at crates/nu-cli/src/repl.rs:507 where the reported panic occurs. Trace how cd and ./dir_a are dispatched, and verify that entering the symlinked directory reports no directory-not-found error and does not crash the terminal.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.