Skip to content

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

Open
@RokeJulianLockhart

Description

@RokeJulianLockhart

Windows Terminal version

  1. #!/usr/bin/env pwsh
    Get-AppxPackage Microsoft.WindowsTerminal
  2. 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. #!/usr/bin/env pwsh
    Get-ComputerInfo | Select-Object -Property @(
    	'OsName',
    	'OsOperatingSystemSKU',
    	'OsVersion',
    	'OsBuildNumber'
    ) | Format-List
  2. OsName               : Microsoft Windows 11 Pro
    OsOperatingSystemSKU : 48
    OsVersion            : 10.0.26120
    OsBuildNumber        : 26120

Other Software

  1. Obviously, explorer.exe applies:

    1. #!/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

    2. 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
  2. However, Bug: The first file and directory names to exceed the 260-character MAX_PATH limit appear truncated. files-community/Files#17133 (comment) could also apply here:

    1. #!/usr/bin/env pwsh
      Get-AppxPackage FilesPreview
    2. Publisher         : CN=Yair Aichenbaum, O=Yair Aichenbaum, L=Baltimore, S=Maryland, C=US
      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.

  2. Install the .MSIXBundle from WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5:

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

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

    2

  4. When the correct filesystem has been identified:

    #!/usr/bin/env pwsh
    #Requires -PSEdition Core
    If ($IsWindows) { sudo wsl --mount \\.\PHYSICALDRIVE1 --bare }
  5. Likewise, on WSL:

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

    This shall return output similar to the undermentioned:

    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.

  6. When the correct filesystem has been identified:

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

    3

  7. 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.

  8. Invoke a context menu.

  9. Select "Open in Terminal".

Expected Behavior

wt should invoke, at that path.

Actual Behavior

Nothing occurs:

20250621-1755-50.5609387.mp4

Tangential

If you're interested in whatever's occurred to those filenames depicted in the video, see files-community/Files#17205 (comment). I can't be bothered to submit it to the graveyard that is Feedback Hub, unless it's a bug in WSL, like files-community/Files#17205 (comment) might demonstrate.

Footnotes

  1. stackoverflow.com/revisions/45517267/4

  2. blog.bryanroessler.com/2020-12-14-btrfs-on-wsl2/

  3. askubuntu.com/revisions/296342/3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions