sftp rename dir1 dir2 will rename dir1 => dir2/dir1

Bug #87934 reported by John A Meinel
24
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Jonathan Lange
Twisted
Fix Released
Unknown

Bug Description

sftp://bazaar.launchpad.net/ allows a rename of one directory to another directory to put the first directory as a sub-dir.

Steps to reproduce:
    sftp> mkdir ~user/+junk/junk
    sftp> cd ~user/+junk/junk
    sftp> mkdir directory1
    sftp> mkdir directory2
    sftp> rename directory1 directory2
    sftp> ls
    directory2
    sftp> ls directory2
    directory2/directory1
    sftp>

It should have failed the rename rather than putting it as a subdirectory.

Some filesystems will allow directory1 to overwrite directory2, so a better test would include adding at least one file into both directories first.

Tags: lp-code
John A Meinel (jameinel)
Changed in launchpad-bazaar:
assignee: nobody → spiv
status: Unconfirmed → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

For comparison, here's the behaviour of an OpenSSH SFTP server (serving an ext3 filesystem on linux):

    $ sftp localhost
    Connecting to localhost...
    andrew@localhost's password:
    sftp> cd /tmp
    sftp> mkdir directory1
    sftp> mkdir directory2
    sftp> rename directory1 directory2
    Couldn't rename file "/tmp/directory1" to "/tmp/directory2": Failure

So it's not just a peculiarity of the OpenSSH's sftp client.

Andrew Bennetts (spiv)
Changed in launchpad-bazaar:
importance: Undecided → High
Revision history for this message
Jonathan Lange (jml) wrote :

Yoink

Changed in launchpad-bazaar:
assignee: spiv → jml
Jonathan Lange (jml)
Changed in twisted:
importance: Undecided → Unknown
status: Unconfirmed → Unknown
Revision history for this message
Jonathan Lange (jml) wrote :

Up for review

Changed in launchpad-bazaar:
status: Confirmed → In Progress
Revision history for this message
Jonathan Lange (jml) wrote :

I have a patch for Twisted which is navigating the review process now.

I'm not sure exactly how Launchpad manages (or should manage) upgrading Twisted.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 87934] Re: sftp rename dir1 dir2 will rename dir1 => dir2/dir1

On Sun, 2007-04-29 at 23:57 +0000, Jonathan Lange wrote:
> I have a patch for Twisted which is navigating the review process now.
>
> I'm not sure exactly how Launchpad manages (or should manage) upgrading
> Twisted.

Launchpad runs a managed copy of twisted, just like it does bzr.

I believe we've cherry picked fixes into it previously, so the twisted
review process shouldn't affect or delay our fixing the lp copy of
twisted.

-Rob

--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Revision history for this message
Jonathan Lange (jml) wrote :

Yeah it should. It's good to get feedback from Twisted on whether the fix is the right fix to do, and it sucks to have our managed copy of Twisted diverging from upstream.

Revision history for this message
John A Meinel (jameinel) wrote :

Well, the nice thing is that you could merge it for now. And if they feel the fix should be different. You can revert it, and merge the upstream fix in the future.

Revision history for this message
Jonathan Lange (jml) wrote :

Fix was committed on May 24. Separate branch adds acceptance tests and is pending review.

Changed in launchpad-bazaar:
status: In Progress → Fix Committed
Tim Penhey (thumper)
Changed in launchpad-bazaar:
status: Fix Committed → Fix Released
Changed in twisted:
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.