Skip to content

fix: update .. on rename, reject dot-only names, remove needless dir flush - #66

Merged
bugadani merged 3 commits into
masterfrom
fix/directory-fixes-rebased
Oct 23, 2026
Merged

bugadani merged 3 commits into
masterfrom
fix/directory-fixes-rebased

Conversation

@MabezDev

@MabezDev MabezDev commented May 1, 2026 •

Copy link
Copy Markdown
Owner
  • Update the .. entry when a directory moves to a new parent. Write cluster 0 when the new parent is the root. Find .. before the disk changes.
  • Reject rename of . and .. with Error::InvalidInput.
  • Reject names that contain only dots and spaces with the new Error::InvalidFileName.

@MabezDev
MabezDev force-pushed the fix/directory-fixes-rebased branch 2 times, most recently from 97dbf65 to 577e2f9 Compare May 1, 2026 17:12
Comment thread embedded-fatfs/src/dir.rs
loop {
let raw_entry = DirEntryData::deserialize(&mut self.stream).await?;
// access time has changed
self.stream.flush().await?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

flush wasn't actually removed

Comment thread embedded-fatfs/src/dir.rs Outdated
if name != "." && name != ".." {
let trimmed = name.trim_end_matches(|c| c == '.' || c == ' ');
if trimmed.is_empty() {
return Err(Error::InvalidFileNameLength);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the right error to return? The length isn't the issue here, but the actual value is.

MabezDev and others added 2 commits October 23, 2026 20:23
…ecessary flush

- Update '..' entry to point to the new parent directory when
  rename_internal moves a directory between parents, as required
  by the FAT specification.
- Reject filenames consisting entirely of dots and/or spaces in
  validate_long_name, since they are effectively empty after the
  FAT-mandated trailing dot/space trimming. The special '.' and
  '..' entries are exempted.
- Remove the unconditional stream flush after every directory entry
  read in DirIter::read_dir_entry, which was a performance issue
  on embedded devices with no functional purpose.
… InvalidFileName

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bugadani
bugadani force-pushed the fix/directory-fixes-rebased branch from 577e2f9 to 32c48e0 Compare October 23, 2026 18:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bugadani
bugadani merged commit 5113fff into master Oct 23, 2026
4 checks passed
@bugadani
bugadani deleted the fix/directory-fixes-rebased branch October 23, 2026 18:52
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