Skip to content

fix: deduplicate non-consecutive directory entries in readdir - #70

Open
JaxCalder wants to merge 1 commit into
mainfrom
fix/report-after-friends
Open

JaxCalder wants to merge 1 commit into
mainfrom
fix/report-after-friends

Conversation

@JaxCalder

Copy link
Copy Markdown
Contributor

Fix readdir emitting duplicate directory entries when file entries appear between drivers sharing the same parent directory.

Root cause: The original dedup loop in _readdir only skipped consecutive directory entries. File entries between same-parent drivers broke the loop and caused duplicates.

Fix: Use a dmlist_context_t in directory_node_t to track already-emitted directory names across the entire readdir traversal, not just consecutive entries.

Files changed:

  • src/dmdevfs.c: Core dedup fix in directory_node_t, _opendir, _readdir, and _closedir
  • tests/fixtures/config/readdir_dedup.ini: New fixture exercising the non-consecutive duplicate scenario

Use a dmlist_context_t in directory_node_t to track already-emitted
directory names across the entire readdir traversal, not just
consecutive entries. Previously file entries between same-parent
drivers would break the dedup loop and produce duplicate directory
entries.
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