[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2329: cp -r stops with an exception
Tahoe-LAFS
trac at tahoe-lafs.org
Tue Mar 3 20:29:29 UTC 2015
#2329: cp -r stops with an exception
-------------------------+-------------------------------------------------
Reporter: zooko | Owner: warner
Type: defect | Status: assigned
Priority: major | Milestone: 1.10.1
Component: code- | Version: 1.10.0
frontend-cli | Keywords: regression tahoe-cp review-needed
Resolution: | release-blocker
Launchpad Bug: |
-------------------------+-------------------------------------------------
Comment (by warner):
Two unexpected cases discovered during today's review:
{{{
1: cp FILE1 TARGETFILE/
2: cp DIR1 DIR2 TARGETDIR
}}}
We decided the first should signal an error: the trailing slash will only
be accepted if the target is directory-like (either a pre-existing
directory, or something missing that will be created as a directory,
either because the source is a directory, or because there are multiple
sources). If the target is directory-like, the trailing slash will not
affect the copying behavior.
For the second, the realization was that this causes the contents of DIR1
and DIR2 to be merged together in the TARGETDIR, and thus the order of the
source arguments matters (presumeably DIR2's contents will overwrite those
of DIR1). The same thing happens if you copy multiple files of the same
name into a directory (`cp foo/file.txt bar/file.txt outdir`).
We need to ensure the implementation preserves the order of the source
arguments (I think my current patch does, but if I'd used a set instead of
a dict, it would behave differently). We should also double-check that
`/bin/cp` does the same thing.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2329#comment:46>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list