Skip to content

fix: correct itemize time position T/t to match upstream - #2745

Merged
oferchen merged 3 commits into
masterfrom
fix/itemize-changes-interop
Mar 17, 2026
Merged

oferchen merged 3 commits into
masterfrom
fix/itemize-changes-interop

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Fix server-side format_iflags to correctly distinguish t vs T at position 4 of the 11-character itemize string, matching upstream rsync log.c:708-717
  • Add ItemizeContext struct carrying preserve_mtimes and receiver_symlink_times so the formatter has the option/capability context needed for the decision
  • Add ITEM_REPORT_TIMEFAIL constant (bit 2, shared with ITEM_REPORT_SIZE per rsync.h:217) for symlink time-set failure detection

Details

Upstream rsync uses global variables to decide position 4:

  • Non-symlinks (log.c:716-717): T when !preserve_mtimes (user did not pass --times), t otherwise
  • Symlinks (log.c:708-710): T when !preserve_mtimes || !receiver_symlink_times || ITEM_REPORT_TIMEFAIL, t otherwise

The oc-rsync implementation always emitted lowercase t, ignoring these conditions. This caused incorrect output when --times was not used or when symlink timestamp preservation was unavailable.

Both the generator (protocol_io.rs) and receiver (mod.rs) callers now build an ItemizeContext from config.flags.times and CompatibilityFlags::SYMLINK_TIMES.

Test plan

  • 12 new unit tests covering all T/t scenarios: file with/without preserve_mtimes, symlink with/without preserve_mtimes, symlink with/without receiver_symlink_times, symlink with TIMEFAIL bit, file with SIZE bit (not confused with TIMEFAIL), directory without preserve_mtimes, no ITEM_REPORT_TIME always produces dot
  • All existing itemize tests updated to pass default context (preserve_mtimes=true, receiver_symlink_times=true)
  • CI: fmt+clippy, nextest, Windows, macOS, Linux musl

@github-actions github-actions Bot added the bug Something isn't working label Mar 16, 2026
The server-side format_iflags always emitted lowercase t at position 4
when ITEM_REPORT_TIME was set. Upstream rsync (log.c:708-717) distinguishes:

- Non-symlinks: T when !preserve_mtimes (--times not set), t otherwise
- Symlinks: T when !preserve_mtimes, !receiver_symlink_times, or
  ITEM_REPORT_TIMEFAIL (bit 2), t otherwise

Add ItemizeContext to carry preserve_mtimes and receiver_symlink_times
into the formatting function. Add ITEM_REPORT_TIMEFAIL constant (bit 2,
shared with ITEM_REPORT_SIZE for non-symlinks per rsync.h:217). Update both
generator and receiver callers to build context from config and compat flags.
@oferchen
oferchen force-pushed the fix/itemize-changes-interop branch from 5cd4e0c to b211dbf Compare March 17, 2026 01:19
@oferchen
oferchen merged commit 7bc732f into master Mar 17, 2026
31 checks passed
@oferchen
oferchen deleted the fix/itemize-changes-interop branch March 17, 2026 04:48
oferchen added a commit that referenced this pull request May 1, 2026
* fix: correct itemize time position T/t distinction to match upstream

The server-side format_iflags always emitted lowercase t at position 4
when ITEM_REPORT_TIME was set. Upstream rsync (log.c:708-717) distinguishes:

- Non-symlinks: T when !preserve_mtimes (--times not set), t otherwise
- Symlinks: T when !preserve_mtimes, !receiver_symlink_times, or
  ITEM_REPORT_TIMEFAIL (bit 2), t otherwise

Add ItemizeContext to carry preserve_mtimes and receiver_symlink_times
into the formatting function. Add ITEM_REPORT_TIMEFAIL constant (bit 2,
shared with ITEM_REPORT_SIZE for non-symlinks per rsync.h:217). Update both
generator and receiver callers to build context from config and compat flags.

* formatting

* fix: update itemize tests to match corrected formatting
oferchen added a commit that referenced this pull request May 5, 2026
* fix: correct itemize time position T/t distinction to match upstream

The server-side format_iflags always emitted lowercase t at position 4
when ITEM_REPORT_TIME was set. Upstream rsync (log.c:708-717) distinguishes:

- Non-symlinks: T when !preserve_mtimes (--times not set), t otherwise
- Symlinks: T when !preserve_mtimes, !receiver_symlink_times, or
  ITEM_REPORT_TIMEFAIL (bit 2), t otherwise

Add ItemizeContext to carry preserve_mtimes and receiver_symlink_times
into the formatting function. Add ITEM_REPORT_TIMEFAIL constant (bit 2,
shared with ITEM_REPORT_SIZE for non-symlinks per rsync.h:217). Update both
generator and receiver callers to build context from config and compat flags.

* formatting

* fix: update itemize tests to match corrected formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant