Menu

#28 Error on FakeFtpServer rename

v1.0_(example)
open
None
5
2016-10-02
2016-10-02
Chris Mair
No

Opened this ticket for bug described in https://sourceforge.net/p/mockftpserver/discussion/748298/thread/681b98b9/:
Renaming a directory fails due to descendents returning out of order.

It looks like the AbstractFakeFileSystem.descendents returns a list with children listed ahead of their parent directories. When this is called from rename (line 165) it can return a/b/c1, a/b/c2, a/b, and then fail on renaming the 3rd element since it already exists implicitly by renaming the first two elements. This causes rename operations on directories to fail.

Adding a COllections.sort to the result of the descendents() method appears to fix this.

Discussion

  • Chris Mair

    Chris Mair - 2016-10-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,5 @@
    -Opened this ticket for bug described in  https://sourceforge.net/p/mockftpserver/discussion/748298/thread/681b98b9/.
    +Opened this ticket for bug described in  https://sourceforge.net/p/mockftpserver/discussion/748298/thread/681b98b9/:
    +*Renaming a directory fails due to descendents returning out of order*.
    
     > It looks like the AbstractFakeFileSystem.descendents returns a list with children listed ahead of their parent directories. When this is called from rename (line 165) it can return a/b/c1, a/b/c2, a/b, and then fail on renaming the 3rd element since it already exists implicitly by renaming the first two elements. This causes rename operations on directories to fail.
     > 
    
     
  • Chris Mair

    Chris Mair - 2016-10-02

    Fixed for MockFtpServer v2.7