"tahoe cp -r" gives unhelpful error message when you append a ':" to the dircap as arg #1103

Open
opened 2010-06-28 22:25:20 +00:00 by zooko · 2 comments

The help text for tahoe cp says:

Usage: tahoe [options] cp FROM.. TO
…
You can also use a dircap as either FROM or TO target:

but it doesn't work. Using --dir-cap=$DIRCAP and the tahoe: alias works:

$ tahoe cp --verbose --node-url=http://127.0.0.1:3456 --dir-cap= URI:DIR2:ctmtx2awdo4xt77x5xxaz6nyxm:n5t546ddvd6xlv4v6se6sjympbdbvo7orwizuzl42urm73sxazqa -r . tahoe:
examining 0 of 10
examining 1 of 10
examining 2 of 10
examining 0 of 1
…

but using the $DIRCAP as an argument yields an incorrect error message:

$ tahoe cp --verbose --node-url=http://127.0.0.1:3456 -r .  URI:DIR2-RO:ixqhc4kdbjxc7o65xjnveoewym:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq:
cannot copy directory into a file
The help text for `tahoe cp` says: ``` Usage: tahoe [options] cp FROM.. TO … You can also use a dircap as either FROM or TO target: ``` but it doesn't work. Using `--dir-cap=$DIRCAP` and the `tahoe:` alias works: ``` $ tahoe cp --verbose --node-url=http://127.0.0.1:3456 --dir-cap= URI:DIR2:ctmtx2awdo4xt77x5xxaz6nyxm:n5t546ddvd6xlv4v6se6sjympbdbvo7orwizuzl42urm73sxazqa -r . tahoe: examining 0 of 10 examining 1 of 10 examining 2 of 10 examining 0 of 1 … ``` but using the $DIRCAP as an argument yields an incorrect error message: ``` $ tahoe cp --verbose --node-url=http://127.0.0.1:3456 -r . URI:DIR2-RO:ixqhc4kdbjxc7o65xjnveoewym:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq: cannot copy directory into a file ```
zooko added the
code-frontend-cli
major
defect
1.7.0
labels 2010-06-28 22:25:20 +00:00
zooko added this to the undecided milestone 2010-06-28 22:25:20 +00:00
Author

Oh, I see that I'm supposed to not append a trailing : to the dircap. (I guess I was thinking of it as being like an SSH address with the dircap as being like the remote host identifier and the path as being like the path-within-that-remote-host part.)

$ tahoe cp --verbose --node-url=http://127.0.0.1:3456 -r .  URI:DIR2:5nkkccw4ytkreljso5d6yxxu34:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq
examining 0 of 11
examining 0 of 2
examining 1 of 2
examining 0 of 1
…

To fix this ticket, make it emit a nice helpful error message in this case. This might be hard because how can it tell that the last argument is a dircap with added garbage after instead of being a filename? Or a tahoe alias named "URI" followed by a path?

Oh, I see that I'm supposed to not append a trailing `:` to the dircap. (I guess I was thinking of it as being like an SSH address with the dircap as being like the remote host identifier and the path as being like the path-within-that-remote-host part.) ``` $ tahoe cp --verbose --node-url=http://127.0.0.1:3456 -r . URI:DIR2:5nkkccw4ytkreljso5d6yxxu34:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq examining 0 of 11 examining 0 of 2 examining 1 of 2 examining 0 of 1 … ``` To fix this ticket, make it emit a nice helpful error message in this case. This might be hard because how can it tell that the last argument is a dircap with added garbage after instead of being a filename? Or a tahoe alias named "URI" followed by a path?
zooko changed title from "tahoe cp -r" won't accept a dircap as TO argument to "tahoe cp -r" gives unhelpful error message when you append a ':" to the dircap as arg 2010-06-28 22:32:33 +00:00
davidsarah commented 2010-06-29 00:30:08 +00:00
Owner

Replying to zooko:

To fix this ticket, make it emit a nice helpful error message in this case. This might be hard because how can it tell that the last argument is a dircap with added garbage after instead of being a filename? Or a tahoe alias named "URI" followed by a path?

It can tell that this is neither a valid dircap+path nor a valid direct filecap, so the error message "cannot copy directory into a file" is definitely wrong. Creating an alias called "URI" should be rejected, since it can't be parsed unambiguously.

Replying to [zooko](/tahoe-lafs/trac-2024-07-25/issues/1103#issuecomment-78318): > To fix this ticket, make it emit a nice helpful error message in this case. This might be hard because how can it tell that the last argument is a dircap with added garbage after instead of being a filename? Or a tahoe alias named "URI" followed by a path? It can tell that this is neither a valid dircap+path nor a valid direct filecap, so the error message "cannot copy directory into a file" is definitely wrong. Creating an alias called "URI" should be rejected, since it can't be parsed unambiguously.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1103
No description provided.