Issue 126757 - Warning on file save when modification time changed
Summary: Warning on file save when modification time changed
Status: UNCONFIRMED
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: 4.1.2
Hardware: All All
: P5 (lowest) Normal with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-28 09:01 UTC by david.vogt
Modified: 2015-12-30 15:53 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
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 (soffice.sh) with an environment variable.
Something like:
SAL_CHECKSUM_ENABLE=true; export SAL_CHECKSUM_ENABLE