Skip to content

Fix 9 ops/ bugs: symlink deref, truncation overwrite, CRLF, cross-typ natsort, perms exposure#29

Merged
leszek3737 merged 3 commits into
mainfrom
fix10
May 13, 2026
Merged

Fix 9 ops/ bugs: symlink deref, truncation overwrite, CRLF, cross-typ natsort, perms exposure#29
leszek3737 merged 3 commits into
mainfrom
fix10

Conversation

@leszek3737

@leszek3737 leszek3737 commented May 13, 2026

Copy link
Copy Markdown
Owner
  • batch.rs: extract dedup_paths() so batch_delete uses original paths, not canonicalized (symlink target no longer deleted)
  • helpers.rs: rename path_contains_canonical → path_starts_with (name now matches behavior)
  • natsort.rs: add cross-type check in natsort() to match NatKeySegment::cmp ordering
  • search.rs: guard all 13 outcome.truncated assignments with is_none() (first-wins); strip trailing \r from CRLF files; remove #[cfg(test)] from content search functions
  • chunk_copy.rs: move preserve_permissions() before data write in publish_temp fallback; hash ThreadId via DefaultHasher for stable temp names; add #[cfg(unix)] guard on symlink early-return
  • Add 12 new tests covering dedup logic, symlink deletion, cross-type natsort, CRLF strip, truncation precedence, symlink copy preservation

…e natsort, perms exposure

- batch.rs: extract dedup_paths() so batch_delete uses original paths, not canonicalized (symlink target no longer deleted)
- helpers.rs: rename path_contains_canonical → path_starts_with (name now matches behavior)
- natsort.rs: add cross-type check in natsort() to match NatKeySegment::cmp ordering
- search.rs: guard all 13 outcome.truncated assignments with is_none() (first-wins); strip trailing \r from CRLF files; remove #[cfg(test)] from content search functions
- chunk_copy.rs: move preserve_permissions() before data write in publish_temp fallback; hash ThreadId via DefaultHasher for stable temp names; add #[cfg(unix)] guard on symlink early-return
- Add 12 new tests covering dedup logic, symlink deletion, cross-type natsort, CRLF strip, truncation precedence, symlink copy preservation

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @leszek3737, you have reached your weekly rate limit of 1500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@leszek3737 leszek3737 changed the title Fix 9 ops/ bugs: symlink deref, truncation overwrite, CRLF, cross-typ… Fix 9 ops/ bugs: symlink deref, truncation overwrite, CRLF, cross-typ natsort, perms exposure May 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds Unix symlink copy support, prioritizes digits in natural sorting, and ensures the first truncation reason is preserved during file searches, which now also strip CRLF line endings. It also refactors batch deletion to avoid resolving symlinks and improves temporary file naming by hashing thread IDs. Review feedback indicates that the symlink copy logic should handle the "overwrite" parameter and return a zero size, points out O(N^2) complexity in path deduplication, and recommends cleaning up partial files if a copy operation fails.

Comment thread src/ops/chunk_copy.rs
Comment thread src/ops/batch.rs
Comment thread src/ops/chunk_copy.rs Outdated
- Symlink copy: respect overwrite param by removing dest before creating link; return 0 instead of metadata.len()
- publish_temp fallback: clean up partial dest file on write/perm error to prevent AlreadyExists on retry
@leszek3737
leszek3737 merged commit 6ea5dd3 into main May 13, 2026
5 checks passed
@leszek3737
leszek3737 deleted the fix10 branch May 13, 2026 13:47
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