Bug 270150 - syncing of files with hashkey as filenamebeginning "#" in krusader deletes the whole directory
Summary: syncing of files with hashkey as filenamebeginning "#" in krusader deletes th...
Status: RESOLVED FIXED
Alias: None
Product: krusader
Classification: Applications
Component: synchronize (show other bugs)
Version: 2.4.0-beta3 "Single Step"
Platform: Unlisted Binaries Linux
: NOR critical
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
: 329896 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-05 14:10 UTC by rubo77
Modified: 2018-05-06 00:15 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
this shows how to reproduce the bug (154.67 KB, image/png)
2011-04-05 14:15 UTC, rubo77
Details
proposed patch (17.42 KB, text/plain)
2016-02-16 08:02 UTC, Martin Kostolný
Details
A case seen with the patch sent by Martin Kostolny (64.95 KB, image/png)
2016-02-20 15:39 UTC, Toni Asensi Esteve
Details
If it may help, I attach a screenshot: "After trying to synchronize, in Krusader two folders that could not be synchronized were seen that way; let's notice the %23 at the left panel.png" (30.97 KB, image/png)
2016-02-20 17:17 UTC, Toni Asensi Esteve
Details
patch v2 (18.26 KB, text/plain)
2016-02-20 23:03 UTC, Martin Kostolný
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rubo77 2011-04-05 14:10:08 UTC
Version:           unspecified
OS:                Linux

i just tried to sync 2 folders /blabla/ over ssh connection, and there was a file called #test# in the online folder which was an old backup.
i selected to delete that file during syncing and then this happened:

it took ages to syng just 7 small files, and suddenly krusader said: cannot delete the file ssh://..../blabla/otherfile.php

after this the otherfile.php and all files in that folder were deleted!!!!

it seems, like the ssh sync sends the command:
rm ssh://..../blabla/#test#
and the filename becomes a comment and this results in
rm ssh://..../blabla/



Reproducible: Always

Steps to Reproduce:
i attached an example



krusader-2.0.0-beta1

see http://sourceforge.net/tracker/?func=detail&atid=106488&aid=3203002&group_id=6488
Comment 1 rubo77 2011-04-05 14:15:13 UTC
Created attachment 58597 [details]
this shows how to reproduce the bug
Comment 2 Dawit Alemayehu 2013-02-02 15:41:57 UTC
This has nothing to do with kioslave since I cannot reproduce whatever the user is attempting to describe here using either Dolphin or Konqueror. This must be caused by functionality specific to krusader or something else...
Comment 3 Jan Lepper 2013-02-02 20:59:03 UTC
confirmed in 2.4.0-beta3
Comment 4 Jan Lepper 2013-02-03 19:25:23 UTC
The cause is the usage of not properly escaped paths in URLs.
If a path contains '#', everything that follows '#' it is interpreted as the fragment part of the URL and not part of the file path.
I'm working in a fix.
Comment 5 Jan Lepper 2013-09-22 12:06:06 UTC
FYI: I'm NOT working on a fix any longer.
The syncronizer is considered unmaintained and the build has been disabled by default.
Comment 6 rubo77 2013-09-29 16:41:39 UTC
Why the hell is the synchronizer unmaintained???

The synchronizer is one of the killer feature over other file browsers and brings it nearer to a usable substitute of Total Commander on Windows.

Or is there an alternative to the synchronizer planned in Krusader?
Comment 7 Jan Lepper 2013-11-26 17:23:42 UTC
On Sun, 29 Sep 2013 16:41:39 +0000
rubo77 <ubuntu@spacetrace.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=270150
> 
> --- Comment #6 from rubo77 <ubuntu@spacetrace.org> ---
> Why the hell is the synchronizer unmaintained???
> 
> The synchronizer is one of the killer feature over other file
> browsers and brings it nearer to a usable substitute of Total
> Commander on Windows.
> 
> Or is there an alternative to the synchronizer planned in Krusader?
> 

Guess why ...
Nobody is there to maintain it :-(
For further explanation have a look at the krusader-devel mailing list.
Comment 8 Toni Asensi Esteve 2015-07-12 17:14:01 UTC
Git commit 7480bc3b95e41c876761bc11ef23d90a02fb2f56 by Toni Asensi Esteve.
Committed on 12/07/2015 at 11:48.
Pushed by asensi into branch 'master'.

In the synchronizer: until the bug 270150 is solved, stop using protocols like FISH, SFTP, SMB, etc. Check if the target or the source directory are empty

Before this change was applied, the bug caused problems if fish://, sftp://, or smb:// were directly used; however, using sshfs mounts (with e.g. sudo sshfs [...]), every synchronization seemed to work correctly, even using files that had one # (or several ones) in their names.

REVIEW: 124326

M  +30   -0    krusader/Synchronizer/synchronizergui.cpp

http://commits.kde.org/krusader/7480bc3b95e41c876761bc11ef23d90a02fb2f56
Comment 9 Toni Asensi Esteve 2015-07-13 09:14:39 UTC
Just to clarify:
This bug is not solved, the latest source code modifications have the aim of not allowing synchronizer to directly use protocols like FISH, SFTP, SMB, etc.; and so protecting the user. If this bug was solved, synchronizer would be able to directly use those protocols.
Comment 10 Martin Kostolný 2016-02-16 08:02:16 UTC
Created attachment 97242 [details]
proposed patch

The main idea behind this patch is checking whether QUrl isLocalFile. And if it is not a local file -> escape the uri's "#" character. This logic is done in a separate method so it can be changed from one place and this way applied to all uses throughout Synchronizer code.

I'm no Qt guru but I'm willing to maintain Synchronizer part of Krusader since it is currently unmaintained.
Comment 11 Toni Asensi Esteve 2016-02-20 15:39:53 UTC
Created attachment 97314 [details]
A case seen with the patch sent by Martin Kostolny

Hi, Martin, thank you for your interest, a maintainer for the synchronizer part of Krusader is needed :-)

I've tried your patch; although the operations that need to be done are correctly calculated, when applying those operations there are files that are never deleted, I attach a screenshot. I can tell you about the tests that were done, or whatever is necessary. Thank you again for your interest!
Comment 12 Toni Asensi Esteve 2016-02-20 17:17:25 UTC
Created attachment 97315 [details]
If it may help, I attach a screenshot: "After trying to synchronize, in Krusader two folders that could not be synchronized were seen that way; let's notice the %23 at the left panel.png"
Comment 13 Toni Asensi Esteve 2016-02-20 17:22:14 UTC
> let's notice the %23 at the left panel

I mean that, as it could be seen in the first screenshot, in the real name of that directory there are no %23 but #
Comment 14 Toni Asensi Esteve 2016-02-20 17:22:28 UTC
*** Bug 329896 has been marked as a duplicate of this bug. ***
Comment 15 Martin Kostolný 2016-02-20 23:02:14 UTC
Thank you very much for your extensive testing and help. I've tested my use cases only with sftp. I should have done it with more. So now I created the same test case as you ("1" and "2" directories with nested "#test#" contents...).

Surprisingly I didn't run into any problems with sftp and ftp protocols. Even fish protocol was fine until I used special czech characters such as "č", "ě" etc. It seems to be a problem with filename encoding and fish protocol. I'll file a separate bug report for that since dolphin is also affected by this issue.

You also mentioned %23 text in address bar and tabs. I believe this issue was already present before applying my patch. Aside from visual effect it should not have any bad influence in synchronizing directories.

Can you confirm any of my findings
- is sftp working fine?
- was there a special (excluding #) character in your tested fish path?
...or can you please direct me to more specific test case?

Thanks again!

PS: I'm posting a little more polished patch - it should do exactly the same as the previous one but just to be sure we are testing with the same code. Or should we continue this in review board?
Comment 16 Martin Kostolný 2016-02-20 23:03:09 UTC
Created attachment 97319 [details]
patch v2
Comment 17 Martin Kostolný 2016-02-20 23:06:56 UTC
I'm not saying that showing %23 in address path shouldn't be fixed. I just think it should be fixed as a separate commit & bug.
Comment 18 Toni Asensi Esteve 2016-03-07 22:10:56 UTC
After some conversations (and a review request in https://git.reviewboard.kde.org/r/127287/), this bug was set as fixed thanks to Martin Kostolný.