Long non-Latin filename (>255 bytes UTF-8) crashes entire directory listing via getdents64 on /mnt drvfs (9p) - works fine on virtiofs
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
### Windows Version
Microsoft Windows [Version 10.0.26200.8875]
### WSL Version
2.9.4.0
### Are you using WSL 1 or WSL 2?
- [x] 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 "" shorter.png` from WSL confirms Linux can't represent the name at all:
```
mv: cannot stat '': 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:
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 2>&1
...
openat(AT_FDCWD, , O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
newfstatat(AT_FDCWD, , {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 +++
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the supplied filename and strace the getdents64 calls on a 9p-mounted /mnt path. Compare the 9p/DrvFs behavior with virtiofs; done means an oversized UTF-8 entry no longer makes directory enumeration return EIO and the remaining entries are listed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100