Recover journal prefixes and align Rust/Go journalctl with v262

Merged
KT
10h ago
+43528-3586

Rust and Go readers now recover an incomplete journal's intact entries by default, finish with normal EOF and expose recovery status. The SDK changes align native indexed filtering and position/error behavior, complete Rust's concatenated Zstandard decoding and repair Go indexed aggregation's borrowed-value lifetime.

Both file-backed journalctl commands now target systemd v262. In particular, -F/-N reject incompatible time, cursor and entry filters, grep uses native PCRE2 byte semantics, and unmatched unit wildcards return the native no-data error. Unit naming, wildcard matching and invocation discovery now follow native selection rules. FreeBSD uses a shared CLI compatibility path for extended brackets absent from its native matcher, with ordinary patterns retaining native matching. Invocation queries reuse indexed readers and metadata; follow retains its initial unit expansion and invocation selection. The update also aligns ordered option handling, timestamps, cursor/follow selection, output modes, terminal colors and maintenance behavior.

Unix filenames retain their original bytes through file selection and the additive Rust facade path APIs. Unix patterns use locale-aware native globbing; Windows uses Unicode filenames and matching. Existing string APIs and ordinary cache identity remain compatible. SDKs remain independent of PCRE2/CGO and keep their existing compiler minimums and journal-format baseline.

Validation:

  • Supported-floor Go race tests; Rust CLI unit/subprocess, SDK, registry and cache tests; independent CGO-disabled Go SDK checks.
  • Pinned v262: 1,372 comparisons; query/output/utility: 610; follow: 70 initial passes plus two passing unchanged focused rechecks after fixture-writer readiness timeouts; parser: 134 per language.
  • Portable native smoke: 130 controls, including Unicode patterns and colored grep/JSON.
  • The FreeBSD fallback passes 1,026,675 targeted glibc comparisons across C and UTF-8 locales, including malformed brackets and raw bytes, with address/undefined-behavior checks.
  • Timestamp parsing/rendering: 1,052 controls, including POSIX rules, custom TZDIR, leap records, table/header output and malformed timezone fallback and omitted daylight rules using configured default files. Rendering resolves zone data once and uses the same calendar rules as filtering.
  • All 35 documentation examples and 16 wiki pages pass. Native Linux, macOS, Windows and FreeBSD results are tracked through ordinary PR CI.

Performance evidence uses existing representative command controls and review of the changed work. A 64-invocation listing improved from 56.65 to 10.50 ms in Go and from 74.69 to 19.47 ms in Rust in matched local build profiles; sparse-ID controls also improved. An initial small Go no-ID increase did not reproduce in focused comparisons. The accepted exceptions are limited to fixed CLI startup and age-based vacuum metadata (about 7 ms Go / 3.8 ms Rust extra per 1,000 recent archive names in the retained warm control). SDK and ordinary query performance requirements remain unchanged.

Daemon/host catalog operations retain the documented portable limitations. Broader large-input performance envelopes and polling scalability remain tracked separately.

Coverage now includes the existing portable CLI subprocess controls in both language reports. Full local coverage jobs pass; Go retains every unit-profile block while adding CLI hits, and Rust collects workspace and subprocess profiles together. Runtime source and release performance are unchanged by this reporting update.

SOW-0108, SOW-0159 and SOW-0121 are completed, including the approved archive ordering repair in signed commit 2c12221. Final implementation and closure review passed for that exact commit. The repair passes native Linux, macOS, Windows and FreeBSD CI, both coverage-generation jobs, documentation checks and Go/Rust CodeQL. The final amendment changes lifecycle records only; normal CI reruns against it. This remains a draft for maintainer review; no merge or release is included.

Analysis limitations: on the repair run, Codacy configuration fetching failed with Internal Server Error twice; coverage generation passed but its Codacy upload reported Request URL not found / no data sent. These external API/configuration failures are not code findings and remain unresolved. The earlier Bandit execution error also prevents claiming full Bandit coverage.

Archive ordering repair: clock rollback across writer histories can make stock sequence/time comparisons contradictory. Both CLIs now preserve sequence order within each history and choose the oldest timestamp among available history heads, with deterministic ties. This approved exception avoids Rust sorting panics and makes retention selection agree across languages and enumeration orders. Existing count/size/age stop conditions and protected-file handling are preserved. Validation adds 24 portable observations (130 total), 120 insertion permutations per language and independent 10,000-case models per language; 78 existing utility/oracle observations pass.