Bug 187868 - Moving directories: skip on encoding error results in data loss
Summary: Moving directories: skip on encoding error results in data loss
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-22 17:35 UTC by Jerome
Modified: 2009-03-27 23:57 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 Jerome 2009-03-22 17:35:38 UTC
Version:            (using KDE 4.2.1)
OS:                Linux
Installed from:    Mandriva RPMs

I am moving directories from an XFS volume to another volume. There is an encoding problem: the source filesystem's encoding is ISO-8859, but it is mounted as UTF-8 by the OS. When a directory with (mangled) special character shows up, I get an error dialog saying "File or folder [mangled directory name] does not exist".

If I select "skip" or "autoskip", the target directory is created (with its mangled name), but its contents are not copied over. Still, everything is removed from the source directory, hence the data loss.

This might also happen with other (non encoding-related) errors, but I don't have a case at hand.
Comment 1 David Faure 2009-03-26 14:09:36 UTC
Is the source dir really deleted, or does F5 (Reload) bring it back?


I'm currently debugging this with the following testcase:
mkdir source; cd source; d=`echo latin1:é | recode u8..l1`; mkdir $d; touch $d/file1
And moving that directory to another partition (e.g. from $HOME to /tmp).

I don't even get an error message during the operation, but I see kio_file reporting errors. Looks like a bug in the error handling, I'll investigate.
But since kio_file fails at deleting the source dir anyway, I don't see a data loss.
Comment 2 David Faure 2009-03-26 17:28:50 UTC
SVN commit 944994 by dfaure:

Don't make the source dir "disappear" (visually, it was still there on disk) if there was an error while removing one of its subdir (e.g. wrong encoding).
This fix will be in 4.2.2 (just in time).
BUG: 187868

This is a more refined version of the fix for #118593 (retested, still works).
CCBUG: 118593


 M  +4 -4      copyjob.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=944994
Comment 3 Jerome 2009-03-27 03:34:35 UTC
David: sorry about the imprecision in the first report.
Here is a simpler view of the problem, which may or may not be solved by your fix.
In any filesystem, I do this:
d=`echo testé | recode 'u8..l1'`; mkdir $d; touch $d/data

Whatever I do, dolphin or konqueror will not display the contents of that directory, refreshing doesn't help.

So it looks like the problem was unrelated to the "move" operation: the source directories would have seemed empty from the beginning, even though they weren't.
Comment 4 David Faure 2009-03-27 16:38:18 UTC
This is correct. KDE (Qt, in fact) does not support non-utf8 filenames on a utf8 locale.

My fixes were merely so that the copy/move operations don't do nonsensical things upon error. But I cannot fix the fact that a folder with such a name is not usable in KDE.
Comment 5 Jerome 2009-03-27 22:16:12 UTC
I see. The problem is, that may not be obvious to the user: instead the most obvious conclusion is "this directory is empty". Konqueror is a bit more helpful that dolphin on this, because it pops up an error message "directory XXX does not exist", so the user does not expect normal behavior. Instead, dolphin displays the error in the status bar, in a pretty discrete way that is easy to miss.

I would suggest the following improvement: the directory should not appear to be open (and empty) if its contents are actually not accessible to kio. for example, the location bar should not show the path to that directory, etc, to make it clear that the file manager cannot access that location. Does that sound reasonable? Should I submit this as a feature request for dolphin?
Comment 6 David Faure 2009-03-27 23:57:03 UTC
I see. I was testing in konqueror, of course.

A dolphin wish sounds like a good idea indeed.