#944 new defect

"tahoe mv" doesn't accept just a path as the second argument?

Reported by: zooko Owned by:
Priority: major Milestone: undecided
Component: code-frontend-cli Version: 1.6.0
Keywords: tahoe-mv usability error Cc:
Launchpad Bug:

Description

I wanted to mv a file from one directory to another. The target directory is the one denoted by the "tahoe:" alias in the following command-line:

$ time ~/playground/tahoe-lafs/bin/tahoe mv --dir-cap=URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq tahoe:Diablo_Swing_Orchestra-The_Butcher\'s_Ballroom/on_ootles/ tahoe:
error, got 500 Internal Server Error
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 195, in addCallback
    callbackKeywords=kw)
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 186, in addCallbacks
    self._runCallbacks()
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/Nevow-0.9.33_r17222-py2.6.egg/nevow/appserver.py", line 163, in gotPageContext
    pageContext.tag.renderHTTP, pageContext
--- <exception caught here> ---
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 106, in maybeDeferred
    result = f(*args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/common.py", line 290, in renderHTTP
    return m(ctx)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/directory.py", line 182, in render_PUT
    d = self.replace_me_with_a_childcap(req, self.client, replace)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/filenode.py", line 57, in replace_me_with_a_childcap
    d = self.parentnode.set_node(self.name, childnode, overwrite=replace)
exceptions.AttributeError: 'NoneType' object has no attribute 'set_node'

NOT removing the original

real    0m1.193s
user    0m0.478s
sys     0m0.211s

Confused by the error message, I tried to specify "Yes, the directory there." by adding a dot:

$ time ~/playground/tahoe-lafs/bin/tahoe mv --dir-cap=URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq tahoe:Diablo_Swing_Orchestra-The_Butcher\'s_Ballroom/on_ootles/ tahoe:.
OK

real    0m3.596s
user    0m0.481s
sys     0m0.212s

Yay! That worked! Oops, I just created a file named .:

$ time ~/playground/tahoe-lafs/bin/tahoe ls --dir-cap=URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq  tahoe:
.
Diablo_Swing_Orchestra-The_Butcher's_Ballroom

real    0m0.860s
user    0m0.471s
sys     0m0.209s

Change History (2)

comment:1 Changed at 2010-02-08T23:44:37Z by zooko

Using the form of tahoe mv which takes caps directly on the command-line instead of using tahoe aliases has the same behavior:

$ time ~/playground/tahoe-lafs/bin/tahoe mv URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq/Diablo_Swing_Orchestra-The_Butcher\'s_Ballroom/writable_by_ootles URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq

error, got 500 Internal Server Error
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 195, in addCallback
    callbackKeywords=kw)
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 186, in addCallbacks
    self._runCallbacks()
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/Nevow-0.9.33_r17222-py2.6.egg/nevow/appserver.py", line 163, in gotPageContext
    pageContext.tag.renderHTTP, pageContext
--- <exception caught here> ---
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 106, in maybeDeferred
    result = f(*args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/common.py", line 290, in renderHTTP
    return m(ctx)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/directory.py", line 182, in render_PUT
    d = self.replace_me_with_a_childcap(req, self.client, replace)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/filenode.py", line 57, in replace_me_with_a_childcap
    d = self.parentnode.set_node(self.name, childnode, overwrite=replace)
exceptions.AttributeError: 'NoneType' object has no attribute 'set_node'

NOT removing the original

real    0m1.191s
user    0m0.479s
sys     0m0.214s
$ time ~/playground/tahoe-lafs/bin/tahoe mv URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq/Diablo_Swing_Orchestra-The_Butcher\'s_Ballroom/writable_by_ootles URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq/
error, got 500 Internal Server Error
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 195, in addCallback
    callbackKeywords=kw)
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 186, in addCallbacks
    self._runCallbacks()
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/Nevow-0.9.33_r17222-py2.6.egg/nevow/appserver.py", line 163, in gotPageContext
    pageContext.tag.renderHTTP, pageContext
--- <exception caught here> ---
  File "/Users/zooko/playground/tahoe-lafs/support/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 106, in maybeDeferred
    result = f(*args, **kw)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/common.py", line 290, in renderHTTP
    return m(ctx)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/directory.py", line 182, in render_PUT
    d = self.replace_me_with_a_childcap(req, self.client, replace)
  File "/Users/zooko/playground/tahoe-lafs/src/allmydata/web/filenode.py", line 57, in replace_me_with_a_childcap
    d = self.parentnode.set_node(self.name, childnode, overwrite=replace)
exceptions.AttributeError: 'NoneType' object has no attribute 'set_node'

NOT removing the original

real    0m1.204s
user    0m0.477s
sys     0m0.208s
$ time ~/playground/tahoe-lafs/bin/tahoe mv URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq/Diablo_Swing_Orchestra-The_Butcher\'s_Ballroom/writable_by_ootles URI:DIR2:zssplcanct54waahwjjngjyhke:vvdpvxybwc6x7az5i64heqdnql2mdi6fspvxtje4iwzkcvvwukpq/writable_by_ootles
OK

real    0m4.267s
user    0m0.481s
sys     0m0.214s

comment:2 Changed at 2010-02-09T02:50:54Z by davidsarah

  • Keywords error added

There seem to be three issues here:

  • to match the behaviour of Unix mv, the destination of the first command should have been treated as tahoe:on_ootles. This only applies when the source is a path (rather than a direct cap), so that its name relative to its parent is known.
  • replace_me_with_a_childcap needs to check that self.parentnode is not None, in order to raise a more sensible error.
  • "path/." or "alias:." should probably be treated the same as "path/" or "alias:"
Note: See TracTickets for help on using tickets.