[tahoe-dev] [tahoe-lafs] #705: "tahoe mv" unlinks the target even when it is a directory

tahoe-lafs trac at allmydata.org
Sat Jul 4 15:24:03 UTC 2009


#705: "tahoe mv" unlinks the target even when it is a directory
-------------------------------+--------------------------------------------
 Reporter:  zooko              |           Owner:       
     Type:  defect             |          Status:  new  
 Priority:  critical           |       Milestone:  1.5.0
Component:  code-frontend-cli  |         Version:  1.4.1
 Keywords:  reliability        |   Launchpad_bug:       
-------------------------------+--------------------------------------------

Comment(by zooko):

 I looked at your patch and it looks right to me.  I think I would change
 the {{{if path.endswith("/"):}}} to {{{if to_url.endswith("/"):}}}.  Also
 the patch description is not "Make mv move files into directories, instead
 of overrwriting directories.", because this patch doesn't (yet) achieve
 that in the case that the target directory name doesn't have a trailing
 slash.

 We need a test to go along with this patch -- perhaps just add some
 statements to {{{src/allmydata/test/test_system.py}}} to move a file into
 a directory-with-trailing-slash and assert that it works.  Err, wait a
 second -- there is already a test of this in
 [source:src/allmydata/test/test_system.py#L973].  It says:

 {{{
 d1.addCallback(self.log, "mv 'P/sekret data' P/personal/")
 d1.addCallback(lambda res:
     home.move_child_to(u"sekrit data", personal))
 }}}

 This test currently passes, even without your patch that looks for a
 trailing slash and appends the filename to the target URL.  Why is that?
 We should have a test that fails before we apply a patch to make the test
 pass.

 For the next part of the issue, we should add a test that tries to mv a
 file to a directory, without trailing slash.  According to Kevin Reid's
 suggestion, Tahoe should refuse to do anything in that case, e.g. if
 'sekret data' is a file and 'personal' is a directory, then {{{tahoe mv
 "sekret data" personal}}} should emit an error message and make no change.
 The test should make sure that tahoe emits a suitable error message, in
 addition to making sure that it doesn't move or remove the "sekret data"
 file.

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


More information about the tahoe-dev mailing list