Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .. cluster number for first-level dirs #99

Merged

Conversation

badicsalex
Copy link
Contributor

On FAT32, the cluster number of the root directory is 0 in dir entries (and not the actually used cluster)

Copy link
Owner

@rafalh rafalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change. It made me find another bug, which I fixed in a276bb9.
Was this problem also found by fsck?
Please apply my suggestion and add an entry in the CHANGELOG file

src/dir.rs Outdated Show resolved Hide resolved
@badicsalex
Copy link
Contributor Author

badicsalex commented Oct 25, 2024

Was this problem also found by fsck?

Yes, indeed. I had one more error, which seemed like a larger undertaking to fix:

Free cluster summary uninitialized (should be 123456)

EDIT: this was probably caused by me not dropping the fs object before running fsck, because it does not reproduce in the newly added test.

@badicsalex badicsalex force-pushed the fix-cluster-number-for-dotdot branch 2 times, most recently from 5e64b19 to dd867af Compare October 28, 2024 09:31
@badicsalex
Copy link
Contributor Author

Added a very simple fsck test, and also cherry-picked the fix from #100, so it can all be merged at once.

The current code makes invalid dir entries, because the first two slots
should be . and .., but with LFNs, it's

    LFN for .
    .
    LFN for ..
    ..

We should probably not create LFN's when not needed anyway, but that's not
implemented in this patch.
On FAT32, the cluster number of / is 0 in dir entries (and not the actually
used cluster)
@rafalh rafalh merged commit c4bb769 into rafalh:master Nov 3, 2024
4 checks passed
@badicsalex badicsalex deleted the fix-cluster-number-for-dotdot branch November 4, 2024 07:37
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.

2 participants