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 434575 - Text file position on desktop changed when file saved (regression from 2.16)
Text file position on desktop changed when file saved (regression from 2.16)
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Desktop
2.20.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 436366 481665 493873 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-04-30 12:40 UTC by Kamil Páral
Modified: 2008-10-20 11:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20



Description Kamil Páral 2007-04-30 12:40:07 UTC
Ubuntu 7.04, Gnome 2.18.

When you have text file somewhere on your desktop, open it (with gedit), edit it, and save it, it's position will change. The file icon will move to the top left corner (like when creating new file). This is a regression from Gnome 2.16. This behaviour is regardless of auto-arrange setting.

Steps to reproduce:
1. Create new text file on desktop. Move it eg. to the center of desktop.
2. Open with gedit, edit it and save it.
3. The text file will move from the center to the top left corner.

Expected behaviour:
Text file stays where the user placed it.

Notes:
This problem does not happen with OpenOffice.org or console-based editors (nano, mcedit). There could be problem in how gedit handles file saving. Nevertheless, this didn't happen in the previous version of Gnome.
Comment 1 Nelson Benitez 2007-05-05 16:33:22 UTC
The regression is probably due to http://bugzilla.gnome.org/show_bug.cgi?id=45953#c38 , if that's true then maybe nautilus have to wait a little before deleting metadata or maybe gedit has to change the way it saves a file...
Comment 2 Ageorgo 2007-05-13 09:29:01 UTC
Ubuntu 7.04, Gnome 2.18.1

This problem happen also when using gvim - version with GTK2-GNOME GUI. Metadata for the saved file are erased - position, emblem, notes. When saving in Eclipse or Netbeans metadata stays untouched.
Comment 3 Kamil Páral 2007-05-13 09:38:52 UTC
Since there is really a loss of user data (even metadata like emblems and especially notes), I raise severity to "critical" (according to the guidelines in the severity field)...
Comment 4 Nelson Benitez 2007-05-13 11:32:23 UTC
Gedit developer has already said in http://bugs.gnome.org/436366#c1 that this has to be fixed in Nautilus...
Comment 5 Kamil Páral 2007-09-29 12:55:36 UTC
still bugged in gnome 2.20...
Comment 6 Sebastien Bacher 2007-10-02 13:14:17 UTC
*** Bug 436366 has been marked as a duplicate of this bug. ***
Comment 7 Sebastien Bacher 2007-10-02 13:14:24 UTC
*** Bug 481665 has been marked as a duplicate of this bug. ***
Comment 8 Ageorgo 2007-11-14 20:45:26 UTC
I played a little with this bug and probably discovered the problem. Touching, modifying, truncating... whatever you do with the file, nothing forces nautilus to delete it's metadata, only if you rename or delete the file.
And now the interesting part.. I checked the gedit sourcecode and discovered the way how they save documents, (simplified):

A) backup enabled
 1) save document to a temp file
 2) move file to a backup file <-- nautilus deletes metadata
 3) move temp file to the file place

B) backup disabled
 1) save document to a temp file
 2) move file to a backup file <-- nautilus deletes metadata
 3) move temp file to the file place
 4) delete the backup file..

Source code says that moving, not copying the original file to backup is there for performance reason (which makes sense if the document is really big).
Comment 9 Nelson Benitez 2007-11-14 23:43:28 UTC
I wonder if the way the new gvfs library deals with metadata could solve this bug... 
Comment 10 Ageorgo 2007-11-15 08:05:42 UTC
(In reply to comment #9)
> I wonder if the way the new gvfs library deals with metadata could solve this
> bug... 
> 

Well I think it will solve the problems with gvfs aware applications, e.g. new versions of gedit, gvim-gtk, gvim-gnome... But the problem described above stays, because that use case for fast and safe file saving is probably quite common also in low level utilities (vi).

Right now nautilus probably deletes metadata on file delete (?file move?), maybe they should be preserved for some delay.
Use cases:

1) application writes to tmp_file
2) mv file -> backup     <-- nautilus is notified, start countdown
3) mv tmp_file -> file
... delay
4) nautilus countdown finished, file still there, do nothing

1) mv file -> backup / rm file  <-- nautilus is notified, start countdown
... delay
2) nautilus countdown finished, file not there there, delete metadata

There is also possibility to not initiate the countdown, just mark metadata with a flag "FOR DELETION" and on the next startup (or in some garbage collection thread) check existence of files and if they are not present delete appropriate metadata.
Comment 11 David Rowell 2007-11-15 12:00:24 UTC
Why must Nautilus delete the metadata at all?  Why not just leave it alone under move?  That seems to solve this bug and address another user inconvenience - that moving a file from a backup (CD - another partition ...) will also lose the metadata.


(In reply to comment #10)
> (In reply to comment #9)
> > I wonder if the way the new gvfs library deals with metadata could solve this
> > bug... 
> > 
> 
> Well I think it will solve the problems with gvfs aware applications, e.g. new
> versions of gedit, gvim-gtk, gvim-gnome... But the problem described above
> stays, because that use case for fast and safe file saving is probably quite
> common also in low level utilities (vi).
> 
> Right now nautilus probably deletes metadata on file delete (?file move?),
> maybe they should be preserved for some delay.
> Use cases:
> 
> 1) application writes to tmp_file
> 2) mv file -> backup     <-- nautilus is notified, start countdown
> 3) mv tmp_file -> file
> ... delay
> 4) nautilus countdown finished, file still there, do nothing
> 
> 1) mv file -> backup / rm file  <-- nautilus is notified, start countdown
> ... delay
> 2) nautilus countdown finished, file not there there, delete metadata
> 
> There is also possibility to not initiate the countdown, just mark metadata
> with a flag "FOR DELETION" and on the next startup (or in some garbage
> collection thread) check existence of files and if they are not present delete
> appropriate metadata.
> 

Comment 12 Nelson Benitez 2007-11-15 12:41:16 UTC
(In reply to comment #11)
> Why must Nautilus delete the metadata at all?  Why not just leave it alone
> under move?  That seems to solve this bug and address another user
> inconvenience - that moving a file from a backup (CD - another partition ...)
> will also lose the metadata.
> 

That would be imo the best solution, but unfortunately the file changes monitor that nautilus uses doesn't support a "file_renamed" event, instead a rename is seen as a "file_deleted" event next to a "file_created" event.

You can see it for yourself in ttp://svn.gnome.org/viewvc/nautilus/trunk/libnautilus-private/nautilus-monitor.c?revision=13421&view=markup , see the monitor_notify_cb function...


Maybe nautilus could create its own abstracted "file_renamed" event, even if the underlying monitor library didn't support it, e.g. when nautilus receives a delete event fire a timer to wait for a created event that points to the same inode hard disk data that the previous delete, then nautilus could send its own "file_renamed" event... 

This is just chatting because I have not investigated if this is possible... maybe a nautilus developer could comment on that...
Comment 13 Ageorgo 2007-11-15 12:53:13 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > Why must Nautilus delete the metadata at all?  Why not just leave it alone
> > under move?  That seems to solve this bug and address another user
> > inconvenience - that moving a file from a backup (CD - another partition ...)
> > will also lose the metadata.
> > 
> 

This is correct, but only if you are moving file around the disk(s) - you intentionally execute file move. But if the clever application (gedit, vi) does this in the background for you, medata will be lost again.. ok not lost but will be on the another file, in this case the backup file.

> That would be imo the best solution, but unfortunately the file changes monitor
> that nautilus uses doesn't support a "file_renamed" event, instead a rename is
> seen as a "file_deleted" event next to a "file_created" event.
> 

Inotify has support for this, events IN_MOVED_FROM, IN_MOVED_TO - when the file is moved or renamed.
Comment 14 Nelson Benitez 2007-11-15 13:19:39 UTC
> > That would be imo the best solution, but unfortunately the file changes monitor
> > that nautilus uses doesn't support a "file_renamed" event, instead a rename is
> > seen as a "file_deleted" event next to a "file_created" event.
> > 
> 
> Inotify has support for this, events IN_MOVED_FROM, IN_MOVED_TO - when the file
> is moved or renamed.
> 

 That's good news, I will request for comment on nautilus list.
Comment 15 Kamil Páral 2008-04-08 21:30:05 UTC
This has been fixed in GNOME 2.22 (Ubuntu 8.04).
Comment 16 Nelson Benitez 2008-10-20 11:03:22 UTC
*** Bug 493873 has been marked as a duplicate of this bug. ***