Bug 162358

Summary: rename on vfat filesystem broken
Product: [Unmaintained] kdelibs Reporter: Edward Nygma <Enygma2002_ro>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: andresbajotierra, faure
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Edward Nygma 2008-05-20 15:13:41 UTC
Version:           1.0.2 (using 4.0.3 (KDE 4.0.3), 4.0.3-7.fc9 Fedora)
Compiler:          gcc
OS:                Linux (i686) release 2.6.25.3-18.fc9.i686

I have mounted a FAT32 partition like so:
/dev/sda5               /mnt/d                  vfat    rw,exec,nosuid,nodev,shortname=mixed,utf8,uid=500       0       0

I create a directory called "aa".
I try to rename the directory to "Aa".
 I get a warning that the directory named "Aa" already exists and that the source file is "aa" and asking me to rename or overwrite.
  If I overwrite at this stage, the directory gets DELETED.
  A workaround for this is to rename to "aa2" for instance and then rename to "Aa".

On NTFS works perfectly but on vfat does not.

Please fix as this is not the correct behavior.

Thanks.
Comment 1 Dario Andres 2008-08-26 14:30:41 UTC
Using KDE 4.1.1 (KDE 4.1.0 (4.1 >= 20080722)) (KDEmod) in ArchLinux i686:
Using a VFAT USB pendrive.

Trying to reproduce this bug,I got another related bug:

Steps to reproduce:
- Create a folder "aa" inside the USB pendrive
- Create some file inside that folder
- Rename "aa" to "Aa"
An "Already Exists as Folder" dialog appears.
- Click "Overwrite"
A "File Already Exists" dialog appears (the file inside the folder)

If you press Skip, nothing is changed and the folder remains "aa"
If you press Overwrite, the dialog come back again. (you get and endless loop of clicking "overwrite" and "file already exists" dialog)
Comment 2 Oswald Buddenhagen 2008-08-26 21:33:11 UTC
this is a limitation of the linux kernel. the rename trick is the only way around i know.
Comment 3 David Faure 2010-02-26 14:42:56 UTC
The thing is, KIO tries the rename trick internally already, but evidently fails in some cases.
Comment 4 David Faure 2010-03-30 20:59:13 UTC
SVN commit 1109201 by dfaure:

Fix qt4 porting bugs in the code that handles renaming to lowercase/uppercase on FAT partitions:
The porting diff is amazing, looking back at it...
-            tmpFile.unlink();
+            tmpFile.setAutoRemove(false);
The other bug was a missing trailing slash in the tempfile prefix.
CCBUG: 162358


 M  +26 -20    copyjob.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1109201
Comment 5 David Faure 2010-03-30 21:08:35 UTC
SVN commit 1109204 by dfaure:

Also emit FileRenamed so that the view updates after the specially-handled-rename-on-FAT.
CCBUG: 162358


 M  +1 -0      copyjob.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1109204
Comment 6 David Faure 2010-03-30 21:11:23 UTC
SVN commit 1109205 by dfaure:

Backport both fixes for renaming-on-VFAT
Fixed for: 4.4.2
BUG: 162358


 M  +27 -20    copyjob.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1109205
Comment 7 David Faure 2010-03-30 21:13:35 UTC
OK, I've been away for too long, 4.4.2 is already released. I meant, Fixed for: 4.4.3, then.