Skip to content

fix: match rotate path order and skipped files in rotate --dry-run - #37

Merged
HaoZeke merged 1 commit into
mainfrom
fix/rotate-dry-run-parity
Nov 18, 2026
Merged

HaoZeke merged 1 commit into
mainfrom
fix/rotate-dry-run-parity

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

eb-keep-logs rotate --dry-run diverged between the shell script and the Zig binary, and both implementations reported files that rotate skips.

previewTree in src/main.zig sorted files within each directory before recursing into subdirectories, whereas the shell script sorted full paths across the entire run tree. Both tools also printed and counted files whose .gz sibling already existed or whose link count exceeded one. Those paths are refused when real rotate runs.

I updated previewTree in src/main.zig to gather candidate paths across the run tree, skip multi-link files and existing .gz paths, and sort the collected paths bytewise. The shell script eb-keep-logs now applies LC_ALL=C sort -z and performs the same .gz and hard-link checks. docs/orgmode/reference/cli.org, COMPAT.md, tests/differential.sh, and tests/test_eb_keep_logs.sh update the documented contract and test raw-byte parity plus count equality against rotate.

`previewTree` in `src/main.zig` sorted files per directory before recursing into subdirectories, whereas the shell script sorted full paths across the whole run tree. Both `eb-keep-logs` and `src/main.zig` also listed files with an existing `.gz` sibling or `nlink > 1` that real `rotate` refuses to compress.

`previewTree` now collects candidate paths across the run tree and sorts them bytewise after skipping multi-link files and existing `.gz` paths, matching `LC_ALL=C sort -z` and the same skip checks in `eb-keep-logs`. `docs/orgmode/reference/cli.org`, `COMPAT.md`, `tests/differential.sh`, and `tests/test_eb_keep_logs.sh` document and verify exact byte parity between both tools and matching counts against `rotate`.
@HaoZeke
HaoZeke merged commit 3b40f7b into main Nov 18, 2026
8 checks passed
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.

1 participant