Document is reloaded after save

Bug #854334 reported by OpEx
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Scribes
In Progress
Critical
Mystilleef

Bug Description

When a document is saved it's reloaded which causes edit history to be lost.

========================================================
System Info: ('Linux', 'computer', '2.6.38-11-generic', '#48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011', 'x86_64')
Python Version: 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_functools', '_hashlib', '_locale', '_random', '_socket', '_sre', '_ssl', '_struct', '_symtable', '_warnings', '_weakref', 'array', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'errno', 'exceptions', 'fcntl', 'gc', 'grp', 'imp', 'itertools', 'marshal', 'math', 'operator', 'posix', 'pwd', 'select', 'signal', 'spwd', 'strop', 'sys', 'syslog', 'thread', 'time', 'unicodedata', 'xxsubtype', 'zipimport', 'zlib')
========================================================
Scribes Version: 0.4-dev-build988
Dbus Version: (0, 83, 1)
GTK+ Version: (2, 24, 4)
PyGTK Version: (2, 22, 0)
Psyco Not Installed
========================================================
Running Instance: 1
========================================================
Python Path: /usr/lib/python2.7/dist-packages
Plugin Path: /usr/lib/scribes/GenericPlugins
Data Path: /usr/share/scribes
Executable Path: /usr/bin
========================================================

Revision history for this message
Mystilleef (mystilleef) wrote :

Hey thanks! Check back in a few hours. I have a fix I'll be pushing to launchpad soon.

Changed in scribes:
assignee: nobody → Mystilleef (mystilleef)
importance: Undecided → Critical
status: New → In Progress
Revision history for this message
Mystilleef (mystilleef) wrote :

I pushed build 992 to launchpad. Please test.

Changed in scribes:
status: In Progress → Fix Committed
Revision history for this message
Ian van der Neut (ivdneut) wrote :

Still does it for me:
========================================================
System Info: ('Linux', 'bhw188.knmi.nl', '2.6.35.13-92.fc14.i686.PAE', '#1 SMP Sat May 21 17:33:09 UTC 2011', 'i686')
Python Version: 2.7 (r27:82500, Sep 16 2010, 18:03:06)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_codecs', '_sre', '_symtable', '_warnings', 'errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'pwd', 'signal', 'sys', 'thread', 'zipimport')
========================================================
Scribes Version: 0.4-dev-build992
Dbus Version: (0, 83, 0)
GTK+ Version: (2, 22, 0)
PyGTK Version: (2, 17, 0)
Psyco Not Installed
========================================================
Running Instance: 1
========================================================
Python Path: /usr/people/<user>/.local/lib/python2.7/site-packages
Plugin Path: /usr/people/<user>/.local/lib/scribes/GenericPlugins
Data Path: /usr/people/<user>/.local/share/scribes
Executable Path: /usr/people/<user>/.local/bin
========================================================

Revision history for this message
Mystilleef (mystilleef) wrote :

Ian,

Where is the location of the file you're editing?

Changed in scribes:
status: Fix Committed → Triaged
Revision history for this message
Mystilleef (mystilleef) wrote :

Ian and OpEx,

Please test build 994.

Changed in scribes:
status: Triaged → In Progress
Revision history for this message
OpEx (opex) wrote :

It still reloads the file when saved. I have noticed that I have to have at least two documents open to have it manifest. And it doesn't matter if they're local files or a mounted share.

Revision history for this message
OpEx (opex) wrote :

Might be interesting to know that this is not present in 0.4-dev-build954

Revision history for this message
Mystilleef (mystilleef) wrote :

Opex is this with build 994? Please post scribes -i

Revision history for this message
Ian van der Neut (ivdneut) wrote :

Not witnessing the behaviour on local disk on ubuntu 10.04 (ppa build 992). Previous occurrance was on FedoraCore14 on a NFS mounted share. Can't test that right now, will get back on it first thing in the morning (CET timezone) when I get to the office.

Revision history for this message
Mystilleef (mystilleef) wrote :

Thanks Ian!

I discovered a subtle bug in build 992. Please update to
build 994 or better before testing.

Thanks

Revision history for this message
Mystilleef (mystilleef) wrote :

OpEx,

Make sure you close old instances of scribes before testing
by pressing (ctrl+q). Otherwise, you'd be running old
versions of Scribes. You can also do

killall scribes

to be sure.

Thanks

Revision history for this message
OpEx (opex) wrote :

Still present in 0.4-dev-build994

How to reproduce:
Open a document in scribes.
Open a second document with scribes
Save either document

========================================================
System Info: ('Linux', 'computer', '2.6.38-11-generic', '#48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011', 'x86_64')
Python Version: 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_functools', '_hashlib', '_locale', '_random', '_socket', '_sre', '_ssl', '_struct', '_symtable', '_warnings', '_weakref', 'array', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'errno', 'exceptions', 'fcntl', 'gc', 'grp', 'imp', 'itertools', 'marshal', 'math', 'operator', 'posix', 'pwd', 'select', 'signal', 'spwd', 'strop', 'sys', 'syslog', 'thread', 'time', 'unicodedata', 'xxsubtype', 'zipimport', 'zlib')
========================================================
Scribes Version: 0.4-dev-build994
Dbus Version: (0, 83, 1)
GTK+ Version: (2, 24, 4)
PyGTK Version: (2, 22, 0)
Psyco Not Installed
========================================================
Running Instance: 0
========================================================
Python Path: /usr/lib/python2.7/dist-packages
Plugin Path: /usr/lib/scribes/GenericPlugins
Data Path: /usr/share/scribes
Executable Path: /usr/bin
========================================================

Revision history for this message
Ian van der Neut (ivdneut) wrote :

Have been using 994 for about 30 to 40 minutes now. At first the problem didn't surface, but just now it started showing the behaviour again.

Home directory and current working directory are NFS mounted.

LInux distro FC14.

========================================================
System Info: ('Linux', host', '2.6.35.13-92.fc14.i686.PAE', '#1 SMP Sat May 21 17:33:09 UTC 2011', 'i686')
Python Version: 2.7 (r27:82500, Sep 16 2010, 18:03:06)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_codecs', '_sre', '_symtable', '_warnings', 'errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'pwd', 'signal', 'sys', 'thread', 'zipimport')
========================================================
Scribes Version: 0.4-dev-build994
Dbus Version: (0, 83, 0)
GTK+ Version: (2, 22, 0)
PyGTK Version: (2, 17, 0)
Psyco Not Installed
========================================================
Running Instance: 1
========================================================
Python Path: /usr/people/user/.local/lib/python2.7/site-packages
Plugin Path: /usr/people/user/.local/lib/scribes/GenericPlugins
Data Path: /usr/people/user/.local/share/scribes
Executable Path: /usr/user/neutvd/.local/bin
========================================================

Revision history for this message
Mystilleef (mystilleef) wrote :

Thanks for the info guys. Please test again in build 1010.

Revision history for this message
OpEx (opex) wrote :

Still present in 0.4-dev-build1014 on my live system and the clean virtual machine I created.

========================================================
System Info: ('Linux', 'computer', '2.6.38-11-generic', '#48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011', 'x86_64')
Python Version: 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_functools', '_hashlib', '_locale', '_random', '_socket', '_sre', '_ssl', '_struct', '_symtable', '_warnings', '_weakref', 'array', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'errno', 'exceptions', 'fcntl', 'gc', 'grp', 'imp', 'itertools', 'marshal', 'math', 'operator', 'posix', 'pwd', 'select', 'signal', 'spwd', 'strop', 'sys', 'syslog', 'thread', 'time', 'unicodedata', 'xxsubtype', 'zipimport', 'zlib')
========================================================
Scribes Version: 0.4-dev-build1014
Dbus Version: (0, 83, 1)
GTK+ Version: (2, 24, 4)
PyGTK Version: (2, 22, 0)
Psyco Not Installed
========================================================
Running Instance: 0
========================================================
Python Path: /usr/lib/python2.7/dist-packages
Plugin Path: /usr/lib/scribes/GenericPlugins
Data Path: /usr/share/scribes
Executable Path: /usr/bin
========================================================

Revision history for this message
Mathieu Géhin (mathieu-gehin) wrote :

I can confirm the problem with 0.4-dev-build1010.
I'm using with local files, on 32bit Ubuntu 10.10

Problem seems to be that scribes detects its own auto-saved modifications to the file, then reloads the file.

Additionaly it would be wise if any automatic reload could be added to the undo stack as an undoable action.
Can I add this as a feature request?

Revision history for this message
Mystilleef (mystilleef) wrote :

Do you guys get any errors in the terminal when this happens?

Revision history for this message
Ian van der Neut (ivdneut) wrote :

I can confirm the issue is still present in build 1014.

Revision history for this message
Ian van der Neut (ivdneut) wrote :

And no, no errors in the terminal in my case.

Revision history for this message
Mathieu Géhin (mathieu-gehin) wrote :

No errors in the terminal.

Revision history for this message
Mystilleef (mystilleef) wrote :

I still can't reproduce this problem but I'm going to
disable file change monitoring in the next update.

I suspect the bug is an odd timing issue with GIO. GIO has
an API that notifies Scribes when a file has changed. On
your computers it seems GIO is notify Scribes too late after
the change has happened thus causing the reload problem.

Since I can't reproduce the problem on any of my computers
it's hard to debug it.

Revision history for this message
Mathieu Géhin (mathieu-gehin) wrote :

The timing issue makes sense.
After a file is saved, in my case, there is usually a few seconds before the 'Loaded file' message shows up.

BTW, the problem from my perspective is all about undo history being lost.
It doesn't bother me at all that the file has to be reloaded under the hood IF the history is not lost.

Revision history for this message
Mystilleef (mystilleef) wrote :

Mathieu,

Yes, I'll look into disabling undo during a reload.

Undo is broken in my opinion. Scribes needs an integrated revision control system (I'm looking into integrating bzr) which I was supposed to design along with the automatic saving system years ago but got I side tracked. I need to evaulate the possibility of doing that now that bzr is stable.

Revision history for this message
Ian van der Neut (ivdneut) wrote :

For me the problem is that the cursor is moved back to the top of the document when it is reloaded. No file change monitoring means I can't use scribes at this point :/

Revision history for this message
Mystilleef (mystilleef) wrote :

Folks,

Google reveals inotify processes notifications after 1000ms,
possibly a bug. I've adjusted Scribes in light of this.

Please test build 1012.

Revision history for this message
OpEx (opex) wrote :

I don't know about 1012. But 0.4-dev-build1020 seems to have the desired effect. My document is no longer reloading itself.

========================================================
System Info: ('Linux', 'ubuntu', '2.6.35-30-generic', '#59-Ubuntu SMP Tue Aug 30 15:58:00 UTC 2011', 'i686')
Python Version: 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5]
System Byteorder: little
Python Modules: ('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_functools', '_hashlib', '_locale', '_random', '_socket', '_sre', '_ssl', '_struct', '_symtable', '_warnings', '_weakref', 'array', 'binascii', 'cPickle', 'cStringIO', 'errno', 'exceptions', 'fcntl', 'gc', 'grp', 'imp', 'itertools', 'marshal', 'math', 'operator', 'posix', 'pwd', 'select', 'signal', 'spwd', 'strop', 'sys', 'syslog', 'thread', 'time', 'unicodedata', 'xxsubtype', 'zipimport', 'zlib')
========================================================
Scribes Version: 0.4-dev-build1020
Dbus Version: (0, 83, 0)
GTK+ Version: (2, 22, 0)
PyGTK Version: (2, 21, 0)
Psyco Not Installed
========================================================
Running Instance: 1
========================================================
Python Path: /usr/lib/python2.6/dist-packages
Plugin Path: /usr/lib/scribes/GenericPlugins
Data Path: /usr/share/scribes
Executable Path: /usr/bin
========================================================

Revision history for this message
Ian van der Neut (ivdneut) wrote :

I can confirm that build 1020 does not display the reloading behaviour. File change monitoring also seems to be working correctly. I can now do "hg qpush" and "hg qpop" and see the files change in scribes.

Revision history for this message
Mystilleef (mystilleef) wrote :

Thanks for testing guys. I'm leaving this bug report open for another week. I meant to say build 1020 not build 1012 above.

Revision history for this message
Mathieu Géhin (mathieu-gehin) wrote :

Build 1020 fixes the problem indeed.
Thanks.

Revision history for this message
Matěj Cepl (mcepl) wrote :

@Mystileef concerning #23 .... please don't hard-code bzr into scribes. There are many people who use something else than bzr (I would actually say most, but let's not start flamewar about it). I prefer git, others (see #28) Mercurial. If you would make it pluggable with reasonably simple and reasonably documented interface, I am willing to donate git plugin.

Revision history for this message
Matěj Cepl (mcepl) wrote :

Also, I am not sure supporting VCS is a replacement to Undo working over saves.

Revision history for this message
Mystilleef (mystilleef) wrote :

Matej,

The version control system I use is irrelevant since it's
purely an implementation detail. Nobody knows what VCS Google
uses for Google Docs and nobody cares. Nobody needs to know
what VCS Scribes uses either.

The goal is to have Scribes automatically version all
documents after every save operation. Users should be able to
revert a document to any state in its history. See Google
Docs for implementation behavior.

I like Bzr because it's written in Python, it's extensible
and it has one of the cleanest APIs I've seen for integration
in applications.

Again what VCS I choose to use doesn't matter since users
will not be exposed to the VCS.

By the way this feature has no relation to undo. Undo will
work as is.

Revision history for this message
Mystilleef (mystilleef) wrote :

Matej,

I agree that the VCS to use should be plugable. So if
users want to use a different backend other than BZR it
should be possible. The default backend will likely be BZR.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.