[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2329: cp -r stops with an exception

Tahoe-LAFS trac at tahoe-lafs.org
Thu Jan 22 18:47:33 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:           |  easy release-blocker
Launchpad Bug:           |
-------------------------+-------------------------------------------------

Comment (by zooko):

 Here's my attempt to fill out the table from comment:17 for a certain rule
 that I have in my mind right now (written below).

 * "Rule comment:19"
  * (F1) `cp -r PARENTCAP/dir local/` -> `local/dir/file.txt`
  * (F2) `cp -r PARENTCAP/dir local/missing` ->
 `local/missing/dir/file.txt`
  * (G1) `cp -r DIRCAP local/` -> `local/file.txt`
  * (G2) `cp -r DIRCAP local/missing` -> `local/missing/file.txt`
  * (H1) `cp -r DIRCAP_ALIAS: local/` -> `local/file.txt`
  * (H2) `cp -r DIRCAP_ALIAS: local/missing` -> `local/missing/file.txt`
  * (I1) `cp -r DIRCAP/file.txt local/` -> `local/file.txt`
  * (I2) `cp -r DIRCAP/file.txt local/missing` -> `local/missing`
  * (J1) `cp -r FILECAP local/` -> "error, you must specify a destination
 filename"
  * (J2) `cp -r FILECAP local/missing` -> `local/missing`

 "Rule comment:19" is:

 1. If the source is a directory:

  a. If the target is the name of a locally existing file, then "error:
 there is already a local file present under the name $TARGET".

  b. If the target is the name of something not locally existing, then
 mkdir it and then use it as "target directory".

  c. If the target is the name of a locally existing directory, then
 proceed to use it as "target directory".

  d. Check whether the source directory has a name (as in F1, F2) or has no
 name (as in G1, G2, H1, H2). If it has a name then we say that the source
 means the bag itself — the directory, and if it has no name then we say
 that the source means the contents of the bag — the contents of the
 directory.

   i. Now if the source is the bag itself, then mkdir a new directory
 inside "target directory", named by the name of the source directory, and
 copy the contents of the bag into "target directory"/"source directory
 name"/ (which are cases F1 and F2).

   ii. Else (the source was the contents of the bag instead of the bag
 itself) copy the contents of the bag into "target directory"/ (which are
 cases G1, G2, H1, and H2).

 2. If the source is a file, then check if the target is an existing
 directory.

  a. If the source is a nameless file (as in J1, J2) *and* target is an
 existing directory (as in J1), then "error, you must specify a destination
 filename".

  b. Else, if the source is a nameless file and the target is not an
 existing directory, then use the target as the local filename (which is
 case J2).

  c. Else, if the source is a named file and the target is an existing
 directory, then use the source filename within the target existing
 directory (which is case I1).

  d. Else, if the source is a named file and the target is not an existing
 directory, then use the target as the local filename (which is case I2).

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2329#comment:20>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list