FS#7372 - Rename should fail on invalid userinput.

Attached to Project: Rockbox
Opened by PaulJam (PaulJam) - Friday, 29 June 2007, 15:41 GMT
Last edited by Steve Bavin (pondlife) - Saturday, 09 February 2008, 14:58 GMT
Task Type Bugs
Category User Interface
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


When the user tries to move a directory inside itself by renaming it (e.g. remame directory "test" to "test/test2") then the renaming functionalyty doesn't fail gracefully.
The directory disappears from the filebrowserbrowser in Rockbox and also doesn't appear in the Windows explorer. When running chkdsk it asks to convert lost chains into files and this restores some (useless) files that contain fragments of the previous contents of the folder.

Also it is possible to use illegal characters in file- and foldernames. See  FS#7222  and  FS#6358 

H300 with version: r13733M-070629
This task depends upon

Closed by  Steve Bavin (pondlife)
Saturday, 09 February 2008, 14:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  petur fixed the outstanding dircache issue recently.
Comment by Steve Bavin (pondlife) - Friday, 06 July 2007, 22:42 GMT
There have been some recent changes to both FAT filename and rename validation - please can you recheck this?
Comment by PaulJam (PaulJam) - Saturday, 07 July 2007, 11:11 GMT
Using illegal characters when renaming doesn't seem to be possible anymore.
But i was still able to reproduce the first issue (moving a directory into itself via renaming) with revision r13811-070707 on a H300.

Wouldn't it be possible to just check the target path if it contains the current path of the directory when renaming?
A similar thing seems to be done when trying to do the same with the cut and paste functions from the context menu. Then it just shows a splash with "paste failed" and no harm is done to the filesystem.
Comment by absurdlyobfuscated (DrSpud) - Saturday, 07 July 2007, 23:50 GMT
Disallowing '/' characters (so you can't try to change directories via rename) can be done in merely one line. :)
Comment by absurdlyobfuscated (DrSpud) - Sunday, 08 July 2007, 00:42 GMT
One other thing that's somewhat related to  FS#6358 : The dircache is updated before a file is actually renamed or removed, making the browser not show things correctly when either fails. It's an easy fix, though.