After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 168287 - Rename file in archive can overwrite other existing files
Rename file in archive can overwrite other existing files
Status: RESOLVED FIXED
Product: file-roller
Classification: Applications
Component: general
2.6.x
Other All
: Normal normal
: ---
Assigned To: Paolo Bacchilega
Paolo Bacchilega
Depends on:
Blocks:
 
 
Reported: 2005-02-23 17:30 UTC by laszlo.kovacs
Modified: 2005-04-15 17:20 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
prompt on overwrite during renames (1.47 KB, patch)
2005-02-28 22:02 UTC, Glynn Foster
none Details | Review
Updated patch (1.51 KB, patch)
2005-02-28 23:36 UTC, Glynn Foster
none Details | Review
New version of the patch. (2.22 KB, patch)
2005-03-01 01:15 UTC, Glynn Foster
none Details | Review

Description laszlo.kovacs 2005-02-23 17:30:49 UTC
Please describe the problem:
When renaming a file or a folder to a new name the rename operation will
overwrite any other file or folder having the same name as the new name.

E.g. if there is an archive with two file in it called "1" and "2" if I rename
"2" to "1" then "1" will be deleted and "2" renamed as "1".

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:
A warning dialog should be displayed offering the user the decision to overwrite
or not.

Does this happen every time?


Other information:
Comment 1 Glynn Foster 2005-02-28 22:02:16 UTC
Here's a patch that should solve it - breaks the string freeze, so probably
can't go in until post 2.10.
Comment 2 Glynn Foster 2005-02-28 22:02:54 UTC
Created attachment 38074 [details] [review]
prompt on overwrite during renames
Comment 3 Luis Villa 2005-02-28 22:05:21 UTC
Surely that string can be copied in from somewhere else? it or something
basically identical must exist elsewhere...
Comment 4 Glynn Foster 2005-02-28 22:14:50 UTC
The strings in question are -

_("The file already exists.  Do you want to overwrite it?")
_("Overwrite")

while _("Overwrite") already exists in the translations, the only things close
to the other are -

_("The archive already exists.  Do you want to overwrite it?")
_("The archive is already present.  Do you want to overwrite it?")
[note, that's probably another bug that needs to be fixed ;)]

which don't seem to be appropriate.
Comment 5 Luis Villa 2005-02-28 22:18:30 UTC
I was thinking nautilus or something like that...
Comment 6 Luis Villa 2005-02-28 22:18:51 UTC
i only bring it up because this sure looks like data loss to me.
Comment 7 Glynn Foster 2005-02-28 22:32:53 UTC
Hrm, nautilus has -

#: libnautilus-private/nautilus-file-operations.c:1094
#, c-format
msgid "The file \"%s\" already exists.  Would you like to replace it?"

but I have no clue how I'd merge all the translations from another module.

Also just recently thought the patch might not be complete - it checks for the
existance of another file of the same name, but really if the relative path is
different there is no problem. Will test this out and update the patch if necessary.
Comment 8 Luis Villa 2005-02-28 22:35:25 UTC
Maybe christian can help :)
Comment 9 Glynn Foster 2005-02-28 23:36:35 UTC
Created attachment 38075 [details] [review]
Updated patch
Comment 10 Glynn Foster 2005-02-28 23:38:26 UTC
Here's an updated patch so that it doesn't prompt if there is a file of the same
filename in a different directory.

However, I couldn't for the life of me figure out how best to make the behavior
apply to directories, as those don't seem to be stored in the FileData struct.
Paolo, you might have to help me with this one ;)

To reproduce, rename a directory in an archive to the same name as an already
existing directory. It just overwrites without prompting, darnit.
Comment 11 Glynn Foster 2005-03-01 01:15:10 UTC
Created attachment 38078 [details] [review]
New version of the patch.
Comment 12 Glynn Foster 2005-03-01 01:23:45 UTC
Okay, another patch that seems to sort out the directories as well, although not
so happy with this approach - is this the only way? Also introduces another new
string.

Interestingly, renaming a directory, doesn't seem to unlink the old one if it's
empty, so you end up getting empty directories on extraction. Is this desired
behavior?
Comment 13 Glynn Foster 2005-04-07 01:25:11 UTC
Now free from string freeze.
Comment 14 Paolo Bacchilega 2005-04-15 17:20:53 UTC
fixed in cvs now.