See why rm * shows fewer files, but deletes all#303
Open
kittykatspiral wants to merge 4 commits into
Open
Conversation
- Replaced simple `.skip(offset as usize)` with `.skip_while` + conditional `.skip(1)` to skip entries up to the requested offset. - Added explicit handling to start from the beginning if offset is 0. - Removed unused variables and cleaned up parameter names by prefixing with underscores. - Kept clippy allows for safe casting and to reduce warnings. - This change aims to better conform to FUSE offset semantics when reading directories. Signed-off-by: kittykatspiral <anaflorentinaneacsu@gmail.com>
…SE behavior - revert changes to readdir that attempted to fix offset handling - added comments explaining known issues with FUSE and offset behavior - current logic causes tools like `rm *` to only list 100 files but still deletes all - fixing this properly would require deeper changes to iterator structure and offsets - leaving it as-is for now with comments for future contributors Signed-off-by: kittykatspiral <anaflorentinaneacsu@gmail.com>
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.
Title
See why rm * shows fewer files, but deletes all – #38
Description
This PR investigates the issue described in #38 where running rm * in a directory with more than 100 files results in only ~100 entries being listed, but all files still being deleted.
I originally attempted a fix by modifying the readdir function’s offset handling, but the required changes to the iterator's structure conflicted with the expected return types and caused compilation issues. Given the complexity and interconnectedness of the offset behavior in FUSE, especially how it handles continuation with offsets during reads, I decided instead to leave the logic unchanged and add inline comments explaining the current behavior and known limitations.
This way, the problem is now clearly documented in the code for future maintainers, and anyone picking up the issue later will have a better sense of what’s going on and why things are the way they are.
I also added comments near the key areas that contribute to the offset behavior. These highlight the spot where FUSE uses the offset value to decide where to resume the directory listing, which seems to be where this “incomplete listing” issue originates when using rm * or similar commands that rely on reading the full list.
Type of change
Checklist:
Additional Context
This PR doesn't fix the issue directly but serves as a documentation step for maintainers and contributors. Any “real” fix would likely require rethinking how DirectoryEntryIterator interacts with offsets or restructuring how offsets are assigned and used across the directory read logic — which is outside the scope of this PR and risky to do without a full test suite around it.
This is intended as a safe step toward understanding the bug, not a final resolution.