You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
homelab_aptHistory returns oldest rotated entries instead of most recent #89
The current log (newest) is printed first and the rotated archives (older) after it, so tail keeps the archive lines. The glob also sorts lexically (.1.gz, .10.gz, .11.gz, .12.gz, .2.gz ... .9.gz), so the last lines come from history.log.9.gz.
Impact
Once apt logs have rotated even once, "recent history" shows months-old entries and the latest upgrades never appear.
Steps to reproduce
Use a Pi with rotated apt logs (anything older than about a month).
Call homelab_aptHistory {lines: 10}.
The returned entries are old ones, not the latest.
Suggested fix
Print the rotated files oldest to newest, then the current log last, and then tail. For example: ls -1v /var/log/apt/history.log.*.gz | tac | xargs -r zgrep -hE '...'; grep -E '...' /var/log/apt/history.log
Acceptance criteria
The newest entries come out last, before tail
Numeric (not lexical) ordering of the rotated files
Activity