Bug 109181 - Konqueror removes symlinks on directories recursively
Summary: Konqueror removes symlinks on directories recursively
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unclassified
Component: ftp (show other bugs)
Version: unspecified
Platform: openSUSE RPMs Linux
: NOR major (vote)
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-16 19:20 UTC by Candid Dauth
Modified: 2008-10-14 03:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Candid Dauth 2005-07-16 19:20:03 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    SuSE RPMs
OS:                Linux

I just removed a symlink on a directory on my webspace. Konqueror did not notice it was a symlink and removed it recursively like a real directory. So the data that was in the target directory is now deleted.

Good luck I’d call this, I was about to remove some other symlinks, deleting them would probably have deleted the whole content of my webspace.


So Konqueror should first check if the ftp directory I’m trying to remove was a symlink and then only remove that.
Comment 1 Thiago Macieira 2005-07-17 01:12:17 UTC
Data loss -> raising severity.
Comment 2 David Faure 2005-07-17 01:23:48 UTC
Ouch, sorry for the data loss. This shouldn't happen, obviously.
Can you tell me which konqueror view mode you were using? Icon view, detailed list view, or tree view?
The protocol used was FTP, right?
Comment 3 Candid Dauth 2005-08-16 22:57:08 UTC
Yep, the protocol was FTP, the view mode was icon view.
Comment 4 Martin Koller 2006-12-17 17:47:09 UTC
Can confirm with 3.5.5
Looking into kioslave/ftp/ftp.cc I find some comments on this, e.g.:

    // Links on ftp sites are often links to dirs, and we have no way to check
    // that. Let's do like Netscape : assume dirs generally.
    // But we do this only when the mimetype can't be known from the filename.
    // --> we do better than Netscape :-)

I have no idea but maybe this is the reason for this "bug" and maybe it can not be done better ?

Hope David Faure can comment on this.
Comment 5 David Faure 2008-10-14 03:12:36 UTC
SVN commit 871146 by dfaure:

Fix grave kio bug with FTP: if you delete a symlink to a folder, it would recursively delete the folder (!)
Sounds stupid, but it's FTP which is stupid; the only way to know if something is a link is by listing its parent dir,
but this isn't always possible (if no permission to list the parent dir)... -> the URL isn't enough info, we need
the KFileItem from the listing. Rather than adding KIO::del(KFileItemList) (and porting a lot of code), I simply
grab the KFileItem from KDirListerCache, as discussed with Michael Brade in 2006 for other reasons.
As a side effect, this speeds up deletion (again!) in the case of remote protocols (saves a KIO::stat per toplevel item to delete).
BUG: 109181


 M  +13 -0     deletejob.cpp  
 M  +15 -2     kdirlister.cpp  
 M  +13 -1     kdirlister.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=871146