Skip to content

fix: empty ext4 directories return STATUS_NO_SUCH_FILE (Closes #90) - #101

Open
Avalonia-0 wants to merge 2 commits into
bobranten:masterfrom
Avalonia-0:fix/empty-dir-enumeration
Open

fix: empty ext4 directories return STATUS_NO_SUCH_FILE (Closes #90)#101
Avalonia-0 wants to merge 2 commits into
bobranten:masterfrom
Avalonia-0:fix/empty-dir-enumeration

Conversation

@Avalonia-0

@Avalonia-0 Avalonia-0 commented Jul 19, 2026

Copy link
Copy Markdown

Problem

When enumerating an empty ext4 directory, the driver explicitly skips . and .. in two code paths:

  1. Ext2FillEntry callback (HTREE-indexed directories)
  2. Linear while loop in Ext2QueryDirectory

For empty directories these are the only entries. Skipping them causes efc_start to remain 0, returning
STATUS_NO_SUCH_FILEERROR_FILE_NOT_FOUND → Java NIO NoSuchFileException.

Most notably affects Minecraft saves on ext4 volumes — worlds cannot be re-entered after creation.

Fix

Three changes in Ext4Fsd/dirctl.c (+19/-15):

  1. Ext2FillEntry callback: Removed ./.. skip logic
  2. while loop: Removed same skip logic
  3. errorout: Always returns STATUS_NO_MORE_FILES as safety net

Windows I/O Manager already filters . and .. — the driver need not skip them.

Testing

  • Windows 11 + Ext2Fsd 0.71 on ext4 data disk (1.37TB)
  • Minecraft: saves on ext4 can be created and re-entered
  • Both HTREE and linear directory formats covered

Closes #90

Fixer and others added 2 commits July 19, 2026 13:03
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.
@Avalonia-0 Avalonia-0 changed the title fix: empty ext4 directories return STATUS_NO_SUCH_FILE causing NoSuchFileException fix: empty ext4 directories return STATUS_NO_SUCH_FILE (Closes #90) Jul 19, 2026
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.

Empty folders are not reachable

1 participant