Skip to content

fix(transfer): emit hardlink uptodate and direct stats to stderr in -vv - #5901

Merged
oferchen merged 1 commit into
masterfrom
fix/uts-itemize-hardlink-uptodate-stats
Jun 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts-itemize-hardlink-uptodate-stats

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Fixes the upstream-testsuite itemize failure on CI run 27711564454, which surfaced two distinct divergences in the -vvplrH from/ to/ invocation (test 4 of testsuite/itemize.test):

  1. Hardlink-uptodate notice missing. When the destination already shares the source group leader's inode, upstream rsync emits \"%s is uptodate\" (hlink.c:218-224, gated by INFO_GTE(NAME, 2) && maybe_ATTRS_REPORT) instead of the bare path. We were recording the event as HardLink with no marker, so the CLI renderer fell through to the default arm and wrote the bare path (foo/extra instead of foo/extra is uptodate).

  2. Stats trailer not separated. Upstream's output_summary() (main.c:461) emits a blank rprintf(FCLIENT, \"\\n\") before the INFO_GTE(STATS, 1) totals so the testsuite's v_filt helper (sed -e '/^$/,$d') can strip the trailer when matching -vv goldens. The pre-existing separator in emit_transfer_summary only covered the verbose-listing -> stats path; the verbose-listing -> totals path was missing the blank line, so v_filt could not isolate the per-file region.

Additionally, mirror upstream's pipelined generator-first / receiver-second wire order in -vv mode by stable-partitioning events so the synchronous \"is uptodate\" notices precede the post-set_file_attrs bare-name lines.

Changes

  • engine::local_copy::LocalCopyRecord: add hardlink_uptodate field with with_hardlink_uptodate() setter and is_hardlink_uptodate() getter.
  • engine::local_copy::executor::file::copy::links: mark the is_already_hardlinked branch with with_hardlink_uptodate(true).
  • core::client::summary::ClientEvent: thread the flag through from_record_owned, from_progress, and for_test; expose is_hardlink_uptodate().
  • cli::frontend::progress::render:
    • Stable-partition events so uptodate emissions precede transferred lines in emit_verbose.
    • Add a HardLink if event.is_hardlink_uptodate() arm that emits \"is uptodate\" at the same INFO_GTE(NAME, 2) gate as MetadataReused.
    • Emit the blank separator line whenever a verbose listing is followed by a trailer (stats or totals), matching output_summary().

Upstream references

  • target/interop/upstream-src/rsync-3.4.4/hlink.c:218-224 - hardlink-uptodate notice.
  • target/interop/upstream-src/rsync-3.4.4/main.c:425-470 - output_summary() and \\n separator.
  • target/interop/upstream-src/rsync-3.4.4/testsuite/itemize.test:102-109 - the golden expecting foo/extra is uptodate and the transferred foo/config2 line last.

Test plan

  • cargo fmt --all -- --check
  • level_2_hardlink_uptodate_emits_is_uptodate_notice (Unix)
  • level_2_blank_line_precedes_totals_trailer
  • level_2_uptodate_lines_precede_transferred_lines
  • All existing verbose-mode tests still pass
  • interop / upstream-testsuite (itemize) job goes green

Two related divergences from upstream rsync's `testsuite/itemize.test`
were causing the `-vvplrH` (test 4) golden to mismatch on CI:

1. Hardlink-uptodate notice: when the destination already shares the
   source group leader's inode, upstream emits `"%s is uptodate"`
   (`hlink.c:218-224`, gated by `INFO_GTE(NAME, 2) && maybe_ATTRS_REPORT`)
   instead of the bare path. We were recording the event as `HardLink`
   with no marker, so the CLI renderer fell through to the default arm
   and wrote the bare path. Add `with_hardlink_uptodate(true)` to the
   `is_already_hardlinked` branch of the local-copy executor, thread the
   flag through `LocalCopyRecord` and `ClientEvent`, and render the
   suffix from `emit_verbose` when the gate is true.

2. Trailer separator: upstream's `output_summary()` (`main.c:461`) emits
   a blank `rprintf(FCLIENT, "\n")` before the `INFO_GTE(STATS, 1)`
   totals so the testsuite's `v_filt` helper (`sed -e '/^$/,$d'`) can
   strip the trailer when matching `-vv` goldens. The pre-existing
   separator in `emit_transfer_summary` only covered the verbose-listing
   -> stats path; cover the verbose-listing -> totals path too.

Additionally, mirror upstream's pipelined generator-first /
receiver-second wire order by stable-partitioning events so the
synchronous `"is uptodate"` notices precede the post-`set_file_attrs`
bare-name lines in `-vv` mode.

Regression coverage:
- `level_2_hardlink_uptodate_emits_is_uptodate_notice`
- `level_2_blank_line_precedes_totals_trailer`
- `level_2_uptodate_lines_precede_transferred_lines`
@oferchen
oferchen force-pushed the fix/uts-itemize-hardlink-uptodate-stats branch from fdb7dab to 836765e Compare June 17, 2026 19:30
@oferchen
oferchen merged commit b622242 into master Jun 17, 2026
3 of 5 checks passed
@oferchen
oferchen deleted the fix/uts-itemize-hardlink-uptodate-stats branch June 17, 2026 19:33
@github-actions github-actions Bot added the bug Something isn't working label Jun 17, 2026
oferchen added a commit that referenced this pull request Aug 24, 2026
…vv (#5901)

Two related divergences from upstream rsync's `testsuite/itemize.test`
were causing the `-vvplrH` (test 4) golden to mismatch on CI:

1. Hardlink-uptodate notice: when the destination already shares the
   source group leader's inode, upstream emits `"%s is uptodate"`
   (`hlink.c:218-224`, gated by `INFO_GTE(NAME, 2) && maybe_ATTRS_REPORT`)
   instead of the bare path. We were recording the event as `HardLink`
   with no marker, so the CLI renderer fell through to the default arm
   and wrote the bare path. Add `with_hardlink_uptodate(true)` to the
   `is_already_hardlinked` branch of the local-copy executor, thread the
   flag through `LocalCopyRecord` and `ClientEvent`, and render the
   suffix from `emit_verbose` when the gate is true.

2. Trailer separator: upstream's `output_summary()` (`main.c:461`) emits
   a blank `rprintf(FCLIENT, "\n")` before the `INFO_GTE(STATS, 1)`
   totals so the testsuite's `v_filt` helper (`sed -e '/^$/,$d'`) can
   strip the trailer when matching `-vv` goldens. The pre-existing
   separator in `emit_transfer_summary` only covered the verbose-listing
   -> stats path; cover the verbose-listing -> totals path too.

Additionally, mirror upstream's pipelined generator-first /
receiver-second wire order by stable-partitioning events so the
synchronous `"is uptodate"` notices precede the post-`set_file_attrs`
bare-name lines in `-vv` mode.

Regression coverage:
- `level_2_hardlink_uptodate_emits_is_uptodate_notice`
- `level_2_blank_line_precedes_totals_trailer`
- `level_2_uptodate_lines_precede_transferred_lines`
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