Repository navigation
ltfs_ordered_copy: copy into a destination directory again (#661) - #662
Open
MitchelTighe wants to merge 1 commit into
Open
MitchelTighe wants to merge 1 commit into
MitchelTighe wants to merge 1 commit into
Conversation
…eFileSystem#661) Since LinearTapeFileSystem#649, CopyItem copies with open(self.dst, 'wb') so it can drive the progress bar. shutil.copy(), which it replaced, accepted a directory as the destination and kept the source file name; open() fails with "Is a directory", so copying several files (or a -t list) into a directory copied nothing. When the destination is an existing directory, append the source file name, which restores the previous behaviour. Fixes LinearTapeFileSystem#661
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.
Fixes #661
Since #649,
CopyItemcopies withopen(self.dst, 'wb')so it can drive the progress bar.shutil.copy(), which it replaced, accepted a directory as the destination and kept the source file name.open()fails with "Is a directory" instead, so copying several files (or a-tlist) into a directory copied nothing.This PR appends the source file name when the destination is an existing directory, restoring the pre-v2.4.9.0 behaviour. It's a 4-line change in
CopyItem.__init__.Testing (off-tape, with a stub
xattrmodule):ltfs_ordered_copy src/a.txt src/b.txt dstdst/a.txtanddst/b.txtwith the right contentsprintf 'src/a.txt\nsrc/b.txt\n' | ltfs_ordered_copy -t dstltfs_ordered_copy src/a.txt newname(single file to a new name)--keep-treeand recursive directory copiesA 21-case regression harness shows no other change in results.
Written with help from an AI assistant (Claude).