Commit Graph

2135 Commits

Author SHA1 Message Date
Johannes Truschnigg
a8f0ad5cc4 mount: check for more requisite mountpoint conditions (#5718)
* mount: check for more requisite mountpoint conditions

In order to be able to mount a repository over a mountpoint target
directory via FUSE, that target directory needs to be both writeable and
executable for the UID performing the mount.

Without this patch, `restic mount` only checks for the target pathname's
existence, which can lead to a lot of data transfer and/or computation
for large repos to be performed before eventually croaking with a fatal
"fusermount: failed to chdir to mountpoint: Permission denied" (or
similar) error.

FUSE does allow for mounting over a target path that refers to a regular
(writeable) file, but the result is not accessible via chdir(), so we
prevent that as well, and accept only directory inodes as the intended
target mountpoint path.

* Don't use snake_case identifiers

* Add changelog entry

* tweak changelog summary

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-02-19 17:11:49 +00:00
Winfried Plappert
8b567a9270 Bugfix restic find: missing check for mtime --oldest/--newest (#5310) 2026-02-18 21:14:35 +00:00
Andreas Scherbaum
66d915ef79 Add space in error message (#5704) 2026-02-18 20:27:02 +00:00
Michael Eischer
6566f786e9 stats: also print snapshot size statistics in debug mode (#5712) 2026-02-18 21:21:40 +01:00
gunar
7101f11133 Fail fast for invalid RESTIC_PACK_SIZE env values (#5592)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-02-01 15:45:31 +01:00
Michael Eischer
5e43a44b15 Merge pull request #5680 from castilma/unlock-doc 2026-02-01 12:13:52 +01:00
Michael Eischer
07d380d54b Merge pull request #5191 from wplapper/cmd_rewrite_include 2026-02-01 11:53:05 +01:00
Winfried Plappert
bcd4168428 Enhancement: calls to SnapshotFilter.FindLatest() can be simplified (#5688) 2026-01-31 23:04:01 +01:00
Michael Eischer
901235efc9 rewrite: skip snapshot parts not matchable by include patterns 2026-01-31 22:42:02 +01:00
Michael Eischer
0d71f70a22 minor cleanups and typos 2026-01-31 22:01:23 +01:00
Winfried Plappert
b6af01bb28 restic rewrite integration test
convert exclusive lock on repository to 'no-lock'
2026-01-31 19:43:03 +00:00
Winfried Plappert
5148608c39 restic rewrite include - based on restic 0.18.1
cmd/restic/cmd_rewrite.go:
introduction of include filters for this command:
- add include filters, add error checking code
- add new parameter 'keepEmptyDirectoryFunc' to 'walker.NewSnapshotSizeRewriter()',
  so empty directories have to be kept to keep the directory structure intact
- add parameter 'keepEmptySnapshot' to 'filterAndReplaceSnapshot()' to keep snapshots
  intact when nothing is to be included
- introduce helper function 'gatherIncludeFilters()' and 'gatherExcludeFilters()' to
  keep code flow clean

cmd/restic/cmd_rewrite_integration_test.go:
add several new tests around the 'include' functionality

internal/filter/include.go:
this is where is include filter is defined

internal/walker/rewriter.go:
- struct RewriteOpts gains field 'KeepEmtpyDirectory', which is a 'NodeKeepEmptyDirectoryFunc()'
  which defaults to nil, so that al subdirectories are kept
- function 'NewSnapshotSizeRewriter()' gains the parameter 'keepEmptyDirecoryFilter' which
  controls the management of empty subdirectories in case of include filters active

internal/data/tree.go:
gains a function Count() for checking the number if node elements in a newly built tree

internal/walker/rewriter_test.go:
function 'NewSnapshotSizeRewriter()' gets an additional parameter nil to keeps things happy

cmd/restic/cmd_repair_snapshots.go:
function 'filterAndReplaceSnapshot()' gets an additional parameter 'keepEmptySnapshot=nil'

doc/045_working_with_repos.rst:
gets to mention include filters

changelog/unreleased/issue-4278:
the usual announcement file

git rebase master -i produced this

restic rewrite include - keep linter happy

cmd/restic/cmd_rewrite_integration_test.go:
linter likes strings.Contain() better than my strings.Index() >= 0
2026-01-31 19:42:56 +00:00
Michael Eischer
24d56fe2a6 diff: switch to efficient DualTreeIterator
The previous implementation stored the whole tree in a map and used it
for checking overlap between trees. This is now replaced with the
DualTreeIterator, which iterates over two trees in parallel and returns
the merge stream in order. In case of overlap between both trees, it
returns both nodes at the same time. Otherwise, only a single node is
returned.
2026-01-31 20:03:38 +01:00
Michael Eischer
350f29d921 data: replace Tree with TreeNodeIterator
The TreeNodeIterator decodes nodes while iterating over a tree blob.
This should reduce peak memory usage as now only the serialized tree
blob and a single node have to alive at the same time. Using the
iterator has implications for the error handling however. Now it is
necessary that all loops that iterate through a tree check for errors
before using the node returned by the iterator.

The other change is that it is no longer possible to iterate over a tree
multiple times. Instead it must be loaded a second time. This only
affects the tree rewriting code.
2026-01-31 20:03:38 +01:00
Michael Eischer
1e183509d4 data: rework StreamTrees to use synchronous callbacks
The tree.Nodes will be replaced by an iterator to loads and serializes
tree node ondemand. Thus, the processing moves from StreamTrees into the
callback. Schedule them onto the workers used by StreamTrees for proper
load distribution.
2026-01-31 20:03:38 +01:00
Michael Eischer
278e457e1f data: use data.TreeWriter to serialize&write data.Tree
Always serialize trees via TreeJSONBuilder. Add a wrapper called
TreeWriter which combines serialization and saving the tree blob in the
repository. In the future, TreeJSONBuilder will have to upload tree
chunks while the tree is still serialized. This will a wrapper like
TreeWriter, so add it right now already.

The archiver.treeSaver still directly uses the TreeJSONBuilder as it
requires special handling.
2026-01-31 19:18:36 +01:00
Martin Castillo
2269ec82e1 man: add note about append-only mode to restic-unlock.1
Since restic unlock _removes_ locks, a user might wonder
whether this works in append-only mode, which prevents deletion of
data.  This change explicitly mentions in the man page that the deletion
of locks is an allowed exception.
2026-01-27 12:07:47 +01:00
Winfried Plappert
86ccc6d445 Bugfix: restic check: add missing finalizeSnapshotFilter() (#5644)
add missing finalizeSnapshotFilter() to cmd.RunE()

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-01-26 21:08:15 +00:00
Michael Eischer
a8be8e36fa Merge pull request #5621 from MichaelEischer/copy-stream-snapshots
copy: iterate through snapshots
2025-12-03 21:21:05 +01:00
Michael Eischer
1e6ed458ff remove old // +build comments 2025-11-30 11:53:23 +01:00
Winfried Plappert
ce57961f14 restic check with snapshot filters (#5469)
---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-11-28 19:12:38 +00:00
Michael Eischer
e1bc2fb71a copy: iterate through snapshots 2025-11-26 22:48:54 +01:00
Michael Eischer
046b0e711d repository: add SaveBlobAsync method 2025-11-26 21:18:21 +01:00
Michael Eischer
134893bd35 copy: use AssociatedBlobSet to keep track of processed trees 2025-11-26 21:00:18 +01:00
Michael Eischer
46ebee948f stats: use AssociatedBlobSet 2025-11-26 20:59:39 +01:00
Michael Eischer
d91fe1d7e1 diff: use AssociatedBlobSet 2025-11-26 20:59:39 +01:00
Michael Eischer
ff099a216a copy: use AssociatedBlobSet 2025-11-26 20:59:38 +01:00
Michael Eischer
7e80536a9b Merge pull request #5472 from wplapper/cmd_copy_stream
restic copy --stream: run one large copy operation crossing snapshot boundaries - issue #5453
2025-11-26 20:57:46 +01:00
Michael Eischer
f9e5660e75 output which source and target snapshot belong together 2025-11-23 22:01:53 +01:00
Michael Eischer
e79b01d82f more aggressive batching 2025-11-23 21:46:03 +01:00
Michael Eischer
857b42fca4 merge into existing copy test 2025-11-23 19:08:49 +01:00
Michael Eischer
39db78446f Simplify test 2025-11-23 19:05:55 +01:00
Michael Eischer
cf409b7c66 automatically batch snapshots in copy 2025-11-23 17:40:37 +01:00
Michael Eischer
f95dc73d38 deduplicate blob enqueuing 2025-11-23 17:13:10 +01:00
Michael Eischer
63bc1405ea unify snapshot copy codepaths 2025-11-23 17:12:54 +01:00
Michael Eischer
05364500b6 use correct context 2025-11-23 16:25:09 +01:00
Michael Eischer
e775192fe7 don't sort snapshots, drop duplicate code and cleanup copyTreeBatched function signature 2025-11-23 16:20:40 +01:00
Michael Eischer
4395a77154 copy: remove bugous seenBlobs set 2025-11-23 16:06:45 +01:00
Michael Eischer
81d8bc4ade repository: replace CopyBlobs with Repack implementation 2025-11-23 16:06:29 +01:00
Michael Eischer
6174c91042 Merge pull request #5588 from seqizz/g_timezoneshow
snapshots: Show timezone in non-compact output
2025-11-19 22:06:37 +01:00
Winfried Plappert
b87f7586e4 restic copy --batch: a fresh start from commit 382616747
Instead of rebasing my code, I decided to start fresh, since WithBlobUploader()
has been introduced.

changelog/unreleased/issue-5453:
doc/045_working_with_repos.rst:
the usual

cmd/restic/cmd_copy.go:
gather all snaps to be collected - collectAllSnapshots()
run overall copy step - func copyTreeBatched()
helper copySaveSnapshot() to save the corresponding snapshot

internal/repository/repack.go:
introduce wrapper CopyBlobs(), which passes parameter `uploader restic.BlobSaver` from
WithBlobUploader() via copyTreeBatched() to repack().

internal/backend/local/local_windows.go:
I did not touch it, but gofmt did: whitespace
2025-11-19 07:09:24 +00:00
Gürkan
dc4e9b31f6 snapshots: Show timezone in non-compact output 2025-11-18 13:32:44 +01:00
Michael Eischer
8767549367 Merge pull request #5601 from MichaelEischer/snapshots-fix-groupby-with-latest
snapshots: correctly handle --latest in combination with --group-by
2025-11-17 22:50:50 +01:00
Michael Eischer
5afe61585b snapshots: correctly handle --latest in combination with --group-by 2025-11-17 22:26:57 +01:00
Michael Eischer
0ff3e20c4b prune: return proper error if blob cannot be found 2025-11-16 17:04:03 +01:00
Michael Eischer
3b854d9c04 Merge pull request #5449 from provokateurin/restore-ownership-by-name
feat(internal/fs/node): Restore ownership by name
2025-11-16 16:50:36 +01:00
provokateurin
8fae46011a feat(internal/fs/node): Restore ownership by name 2025-11-16 16:40:58 +01:00
Winfried Plappert
25611f4628 restic copy - add statistics counters
cmd/restic/cmd_copy.go:
add function copyStats() and call it before the actual copying starts.

changelog/unreleased/pull-5319:
rephrased wording of the statistics counters.
2025-11-16 13:47:10 +01:00
Winfried Plappert
90ac3efa88 restic copy - add additional status counters
'copyTree()' now counts and sizes the blobs in 'copyBlobs' and prints them out
via 'Verbosef()'.
2025-11-16 13:46:27 +01:00
Michael Eischer
14f3bc8232 Merge pull request #5560 from MichaelEischer/index-iterators
index: port to  modern Go iterators
2025-11-16 13:24:48 +01:00