Issue 126757

Summary: Warning on file save when modification time changed
Product: General Reporter: david.vogt
Component: uiAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Normal    
Priority: P5 (lowest) CC: olivier.duffey, orcmid
Version: 4.1.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description david.vogt 2015-12-28 09:01:07 UTC
When a document is opened in OpenOffice and an external event (for example "touch mydoc.odt") happens, the next save from OpenOffice leads to the following dialog / message: "The file has been changed since it was opened for editing in OpenOffice. Saving your version of the document will overwrite changes made by others. Do you want to save anyway?"

So, instead of checking the modification time, wouldn't it be a better idea to look at a checksum of the file instead, and only warn if the file *actually* changed?
Comment 1 david.vogt 2015-12-28 09:03:07 UTC
I have a client who would be willing to pay for implementing this change. Therefore, what would be the requirements from you AOO guys to accept such a patch?

Also, is there already some checksumming library / functionality in the code base that could be used for this?
Comment 2 orcmid 2015-12-29 05:59:05 UTC
(In reply to david.vogt from comment #0)
> So, instead of checking the modification time, wouldn't it be a better idea
> to look at a checksum of the file instead, and only warn if the file
> *actually* changed?

That seems to be a rather contrived approach that can still fail in a race situation.  There is nothing in the code base that provides digests of complete files, although there are certainly utilities that could be borrowed from for that purpose.  (Both encryption and digital signatures are done "by parts" for components carried in Zip files and not on total files.  The digest-computation libraries used could probably be reused over complete files.)

It would probably be better if actual file-system-level locking against alteration were employed when a file was opened for alteration or replacement.  That might be non-trivial because of the way OpenOffice handles file locking, renaming of created files, etc., but it would certainly be better under typical conditions.  

One could also argue that changing metadata (i.e., what touching the file does at the directory-entry level) qualifies as a change, even though a peculiar one.  

Is there a particular platform on which this situation is such an annoyance for the client and actually occurs?

For accepting patches to accomplish this, there are standard conditions for contributions of code to Apache Projects.  For something so impactful, it would be good to have advance agreement at the design level and review of the ramifications.  It might be that the project would find the introduction of digest computations to be unacceptable.
Comment 3 dyo 2015-12-30 15:53:29 UTC
I suggest that this could be an option that is not active by default.
The option could be activated in the startup script of OpenOffice ( with an environment variable.
Something like: