rtk-ai / rtk-ai/rtk

rsync: output filter destroys verbose/dry-run transfer listing — redirected output captures 'ok (synced)' instead of the file list

Open
#2,807 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli bug priority:high
Dominant language
Rust
Stars
81.1k
Forks
5.1k
Avg merge
4d 21h
Merged PRs (30d)
35

Description

Version: rtk 0.38.0 (reproduced); the responsible filter is unchanged on develop (src/filters/rsync.toml: { pattern = "total size is", message = "ok (synced)", unless = "error|failed|No such file" }), so this should still reproduce on v0.43.0.

Summary

The rsync output filter replaces the entire verbose / dry-run transfer listing with a one-line ok (synced) summary. When stdout is redirected or piped, the file or consumer receives the summary instead of the listing — silently corrupting any programmatic use of rsync's output.

Repro

mkdir -p /tmp/demo/src /tmp/demo/dst
for i in $(seq 1 100); do echo "content $i" > "/tmp/demo/src/f$i.txt"; done

# Through rtk:
rtk rsync -aLnv /tmp/demo/src/ /tmp/demo/dst/ > /tmp/out.txt
wc -l < /tmp/out.txt      # 1  (the file contains "ok (synced)")

# Native:
rsync -aLnv /tmp/demo/src/ /tmp/demo/dst/ > /tmp/native.txt
wc -l < /tmp/native.txt   # 100+ (real incremental file list)

Why this is a bug and not just compaction

With -n (dry run) and/or -v/-i, the transfer listing is the requested output — the whole point of the invocation is to enumerate what would transfer. There is no "safe" compact form of it. Downstream consumers that count or diff the listing (e.g. > file && wc -l < file, | grep -c) get answers derived from ok (synced) and reach false conclusions (in our case, several hours of debugging a healthy sync setup that the filtered output made look broken).

Expected behavior

One of:

  • Exempt -n / -v / -i invocations from the rsync filter (the listing is the payload), or
  • Don't apply output filters when stdout is not a TTY — this is the general class tracked in #1282, with #1841 as the proposed TOML-filter fix (see also #1060).

This report adds a concrete rsync-specific data point to that class: the filter's information loss isn't cosmetic, it inverts the meaning of dry-run output.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/filters/rsync.toml and reproduce the redirected-output commands in the issue, comparing rtk with native rsync. Review the related output-filter discussions in #1282, #1841, and #1060 before choosing the scope. Done means verbose, itemized, or dry-run listings remain available to redirected and piped consumers instead of being replaced by the summary.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.