microsoft / microsoft/terminal

`wt` does not spawn from `explorer` when spawned from (a `\\wsl` path) longer than `MAX_PATH`.

Open
#19,058 1 comment 0 reactions 0 assignees View on GitHub
Issue-Question Needs-Tag-Fix zInbox-Bug
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.

~~~pwsh
#!/usr/bin/env pwsh
Get-AppxPackage Microsoft.WindowsTerminal
~~~

1.

~~~YAML
ResourceId :
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe
IsFramework : False
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
~~~

### Windows build number

1.

~~~pwsh
#!/usr/bin/env pwsh
Get-ComputerInfo | Select-Object -Property @(
'OsName',
'OsOperatingSystemSKU',
'OsVersion',
'OsBuildNumber'
) | Format-List
~~~

1.

~~~YAML
OsName : Microsoft Windows 11 Pro
OsOperatingSystemSKU : 48
OsVersion : 10.0.26120
OsBuildNumber : 26120
~~~

### Other Software

- Obviously, `explorer.exe` applies:

1.

~~~pwsh
#!/usr/bin/env pwsh
#Requires -PSEdition 'Core'
If ($IsWindows)
{
Get-Item -Path (
Get-Command 'explorer' | `
Select-Object -ExpandProperty 'Source'
) | `
Select-Object -ExpandProperty 'VersionInfo' | `
Format-List
}
~~~

[^1]

[^1]: [`stackoverflow.com/revisions/45517267/4`][1]

[1]: https://stackoverflow.com/revisions/45517267/4#:~:text=(Get%2DItem%20%2DPath%20'C:%5CProgram%20Files%5CJava%5Cjdk1.8.0_144%5Cbin%5Cjava.exe').VersionInfo%20%7C,Format%2DList%20%2DForce

1.

~~~YAML
OriginalFilename : EXPLORER.EXE.MUI
FileDescription : Windows Explorer
ProductName : Microsoft® Windows® Operating System
Comments :
CompanyName : Microsoft Corporation
FileName : C:\Windows\explorer.exe
FileVersion : 10.0.26100.4441 (WinBuild.160101.0800)
ProductVersion : 10.0.26100.4441
IsDebug : False
IsPatched : False
IsPreRelease : False
IsPrivateBuild : False
IsSpecialBuild : False
Language : English (United Kingdom)
LegalCopyright : © Microsoft Corporation. All rights reserved.
LegalTrademarks :
PrivateBuild :
SpecialBuild :
FileVersionRaw : 10.0.26100.2415
ProductVersionRaw : 10.0.26100.2415
~~~

- However, https://github.com/files-community/Files/issues/17133#issuecomment-2993670910 could also apply here:

1.

~~~pwsh
#!/usr/bin/env pwsh
Get-AppxPackage FilesPreview
~~~

1.

~~~YAML
ResourceId :
InstallLocation : C:\Program Files\WindowsApps\FilesPreview_3.9.10.0_x64__1y0xx7n9077q4
IsFramework : False
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.7_7000.522.1444.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
~~~

### Steps to reproduce

1. Using a real Linux OS, in a BTRFS filesystem, create a path longer than `MAX_PATH`, like `\\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Technical'}#.dir`.

1. Install the `.MSIXBundle` from [`WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5`](https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5):

~~~pwsh
#!/usr/bin/env pwsh
#Requires -PSEdition Core
#Requires -Version 7.6
If ($IsWindows) { Add-AppxPackage -Path "$LocationToMSIX" } # Usually, `$Env:UserProfile/Downloads`.
~~~

1. On the host, execute the undermentioned:

~~~pwsh
#!/usr/bin/env pwsh
#Requires -PSEdition Core
If ($IsWindows) { wmic diskdrive list brief }
~~~

[^wmic]

[^wmic]: [`blog.bryanroessler.com/2020-12-14-btrfs-on-wsl2/`][wmic]

[wmic]: https://blog.bryanroessler.com/2020-12-14-btrfs-on-wsl2/#:~:text=wmic%20diskdrive%20list%20brief

1. When the correct filesystem has been identified:

~~~pwsh
#!/usr/bin/env pwsh
#Requires -PSEdition Core
If ($IsWindows) { sudo wsl --mount \\.\PHYSICALDRIVE1 --bare }
~~~

1. Likewise, on WSL:

~~~sh
#!/usr/bin/env sh
sudo lsblk -o NAME,FSTYPE,FSVER,FSAVAIL,MOUNTPOINTS
~~~

This shall return output similar to the undermentioned:

~~~RS
NAME FSTYPE FSVER FSAVAIL MOUNTPOINTS
sda ext4 1.0
sdb ext4 1.0
sdc swap 1 [SWAP]
sdd ext4 1.0 954.6G /mnt/wslg/distro
/
sde
├─sde1 vfat FAT32
├─sde2 ext4 1.0
├─sde3 ext4 1.0
└─sde4 btrfs 1.2T /mnt/rjlb/fedora
~~~

Utilise the output to confirm that the *device* has been mounted into `wsl`, then set its path as `$dev_id`, and define a mount point at `$path`.

1. When the correct filesystem has been identified:

~~~sh
#!/usr/bin/env sh
sudo mkdir /mnt/$path && \
sudo mount -t btrfs -o ro /dev/$dev_id /mnt/$path
~~~

[^ro]

[^ro]: [`askubuntu.com/revisions/296342/3`][ro]

[ro]: https://askubuntu.com/revisions/296342/3#content:~:text=sudo%20mount-,%2Do%20ro,-/dev/sda1%20/media/2tb

1. Access it via something like `explorer.exe "\\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Temporary'}#.dir`.

1. Invoke a context menu.

1. Select "Open in Terminal".

### Expected Behavior

`wt` should invoke, at that path.

### Actual Behavior

Nothing occurs:

https://github.com/user-attachments/assets/3213e094-37fe-4431-b34a-363b8c7d1812

#### Tangential

If you're interested in whatever's occurred to those filenames depicted in the video, see https://github.com/files-community/Files/issues/17205#issue-3165260231. I can't be bothered to submit it to the graveyard that is Feedback Hub, unless it's a bug in WSL, like https://github.com/files-community/Files/issues/17205#issuecomment-2993691532 might demonstrate, because all my FH feedback is eventually deleted.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure through explorer.exe's “Open in Terminal” action at a long \\wsl path, using the listed WSL, Btrfs, and Windows Terminal setup. Trace how that action invokes wt and handles the path; done means wt opens successfully at the selected path. No source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
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.