Skip to content

fix: report OS errors as strerror (errno) like 3.5.1's rsyserr - #8354

Merged
oferchen merged 6 commits into
masterfrom
fix/os-error-text
Nov 14, 2026
Merged

oferchen merged 6 commits into
masterfrom
fix/os-error-text

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Report OS errors the way rsync 3.5.1 does. Every failed system call is rendered as MESSAGE: strerror (errno) at the call site, from the raw errno, as rsyserr() does (log.c:480-500). Before this, Rust's io::Error rendering ... (os error N) reached the user.

  • logging::rsyserr / rsyserr_io format log.c's PROG: [role] MSG: strerror (N). upstream_errno_text and upstream_strerror give the strerror (N) tail and the bare strerror for sites where upstream prints the text without the number. The errno comes from raw_os_error(), including through a tagged io::Error's payload.
  • Windows: the reference is 3.5.1 under Cygwin. Win32 and Winsock codes map through Cygwin's errmap tables, with EACCES as the fallback, and the text is Cygwin's strerror. Both are generated from newlib-cygwin b5a7119 into crates/logging/src/cygwin_errno.rs.
  • Each site now uses upstream's text at upstream's reporting point:
    • cli: failed to open files-from file %s: %s (options.c:2667); failed to open log-file %s via rsyserr, then Ignoring "log file" setting., non-fatal as logfile_open (log.c:175-182); could not open password file %s (authenticate.c:246).
    • core: early-input failed to open %s (clientserver.c:306); failed to set socket option %s (socket.c:889).
    • daemon: early exec preparation failed, pre-xfer exec preparation failed, name-converter exec preparation failed (clientserver.c:1000/1018/1027); chdir %s failed (:691); chroot test failed: %s with strerror only (:887); failed to open %sclude file %s (exclude.c:1714).
    • engine: local-copy I/O errors. metadata: MetadataError. protocol: bind() failed: %s (socket.c). rsync_io: OpenSSH's Can't open user config file %s: %s, strerror only.
    • transfer: backup failure, mkdir %s failed (main.c:817), files-from, destination-root create. EILSEQ text for iconv skips.
  • Tests no longer spell Rust's rendering; they use the logging helpers or upstream's literal text.

Gate

tests/os_error_text_gate.rs:

  • Runtime cells through Local, ShellPush, ShellPull, DaemonPush and DaemonPull: ENOENT, EACCES and ENOSPC (/dev/full).
  • Per-site cells: files-from, --log-file, --early-input, --password-file.
  • Every cell asserts stderr has no "os error", that oc prints upstream's cause text, and, with OC_RSYNC_UPSTREAM_BIN_3_5_1 set, that 3.5.1 prints the same text and errno.
  • A static lint fails if any source line outside errno_text.rs spells Rust's os-error rendering.

On master f7beb93 the gate fails 5 of 10 (files-from, password-file, log-file, early-input, and the static lint). Mutation: making upstream_errno_text return the Display text fails 5 cells; reverting only the early-input site fails exactly that cell.

Not in this PR

  • Server destination-root wording and exit 11: task 576.
  • The usage-error line layout (files-from and password lines still use the one-line prefix plus trailer): the cause-A batch.
  • The remaining {e} sites: the per-crate batches.

Test plan

  • cargo nextest run --test os_error_text_gate with the 3.5.1 oracle: 10/10; on master 5 fail.
  • logging unit tests including the Cygwin mapping: 2 -> No such file or directory (2), 5 -> Permission denied (13), 10061 -> Connection refused (111).
  • workspace clippy -D warnings, windows-gnu check, per-crate no-default clippy.

@github-actions github-actions Bot added the bug Something isn't working label Nov 10, 2026
@oferchen
oferchen force-pushed the fix/os-error-text branch 4 times, most recently from 338ec9b to ba2cfe7 Compare November 11, 2026 10:31
@oferchen
oferchen force-pushed the fix/os-error-text branch 4 times, most recently from 34193cb to e86558a Compare November 13, 2026 16:16
@oferchen
oferchen merged commit 9e10b76 into master Nov 14, 2026
88 checks passed
@oferchen
oferchen deleted the fix/os-error-text branch November 14, 2026 10:23
oferchen added a commit that referenced this pull request Nov 14, 2026
…odebase (#8381)

Updates and cleans up root documentation against the current codebase
and upstream rsync 3.5.1 reference:\n\n- **README.md**: Update required
status check count from 15 to 16 and include `rustdoc links` to match
the repository ruleset.\n- **SECURITY.md**: Remove stale claim that
`--fake-super` is unimplemented (implemented in PR #8348;
`daemon-namecvt-empty-response` passes on Linux non-root legs), and
update cargo-fuzz target counts to 36 total / 26 in `fuzz/` (adding
`connection_handoff`) / 31 daily sweep targets.\n- **CHANGELOG.md**: Add
recent `[Unreleased]` entries (#8354, #8364, #8372, #8375) and remove
stray blank lines inside `### Changed`.
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