#2399 closed defect (fixed)

cp -r tries to mkdir the directory more than once

Reported by: ambimorph Owned by: warner
Priority: normal Milestone: 1.10.1
Component: code-frontend-cli Version: 1.10.0
Keywords: easy test-needed tahoe-cp release-blocker Cc:
Launchpad Bug:

Description

Target directory tmp did not exist before running the following:

$ tahoe cp -r lae:admin/Latest/ tmp
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 156, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 141, in runner
    rc = cli.dispatch[command](so)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/cli.py", line 541, in cp
    rc = tahoe_cp.copy(options)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 831, in copy
    return Copier().do_copy(options)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 479, in do_copy
    status = self.try_copy()
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 565, in try_copy
    return self.copy_things_to_directory(sources, target)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 719, in copy_things_to_directory
    targetmap = self.build_targetmap(sources, target)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 762, in build_targetmap
    new_target = target.get_child_target(name)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/tahoe_cp.py", line 159, in get_child_target
    os.makedirs(pathname)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/home/amber/tmp/'

Change History (4)

comment:1 Changed at 2015-04-06T03:48:39Z by zooko

I looked over Amber's shoulder and asked her to change that os.makedirs() in tahoe_cp.py line 159 to fileutil.make_dirs(), and she did, and then the command worked and she was able to restore her files.

comment:2 Changed at 2015-04-07T05:30:01Z by warner

  • Milestone changed from undecided to 1.10.1
  • Owner set to warner
  • Status changed from new to assigned

comment:3 Changed at 2015-04-12T22:05:54Z by daira

  • Keywords easy test-needed tahoe-cp release-blocker added

comment:4 Changed at 2015-05-04T05:15:26Z by Brian Warner <warner@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In b32664b4519facbe4b7208eb282e7d723727eb11/trunk:

Merge branch '2399-cp-mkdir'

closes ticket:2399

Note: See TracTickets for help on using tickets.