Skip to content

Escape Unix filenames in SFV header comments - #336

Merged
rhash merged 1 commit into
rhash:masterfrom
omrzk:fix/escape-sfv-header-filenames
Nov 21, 2026
Merged

rhash merged 1 commit into
rhash:masterfrom
omrzk:fix/escape-sfv-header-filenames

Conversation

@omrzk

@omrzk omrzk commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

A filename containing a newline breaks its SFV metadata comment into multiple lines. The resulting manifest fails rhash --check even though its checksum entry is valid. Carriage returns also corrupt the displayed header.

Print the filename through the existing escaping helper without a format string, so Unix SFV comments escape backslashes, carriage returns and newlines as discussed in #334. Keep Windows output and the selected output encoding unchanged. The shell regression checks escaped headers and generation/update verification round trips.

Fixes #334.

Validation on Linux/GCC:

  • The final regression fails three checks on the unchanged base and passes with this patch.
  • ./configure --disable-openssl --enable-gettext --enable-debug=-O0, make, make test-lib print-info and make test-full pass.
  • Independent real CLI controls cover 96 escaped header paths and eight generated/updated/recursive manifests across C and C.UTF-8 locales, plus ordinary-output, stdin/message and write-error controls.
  • git diff --check passes. Native Windows and PowerPC builds were not run locally.

@rhash
rhash merged commit 27cc1ab into rhash:master Nov 21, 2026
3 checks passed
@rhash

rhash commented Nov 21, 2026

Copy link
Copy Markdown
Owner

@omrzk thank you for your contribution!

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.

Broken SFV Header for filename containing CR / NL

2 participants