backup: Fix --stdin-filename with directory#5356
Merged
MichaelEischer merged 9 commits intorestic:masterfrom Jun 2, 2025
Merged
backup: Fix --stdin-filename with directory#5356MichaelEischer merged 9 commits intorestic:masterfrom
--stdin-filename with directory#5356MichaelEischer merged 9 commits intorestic:masterfrom
Conversation
This adds proper support for filenames that include directories. For example, `/foo/bar` would result in an error when trying to open `/foo`. The directory tree is now build upfront. This ensures let's the directory tree construction be handled only once. All accessors then only have to look up the constructed directory entries.
This ensures that a fixed input generates a fully deterministic output file structure.
53db521 to
45e09dc
Compare
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?
In restic 0.18.0, the
backupcommand failed if a filename that includes a least a directory was passed to--stdin-filename. For example,--stdin-filename /foo/barresulted in the following error:With the FS interface changes included in restic 0.18.0, it is now necessary for the
fs.Readerstruct to handle intermediate directories correctly. This is now ensured by constructing the directory right when initializing theReader. Thereby, the full path handling is only necessary once. The accessor functions then just can look up the relevant directory entry.The intermediate directories now use the same timestamp as the file. This ensures that the snapshot content is fully deterministic when the timestamp is specified. I've also added proper error handling for that case that an invalid path was specified.
Was the change previously discussed in an issue or on the forum?
Fixes #5324
Checklist
[ ] I have added documentation for relevant changes (in the manual).changelog/unreleased/that describes the changes for our users (see template).