Skip to content

fix(ApfsDir): fallback to linear scan on hash lookup failure for unicode filenames - #218

Open
adithayyil wants to merge 1 commit into
sgan81:masterfrom
adithayyil:master
Open

fix(ApfsDir): fallback to linear scan on hash lookup failure for unicode filenames#218
adithayyil wants to merge 1 commit into
sgan81:masterfrom
adithayyil:master

Conversation

@adithayyil

Copy link
Copy Markdown

Directories with certain Unicode filenames (e.g. emoji) are visible via readdir but inaccessible via lookup. The hash apfs-fuse computes for the filename doesn't match the hash stored on disk by macOS, causing the B-tree lookup to silently fail with ENOENT.

The fix adds a linear scan fallback in LookupName: if the hash-based B-tree lookup fails, fall back to iterating through the parent directory entries via ListDirectory and compare filenames byte-by-byte. Only triggers on hash misses so normal lookups are unaffected.

Tested on an encrypted APFS USB volume (case-sensitive) with an emoji directory name (🫣) that was previously completely inaccessible on Linux.

Hash mismatch can occur with certain Unicode filenames (ex: emojis)
due to normalization differences between macOS and the hash computed
by apfs-fuse. Fall back to a byte-by-byte linear scan of directory
entries before giving up, allowing access to previously inaccessible
directories.
Copilot AI review requested due to automatic review settings May 6, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant