fix: empty ext4 directories return STATUS_NO_SUCH_FILE (Closes #90) - #101
Open
Avalonia-0 wants to merge 2 commits into
Open
fix: empty ext4 directories return STATUS_NO_SUCH_FILE (Closes #90)#101Avalonia-0 wants to merge 2 commits into
Avalonia-0 wants to merge 2 commits into
Conversation
When a directory contains only '.' and '..' entries (an effectively empty directory), Ext2QueryDirectory skipped those entries and wrote nothing to the output buffer (fc.efc_start == 0). It then returned STATUS_NO_SUCH_FILE on the first query, which Windows translates to ERROR_FILE_NOT_FOUND -- causing FindFirstFileW / NtQueryDirectoryFile to report that the directory itself doesn't exist. Fix: return STATUS_NO_MORE_FILES instead, telling callers the enumeration completed with no matching entries. Co-Authored-By: Claude <noreply@anthropic.com>
Ext4Fsd 0.71 skips '.' and '..' entries in both the linear while-loop and HTREE callback paths. For empty directories this leaves fc.efc_start == 0, causing the errorout path to return STATUS_NO_SUCH_FILE on the first query. FindFirstFileW maps this to ERROR_FILE_NOT_FOUND, and Java NIO's walkFileTree throws NoSuchFileException. Fix: - Remove explicit . and .. skip in Ext2FillEntry (HTREE path) - Remove explicit . and .. skip in while loop (linear path) - Change errorout to always return STATUS_NO_MORE_FILES instead of conditionally returning STATUS_NO_SUCH_FILE Windows filters . and .. itself, so returning them is safe. Tested: Minecraft saves on ext4 can now be re-opened after creation on Windows 11 x64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When enumerating an empty ext4 directory, the driver explicitly skips
.and..in two code paths:Ext2FillEntrycallback (HTREE-indexed directories)whileloop inExt2QueryDirectoryFor empty directories these are the only entries. Skipping them causes
efc_startto remain 0, returningSTATUS_NO_SUCH_FILE→ERROR_FILE_NOT_FOUND→ Java NIONoSuchFileException.Most notably affects Minecraft saves on ext4 volumes — worlds cannot be re-entered after creation.
Fix
Three changes in
Ext4Fsd/dirctl.c(+19/-15):./..skip logicSTATUS_NO_MORE_FILESas safety netWindows I/O Manager already filters
.and..— the driver need not skip them.Testing
Closes #90