nushell / nushell/nushell

`path split` returns incorrect first component for drive-relative paths

Open
#18,607 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Bug report form
  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug

When using path split on a Windows drive-relative path (e.g., C:Desktop), the first component in the returned array incorrectly includes a trailing backslash (C:\).
In Windows, C:\ (root directory) and C: (current directory of drive C) have distinct meanings. While a standard absolute path requires retaining the separator, the command should not automatically append characters that were not originally present in the input.

How to reproduce
~> 'C:\Users\UserName' | path split
╭───┬──────────╮
│ 0 │ C:\      │
│ 1 │ Users    │
│ 2 │ UserName │
╰───┴──────────╯
~> 'C:Desktop' | path split
╭───┬─────────╮
│ 0 │ C:\     │ # Bug: Backslash is incorrectly appended
│ 1 │ Desktop │
╰───┴─────────╯
Expected behavior

path split should preserve the drive letter exactly as inputted without auto-completing it into a root path.

~> 'C:\Users\UserName' | path split
╭───┬──────────╮
│ 0 │ C:\      │
│ 1 │ Users    │
│ 2 │ UserName │
╰───┴──────────╯
~> 'C:Desktop' | path split
╭───┬─────────╮
│ 0 │ C:      │ # Expected: Stays 'C:' without the '\'
│ 1 │ Desktop │
╰───┴─────────╯
Configuration

~> version | transpose key value | to md --pretty

key value
version 0.114.1
major 0
minor 114
patch 1
branch
commit_hash 0df4ca222cc713e79b6b1684ad8ccaec584ce4ac
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.95.0 (59807616e 2026-04-14)
rust_channel 1.95.0-x86_64-pc-windows-msvc
cargo_version cargo 1.95.0 (f2d3ce0bd 2026-03-21)
build_time 2026-07-11 16:22:26 +00:00
build_rust_channel release
allocator standard
features default, lsp, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, dc-glob=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=false, cell-path-types=false

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

Start at the path split command entry point and reproduce the Windows drive-relative case with C:Desktop, comparing it with C:\Users\UserName. Trace how the first component is formed and add or update coverage for both inputs. Done means drive-relative paths preserve C: while absolute paths retain C:\.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.