Skip to content

Long non-Latin filename (>255 bytes UTF-8) crashes entire directory listing via getdents64 on /mnt drvfs (9p) - works fine on virtiofs #41192

Description

@whoami730

Windows Version

Microsoft Windows [Version 10.0.26200.8875]

WSL Version

2.9.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.18.35.2-1

Distro Version

Ubuntu 26.04

Other Software

No response

Repro Steps

  1. Create a file with this exact 143-char filename (257 bytes in UTF-8) on a WSL-mounted drive, say C: drive:
    Screenshot 2025-11-05 at 22-15-27 तृप्ति से परम तृप्ति पूज्य गुरु माँ विभाश्री के जीवन की अलौकिक यात्रा Pujya Guru Maa VibhaShree - YouTube.png
  2. Add other files to the folder containing this file, including files that are both before & after the above filename in lexicographic order.
  3. Ensure the drive is mounted via 9p: mount | grep /mnt/c
  4. ls the folder containing it.

Expected Behavior

Directory lists normally. This filename exceeds Linux's 255-byte NAME_MAX by 2 bytes in UTF-8, though it's valid on NTFS (which measures UTF-16 code units, not UTF-8 bytes) — a filename-length issue, not a path-depth one. One unencodable entry shouldn't block listing the rest of the directory.

$ ls
1758974745371.jpg
Screenshot 2025-11-05 at 22-15-27 तृप्ति से परम तृप्ति पूज्य गुरु माँ विभाश्री के जीवन की अलौकिक यात्रा Pujya Guru Maa VibhaShree - YouTube.png
upscaled_1758974745371.jpg

Actual Behavior

Entire listing fails, with some files listed but others not:

$ ls
ls: general io error: Input/output error (os error 5)
1758974745371.jpg

strace shows the raw syscall failing, not a per-file stat call:

getdents64(3, 0x60e1fce1c480, 32768)    = -1 EIO (Input/output error)

Running mv "<filename>" shorter.png from WSL confirms Linux can't represent the name at all:

mv: cannot stat '<filename>': File name too long

Confirmed workaround: setting virtiofs=true in .wslconfig resolves this completely - the same file, in the same folder, lists cleanly under virtiofs.

Also, listing the directory from windows (powershell) is non-issue -

> ls

    Directory: <some_path>

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          27-09-2025    17:43         213902 1758974745371.jpg
-a---          05-11-2025    22:15        1621646 Screenshot 2025-11-05 at 22-15-27 तृप्ति से परम तृप्ति पूज्य गुरु माँ विभाश्री के जीवन की अलौकिक यात्रा Pujya Guru Maa VibhaShree -
                                                  YouTube.png
-a---          27-09-2025    17:45         645080 upscaled_1758974745371.jpg

Diagnostic Logs

$ strace -f -e trace=openat,getdents64,newfstatat,lstat ls <directory> 2>&1
...
openat(AT_FDCWD, <directory>, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
newfstatat(AT_FDCWD, <directory>, {st_mode=S_IFDIR|0777, st_size=4096, ...}, 0) = 0
getdents64(3, 0x562df3c50180 /* 3 entries */, 32768) = 88
getdents64(3, 0x562df3c50180, 32768)    = -1 EIO (Input/output error)
ls: general io error: Input/output error (os error 5)
1758974745371.jpg
+++ exited with 1 +++

Metadata

Metadata

Assignees

No one assigned

    Labels

    emailed-logsLogs have been emailedfile systemneeds-investigationlikely actionable and/or needs more investigationwsl2Issue/feature applies to WSL 2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions