#2081 new defect

bad error message when you give a readonly dircap as target to "tahoe cp"

Reported by: zooko Owned by:
Priority: normal Milestone: undecided
Component: code-mutable Version: 1.10.0
Keywords: usability error test-needed Cc:
Launchpad Bug:

Description

I accidentally wrote tahoe cp -r . $RODIRCAP, and instead of a nice error message like "Can't cp to target because it is read-only.", I got this:

zooko@spark ~/tmp/tahoe-lafs.org/~zooko $ tahoe cp --node-directory=~/.tahoe-basedirs/leastauthority-zookog_at_gmail.com/gateway/ -r ./backup_of_klog/ $RODIRCAP
Traceback (most recent call last):
  File "/usr/bin/tahoe", line 3, in <module>
    runner.run()
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 113, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 99, in runner
    rc = cli.dispatch[command](so)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/cli.py", line 546, in cp
    rc = tahoe_cp.copy(options)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 771, in copy
    return Copier().do_copy(options)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 451, in do_copy
    status = self.try_copy()
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 512, in try_copy
    return self.copy_to_directory(sources, target)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 658, in copy_to_directory
    self.assign_targets(source, target)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 693, in assign_targets
    subtarget = target.get_child_target(name)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 378, in get_child_target
    writecap = make_tahoe_subdirectory(self.nodeurl, self.writecap, name)
  File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 55, in make_tahoe_subdirectory
    ]) + "?t=mkdir"
  File "/usr/lib/python2.7/urllib.py", line 1255, in quote
    raise TypeError('None object cannot be quoted')
TypeError: None object cannot be quoted

Change History (6)

comment:1 Changed at 2014-01-03T21:35:00Z by daira

multikatt proposed a pull request at https://github.com/tahoe-lafs/tahoe-lafs/pull/83. My comment was:

Presumably similar issues apply to other commands besides tahoe cp (tahoe mv at least), but the proposed fix is specific to cp. Also, the method of detecting that the cap is a read cap will work but I find it a bit dissatisfying; it gives me the feeling of working for the wrong reason.

comment:2 Changed at 2014-01-03T21:37:04Z by daira

(The method of detecting a read cap used by the pull request was to check whether the "ro_uri" field of the target directory node's JSON description was the same URI as its main cap.)

Last edited at 2014-01-03T21:38:14Z by daira (previous) (diff)

comment:3 Changed at 2014-01-03T21:38:47Z by daira

  • Keywords easy removed

comment:4 Changed at 2014-01-03T21:39:44Z by daira

  • Keywords test-needed added

comment:5 Changed at 2014-01-03T21:43:21Z by daira

Note that in the traceback, the issue seems to be that self.writecap is None here:

File "/usr/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 378, in get_child_target
    writecap = make_tahoe_subdirectory(self.nodeurl, self.writecap, name)

I would prefer to see a patch that maintained the invariant that self.writecap is not None whenever the node must be writeable.

comment:6 Changed at 2014-05-02T23:39:37Z by daira

multikatt's pull request has been closed; I assume they're not working on it currently.

Note: See TracTickets for help on using tickets.