- Status Closed
- Percent Complete
- Task Type Bugs
- Category Operating System/Drivers
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Daily build (which?)
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#9864 - When cutting and pasting, overwriting doesn't work
When moving files or directories by cutting and pasting, if the destination exists I am asked if I want to overwrite. If I say yes, the operation fails. This is because the rename fails because the destination exists. Copying and pasting works properly.
The attached patch fixes the problem by deleting the target if it exists just before the rename. (At this point the user has already agreed to overwrite the target.)
This was tested with r19907 on my 30GB 5G iPod. It should not depend on the player type.
Closed by MikeS
2017-10-20 15:07
Reason for closing: Out of Date
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
2017-10-20 15:07
Reason for closing: Out of Date
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
Overwriting existing files in bulk or
individually works with newer file code.
rename() works as in Posix spec.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
Hi, I was unable to reproduce this in a sim.
Could you please add some instructions for how to reproduce?
To see the issue when pasting files, have the following:
/file
/directory/file
Hold select on /file, cut. Go into /dir, hold select, paste and confirm that you want to overwrite by pressing select. You’ll get “Paste failed”.
To see the issue when pasting directories, have:
/dira/file
/dirb/dira/file
Hold select on /dira, cut. Go into /dirb, hold select, paste and confirm that you want to overwrite by pressing select. Again “Paste failed”.
In the file case, both my iPod and the sim ask if I want to overwrite. In the directory case, my iPod asks but the sim doesn’t. If I enable dircache in the sim, then it asks if I want to overwrite the directory. I think this is because when dircache is disabled, file_exists in apps/misc.c checks for the existence of a file by trying to open it for reading. Rockbox and some other OSes allow opening directories like that, but Windows doesn’t.
Couldn’t we provide an option “save under other (automatically generated) name”? At least in the case that a file is pasted. I.e. if the file X.mp3 exists, the pasted file would be saved as X(1).mp3. (The “(1)” part would be generated automatically. We’d have to find such n that X(n).mp3 does not exist.) Or is it too much of good?
The create_numbered_filename function could be used to create the automatically generated name. Also note that there’s the case where one directory is overwriting another directory, and only some files in that directory and/or its subdirectories conflict. I am wondering if this would be a useful feature or needless bloat.
I found another issue: overwriting a directory with a file or a file with a directory fails, and this happens with both cut and copy, and even with the patch I submitted.
Yes, I see the issues with copying directories and conflicts in files/subdirs, therefore I proposed this for files only. But I still think it might be useful. Imagine that you copied/cut a file, then navigated a log way to another directory. Now you want to paste but the file already exists. You didn’t know that and don’t want to overwrite. So you first have to rename the old file. If the file to be pasted is still in the “clipboard” then there’s no problem. But if it’s forgotten then you have to go back to the file, copy it, go again a long way and paste.
The issue with copying files over a dir or vice versa is of course a bug. I think, there is a function “dir_exists” which should also be called prior to copying.