Repository navigation
data: return an error for too large numbers in ParseDuration - #22163
Merged
MichaelEischer merged 2 commits intoNov 5, 2026
Merged
Conversation
nextNumber panicked when strconv.Atoi failed, which happens when a number in a duration does not fit into an int. As ParseDuration backs the --keep-within* flags, `restic forget --keep-within 99999999999999999999999999y` crashed with a stack trace instead of reporting an invalid argument. Return the error instead.
wplapper
added a commit
to wplapper/restic
that referenced
this pull request
Nov 5, 2026
incorporate PR restic#22163 and add comments about 7 or 8 digit day offsets. These offsets are unlikely to be seen in the wild, but could be constructed as corner tests cases. internal/data/duration.go: adopt fix in PR restic#22163 doc/045_working_with_repos.rst: reference to the ambiguity of 7 or 8 digit decimal offset in days and how to differentiate from snapshots which end in the character "d".
MichaelEischer
enabled auto-merge (squash)
November 5, 2026 19:29
mchobbit
added a commit
to mchobbit/restic
that referenced
this pull request
Nov 6, 2026
Five fixes from upstream master since v0.19.1, cherry-picked with -x: the three in changelog/unreleased marked Bugfix (restic#21977 truncated key/config files, restic#22007 Swift password in debug logs, restic#22163 large --keep-within* durations), forget's failedSnIDs lock (restic#22100) and prune's fatal pack listing error. BACKOTTER.md lists them under a new section on taking upstream fixes between releases. Two of the picked tests call names upstream added after 0.19.1 (openKey, NoopTerminalCounterFactory, NewNoopPrinter); they call 0.19.1's instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR change? What problem does it solve?
restic forget --keep-within 99999999999999999999999999ycrashes with a stack trace, becausenextNumberininternal/data/duration.gopanics whenstrconv.Atoifails on a number that doesn't fit into an int. It now returns the error, so the flag reports an invalid argument like other bad durations.Was the change previously discussed in an issue or on the forum?
No. #5486 fixed a different panic in the same function.
Checklist
changelog/unreleased/that describes the changes for our users (see template).