Commit Graph
2893 Commits
Author SHA1 Message Date
xh123637andMichael Eischer 2126756613 restorer: reject trees with duplicate or out-of-order node names (#22190)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
Signed-off-by: xh123637 <3324733895@qq.com>
2026-11-15 20:16:32 +01:00
JUSHUANGHUI LI d7aa4145e0 global: reject empty repository location files (#22052)
Return a fatal error before opening or creating a repository when its location file is empty after decoding and trimming whitespace.
2026-11-15 19:03:50 +00:00
Michael Eischer 335d7e38aa Merge pull request #22130 from junkerderprovinz/fix/issue-22112
stats: keep progress counters across snapshots
2026-11-15 20:01:16 +01:00
Rob MartinandMichael Eischer 2c9b353cbf repository: do not delete config on atomic backends during upgrade rollback (#22136)
In UpgradeRepo, if upgradeRepository fails, the error handler attempts
contingency rollback by re-uploading the original config file.

However, the contingency path unconditionally executed repo.be.Remove(ctx, h)
before calling repo.be.Save. On backends supporting atomic replacement (such
as local filesystems), a failed upgrade (e.g. out-of-disk-space or permissions
error while writing the temporary file) leaves the original, valid version 1
configuration file completely intact on disk.

Unconditionally removing the config file during rollback actively deletes
the working configuration. If the subsequent Save call also fails, the
repository is left permanently corrupted without a config file.

Condition the pre-removal on !repo.be.Properties().HasAtomicReplace, matching
the forward upgrade path in upgradeRepository. Add a unit test asserting that
aborted upgrades on atomic backends preserve the intact original configuration.

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-11-15 18:57:01 +00:00
Dean Chen 4dfa381b9f restorer: don't delete files when a directory tree can't be loaded (#22189)
When loading or iterating a directory tree failed, traverseTreeInner
returned a nil file list together with the error. If the error handler
ignored the error, the caller still called leaveDir with that nil list,
and restore --delete removed every existing entry of the directory in
the target, even though the expected content was simply unknown.

Force disable deletion in that case, the same way it is already done
for invalid node names.

Signed-off-by: Dean Chen <862469039@qq.com>
2026-11-15 19:50:17 +01:00
Younes Beriane c4f9e50609 restorer: rewrite partially matching hard-linked files in full (#22086) 2026-11-15 18:40:11 +00:00
Michael Eischer 516c8d32e0 Merge pull request #22117 from Grivn/fix/legacy-null-tree
data: read empty trees from older repaired snapshots
2026-11-15 19:27:39 +01:00
ump45nose 0039a14381 global: mention the cache dir and user agent environment defaults (#22135) 2026-11-05 21:12:18 +00:00
Michael Eischer 068a324dcd Merge pull request #22124 from pujitha24/auto/issue-22120
prune: report failure to list pack files as a fatal error
2026-11-05 21:24:23 +01:00
Michael Eischer f515b862de prune: simplify test setup 2026-11-05 21:15:09 +01:00
Wei-Lun Li 9a0b9e0eb5 data: return an error for too large numbers in ParseDuration (#22163) 2026-11-05 19:36:49 +00:00
subomiandMichael Eischer 83a2726a30 s3: add option to disable AWS dual-stack endpoints (#22060)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-11-05 19:07:43 +00:00
Junker der ProvinzandWinfried Plappert 84c2d0223f stats: keep progress counters across snapshots
The file, blob and size counters were reset for every snapshot, so the
progress line only reflected the last processed snapshot.

Co-authored-by: Winfried Plappert <18740761+wplapper@users.noreply.github.com>
2026-10-21 22:44:24 +02:00
Pujitha Paladugu bba1b68082 prune: report failure to list pack files as a fatal error
Motivation: when listing pack files fails during prune (for example due
to a request timeout), the error was returned unwrapped and main printed
it with "%+v", which dumps a stack trace. As discussed in the issue, the
error needs one more level of wrapping before it can be treated as a
fatal error.

Approach: in decidePackAction, wrap an error from listing pack files
with errors.Fatalf("failed to list pack files: %v"). Errors that are
already fatal (e.g. ErrSizeNotMatching) and errors after context
cancellation are returned unchanged. The underlying error is preserved
via Unwrap. Retry log messages are unchanged; only the final error
output is shortened and says where the failure occurred.

Validation: `go test ./internal/repository/ -run Prune` and
`go test ./cmd/restic/ -run Prune` pass. The new test
TestPrunePackListError (backend whose pack list fails) fails without
the change and passes with it. I did not reproduce a real REST backend
timeout.

Report: https://github.com/restic/restic/issues/22120
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5-5 (via Claude Code)
2026-10-18 12:58:49 -07:00
MikeeI adc0284113 copy: avoid a full index scan for disabled debug output (#22103) 2026-10-18 13:50:05 +00:00
Michael Eischer 5d745e2ead windows: use os.OpenFile with O_FILE_FLAG_* instead of low-level API 2026-10-17 22:57:11 +02:00
Michael Eischer 2497d99f9f fix linter error 2026-10-17 22:57:11 +02:00
Michael Eischer 35f15c398a apply go fix ./... 2026-10-17 22:57:11 +02:00
Grivn d714e22605 data: read empty trees from older repaired snapshots
Older repair snapshots versions serialized missing subtrees as nodes:null.
The streaming decoder rejects these trees, preventing prune and other
commands from traversing snapshots that previous releases could read.

Accept null as an empty node list. Add decoder coverage and a regression
that prunes, checks and restores a snapshot with a legacy empty subtree.
2026-10-16 01:58:41 +08:00
JayandMichael Eischer 519a979107 ci: update golangci-lint to v2.14 (#22111)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-10-11 16:33:41 +00:00
Michael Eischer 5127c4abf9 Fix tar extraction errors in sandboxes (#22071) 2026-09-25 22:08:18 +02:00
Michael Eischer 8e917cf0bd Merge pull request #22069 from MichaelEischer/go-1.27
CI: Add go 1.27
2026-09-25 22:05:52 +02:00
Michael Eischer 818dd21a4f index: hash blob IDs with maphash.Bytes (#22070)
Avoid constructing a maphash.Hash on every lookup and insert.
2026-09-25 22:05:12 +02:00
Michael Eischer 6adedec6b4 repository: use synctest for lock tests (#22038)
Replace select based on context/timer with deterministic pattern.
The tests depend on timing. Thus, use synctest which provides
deterministic clock updates and also speeds up test execution by
skipping sleep times.
2026-09-20 22:05:21 +02:00
Michael Eischer 1cce3790f4 gofmt 2026-09-20 21:28:55 +02:00
Sergey Kolomiichuk ab17711e31 selfupdate: replace deprecated golang.org/x/crypto/openpgp with ProtonMail/go-crypto (#21997) 2026-09-20 18:33:24 +00:00
Michael Eischer 96188e33a3 backend/s3: switch tests from minio to seaweedfs (#22067) 2026-09-20 20:03:48 +02:00
Etienne D ba802d42b7 fix(swift): store APIKey as SecretString to prevent debug log leak (#22007) 2026-08-29 20:11:48 +00:00
Michael Eischer b593ba305b Apply go fix ./... (#22037) 2026-08-29 21:02:05 +02:00
Michael Eischer c6074f82fb Merge pull request #21978 from MichaelEischer/go-fix2
Run `go fix ./...`
2026-08-01 22:17:53 +02:00
Arpit Jain 8baffc4027 repository: reject key and config files that are too short (#21977)
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
2026-07-22 20:38:07 +00:00
Michael Eischer f215365af9 Apply go fix -waitgroup ./... 2026-07-22 22:27:21 +02:00
Michael Eischer 14e523a1d9 Apply go fix -testingcontext ./... 2026-07-22 22:27:15 +02:00
Michael Eischer 58f92708c2 Apply go fix -stringsseq ./... 2026-07-22 22:27:07 +02:00
Michael Eischer 31e96f4ec9 Apply go fix -stringsbuilder ./... 2026-07-22 22:26:50 +02:00
Michael Eischer a2cb015591 Apply go fix -slicescontains ./... 2026-07-22 22:26:33 +02:00
Michael Eischer e2495b72bb Apply go fix -reflecttypefor ./... 2026-07-22 22:26:27 +02:00
Michael Eischer 2c169edad4 Apply go fix -rangeint ./... 2026-07-22 22:26:19 +02:00
Michael Eischer fb36a7f59b Apply go fix -omitzero ./... 2026-07-22 22:26:07 +02:00
Michael Eischer 8ed263c6dd Apply go fix -minmax ./... 2026-07-22 22:25:56 +02:00
Michael Eischer 0e4f288e83 Apply go fix -mapsloop ./... 2026-07-22 22:25:47 +02:00
Michael Eischer da4d8f5851 Apply go fix -fmtappendf ./... 2026-07-22 22:25:26 +02:00
Michael Eischer 32e9869cc8 Apply go fix -any ./... 2026-07-22 22:25:18 +02:00
Matthias Dötsch 905ca56ee8 Address review feedback on #21937:
- addToPacks now returns uint32 directly and the value is passed through
  store() to indexMap.add unchanged, instead of casting between int and
  uint32.
- merge() appends idx2.packs to idx.packs without going through
  addToPacks, so it now checks the pack count against the uint32 limit
  itself + error if exceeded.
- optimize changelog message
2026-07-13 07:25:08 +02:00
Matthias Dötsch e428de5f84 Reduce in-memory index entry size by storing packIndex as uint32
Each blob in a repository requires one index entry in memory, which is one
of the largest contributors to restic's memory usage. The indexEntry.packIndex
field, an index into the per-Index packs slice, was stored as a machine-word
int (8 bytes on amd64) although the value is always a small array index.

Store it as a uint32 instead. This shrinks indexEntry from 64 to 56 bytes on
64-bit platforms (56 % 8 == 0, so no padding is added), reducing index memory
by roughly 12% -- about 100 MB for a repository with ~13 million blobs, as
confirmed by profiling. uint32 allows 4.29 billion packs (>30 billion blobs at
the assumed 8 blobs/pack), far beyond any real repository; addToPacks guards
against overflow defensively. The on-disk repository format is unaffected.
2026-07-08 06:01:15 +00:00
Michael Eischer d8ef26afa4 Merge branch 'patch-release' 2026-07-05 16:27:43 +02:00
Alexander Neumann 6335213501 Set development version for 0.19.1 2026-07-05 09:52:54 +02:00
Alexander Neumann 6aa3a516ce Add version for 0.19.1 2026-07-05 09:52:50 +02:00
Winfried PlappertandMichael Eischer 75de8b54e6 restic check and restic repair packs: treat missing packfiles the same as damaged and truncated packfiles (#21845)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-06-28 12:09:42 +02:00
Michael Eischer 8cc69782b5 repository: expose ZeroChunk via chunker factory 2026-06-27 22:23:59 +02:00