Repository navigation
Conversation
A directory on another filesystem was left out of the walk, but the walk still descended into it. The entries it found there have no parent in the stream of entries, which tar takes as the end of the tree. Anything that came after the mount point was silently left out of the archive. Skip the directory in the walk instead.
The lookup used to simulate another filesystem in the test is now a field of the LocalFS being read rather than a package-level variable. The test marks the mount point and everything below it as being on another device, and checks the entries returned by Next().
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.
desync tar --one-file-systemproduces an incomplete archive when the tree contains a mount point with anything in it. Everything that sorts after the mount point is left out, and the command exits successfully.With a tmpfs holding one file mounted on
mnt:the archive contains only
keep/a.zfileandzzz/bare on the same filesystem as the root and are missing.The walk function returned
nilfor a directory on another filesystem. That leaves the directory itself out, butfilepath.Walkstill descends into it. The files found there are passed on without their parent directory, andtarreads an entry that doesn't belong to the directory it is encoding, or any above it, as the end of the tree. It stops there with the rest of the walk unread. An empty mount point did not trigger this, as there was nothing below it to pass on.The walk function now returns
filepath.SkipDir, so nothing below the mount point is visited. The mount point directory itself stays out of the archive, as it did for an empty one.The device lookup becomes a field of
LocalFS, which the test replaces to simulate a tree across two filesystems, since mounting one needs privileges. The test reports the mount point and everything below it as being on another device and checks the entries the walk returns. The same result was confirmed with a real tmpfs mounted in a user namespace.