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

Don't create LFNs for . and .. #100

Closed

Conversation

badicsalex
Copy link
Contributor

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

  1. LFN for .
    
  2. .
    
  3. LFN for ..
    
  4. ..
    

We should probably not create LFN's when not needed anyway, but that's not implemented in this patch.

fsck output for the current code:

fsck from util-linux 2.40.2
fsck.fat 4.2 (2021-01-31)
/home/A.
  Expected a valid '.' entry in this slot.
  Moving entry down.
/home/.
  Expected a valid '..' entry in this slot.
  Moving entry down.
/home/..
  Bad short file name (..).
  Auto-renaming it.
  Renamed to FSCK0000.000
/home/.
  Bad short file name (.).
  Auto-renaming it.
  Renamed to FSCK0000.001
/  and
/home/FSCK0000.000
  share clusters.
  Truncating second to 0 bytes because first is FAT32 root dir.
/home/FSCK0000.001
 Start does point to containing directory. Deleting entry.

@rafalh
Copy link
Owner

rafalh commented Oct 25, 2024

Thanks for this change! It would be great to run fsck in CI to catch such issues automatically.
Could you please add CHANGELOG entry in "Bug fixes:" section?

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.
@badicsalex
Copy link
Contributor Author

I put this patch together with #99 for easier merging.

@badicsalex badicsalex closed this Nov 2, 2024
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