Skip to content

Surface filenames that aren't valid UTF-8 #4

Description

@rayhanadev

ext4 filenames are arbitrary bytes, but FSKit wants UTF-8 (FSFileName.string is nil for anything that isn't). So if a directory has an entry whose name isn't valid UTF-8 — trivial to create from Linux — we skip it entirely during enumeration and refuse to look it up. It's invisible from macOS, and worse: a directory containing only such entries reports ENOTEMPTY on rmdir even though Finder shows it empty.

FSFileName can carry raw bytes via FSFileName(data:), so the fix is to stop requiring valid UTF-8 end to end — build lwext4 paths from the raw bytes and pack enumeration entries with FSFileName(data:) so foreign names round-trip. The relevant guards are in Ext4Volume.enumerateDirectory (the String(bytes:encoding:.utf8) skip) and validEntryName.

Decent first issue if you're comfortable with the FSKit name APIs: the change is localized, and the only fiddly part is handling non-UTF-8 bytes in the path you hand to lwext4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions