[tahoe-dev] [tahoe-lafs] #761: "tahoe cp $DIRCAP/$PATH $LOCAL" raises AttributeError

tahoe-lafs trac at allmydata.org
Fri Sep 4 23:06:45 UTC 2009


#761: "tahoe cp $DIRCAP/$PATH $LOCAL" raises AttributeError
-------------------------------+--------------------------------------------
 Reporter:  zooko              |           Owner:            
     Type:  defect             |          Status:  new       
 Priority:  major              |       Milestone:  eventually
Component:  code-frontend-cli  |         Version:  1.4.1     
 Keywords:                     |   Launchpad_bug:            
-------------------------------+--------------------------------------------

Comment(by kevan):

 Testing:

 copying a filecap to a local directory
 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:CHK:lmwmniv6kzf2amxuoikl6ncmqi:42izq3rtixijq7bs5s3pjcyv4st2hgzuzfqxfjaifbb4mo62adyq:3:10:83
 adir
 Traceback (most recent call last):
   File "/Users/kacarstensen/Documents/code/tahoe-761/support/bin/tahoe",
 line 8, in <module>
     load_entry_point('allmydata-tahoe==1.5.0-r4054', 'console_scripts',
 'tahoe')()
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/runner.py",
 line 91, in run
     rc = runner(sys.argv[1:])
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/runner.py",
 line 78, in runner
     rc = cli.dispatch[command](so)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/cli.py",
 line 436, in cp
     rc = tahoe_cp.copy(options)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 759, in copy
     return Copier().do_copy(options)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 444, in do_copy
     self.try_copy()
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 501, in try_copy
     return self.copy_to_directory(sources, target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 661, in copy_to_directory
     self.copy_files_to_target(self.targetmap[target], target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 692, in copy_files_to_target
     self.copy_file_into(source, name, target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 737, in copy_file_into
     target.put_file(name, f)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 163, in put_file
     pathname = os.path.join(self.pathname, name)
   File
 "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py",
 line 65, in join
     if b.startswith('/'):
 AttributeError: 'NoneType' object has no attribute 'startswith'
 }}}

 copying a file by means of a dircap and a path to a local directory
 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:DIR2-RO:j74uhg25nwdpjpacl6rkat2yhm:kav7ijeft5h7r7rxdp5bgtlt3viv32yabqajkrdykozia5544jqa/wiki.html
 adir
 Traceback (most recent call last):
   File "/Users/kacarstensen/Documents/code/tahoe-761/support/bin/tahoe",
 line 8, in <module>
     load_entry_point('allmydata-tahoe==1.5.0-r4054', 'console_scripts',
 'tahoe')()
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/runner.py",
 line 91, in run
     rc = runner(sys.argv[1:])
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/runner.py",
 line 78, in runner
     rc = cli.dispatch[command](so)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/cli.py",
 line 436, in cp
     rc = tahoe_cp.copy(options)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 759, in copy
     return Copier().do_copy(options)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 444, in do_copy
     self.try_copy()
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 501, in try_copy
     return self.copy_to_directory(sources, target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 661, in copy_to_directory
     self.copy_files_to_target(self.targetmap[target], target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 692, in copy_files_to_target
     self.copy_file_into(source, name, target)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 737, in copy_file_into
     target.put_file(name, f)
   File
 "/Users/kacarstensen/Documents/code/tahoe-761/src/allmydata/scripts/tahoe_cp.py",
 line 163, in put_file
     pathname = os.path.join(self.pathname, name)
   File
 "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py",
 line 65, in join
     if b.startswith('/'):
 AttributeError: 'NoneType' object has no attribute 'startswith'
 }}}

 copying a filecap to a local file that doesn't exist
 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:CHK:lmwmniv6kzf2amxuoikl6ncmqi:42izq3rtixijq7bs5s3pjcyv4st2hgzuzfqxfjaifbb4mo62adyq:3:10:83
 newfile
 Success: file copied
 }}}

 copying a file by means of a dircap and a path to a local file that
 doesn't exist

 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:DIR2-RO:j74uhg25nwdpjpacl6rkat2yhm:kav7ijeft5h7r7rxdp5bgtlt3viv32yabqajkrdykozia5544jqa/wiki.html
 wiki.html
 Success: file copied
 }}}

 copying a filecap to a local file that does exist

 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:CHK:lmwmniv6kzf2amxuoikl6ncmqi:42izq3rtixijq7bs5s3pjcyv4st2hgzuzfqxfjaifbb4mo62adyq:3:10:83
 wiki.html
 Success: file copied
 }}}

 copying a file by means of a dircap and a path to a local file that does
 exist.

 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp
 URI:DIR2-RO:j74uhg25nwdpjpacl6rkat2yhm:kav7ijeft5h7r7rxdp5bgtlt3viv32yabqajkrdykozia5544jqa/wiki.html
 newfile
 Success: file copied
 }}}

 copying a dircap to a local directory

 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp --recursive
 URI:DIR2:f7q633wsw7x2fkqf3vkrdl35je:u3bcw323sqhev5lhem5qkgcwrelp63rsroh7qnzz5haorhlmqdxq
 thedir
 Success: files copied
 }}}

 (it copies the contents of the directory on the grid to {{{thedir}}})

 copying a dircap to a local directory that doesn't exist

 {{{
 macbook-3:tahoe-761 kacarstensen$ ./bin/tahoe cp --recursive
 URI:DIR2:f7q633wsw7x2fkqf3vkrdl35je:u3bcw323sqhev5lhem5qkgcwrelp63rsroh7qnzz5haorhlmqdxq
 newdir
 Success: files copied
 }}}

 (don't worry -- the files and directories I use for testing were, when not
 taken from {{{tahoe cp --help}}}, generated for the purposes of the
 testing, so I'm not leaking anything by not censoring caps)

 From what I gather, those two errors are happening because the code in
 [source:/src/allmydata/scripts/tahoe_cp.py tahoe_cp.py] isn't attempting
 to deduce a destination filename within the directory to use when copying.
 It doesn't have a lot to go on in the first case (since the filecap
 doesn't know what its name might be), but it seems like it should be able
 to infer that {{{wiki.html}}} should be the destination name in the second
 case, and continue. I have a patch that implements this behavior
 (complaining in the first failure case, working in the second), but I want
 to test it more thoroughly before I upload it.

-- 
Ticket URL: <http://allmydata.org/trac/tahoe/ticket/761#comment:1>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid


More information about the tahoe-dev mailing list