Enrico Forestieri wrote:
On Wed, Aug 29, 2007 at 12:02:24PM -0400, Bennett Helm wrote:
Start with an existing file and open in in LyX. Modify it (in LyX),
and save it. The dialog pops up indicating that the file has been
externally modified, asking whether you want to save anyway.
Subsequent attempts to save the file work fine; it's only the first
one that provide the false warning, and it does so every time.
I'm guessing the problem is that Macs save information not only about
creation and modification dates for files, but *also* for last opened
date. So when you open a file, Mac OS then makes a change to the file
(updating the last opened date), which LyX detects as an external
modification. I don't know how to confirm this guess, however.
This is not a Mac problem, it is a genuine bug occurring when loading
a .lyx file having a previous format. The checksum and timestamp of the
converted (rather than original) file were being saved.
The attached patch solves the issue.
Yes, I saw this on Linux, too. Comment below.
rh
------------------------------------------------------------------------
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp (revisione 19907)
+++ src/Buffer.cpp (copia locale)
@@ -704,6 +704,12 @@
int const file_format = convert<int>(tmp_format);
//lyxerr << "format: " << file_format << endl;
+ // save the timestamp and checksum of disk file
+ if (!pimpl_->checksum_) {
I take it that the point of the preceding line is that we may go back
through this again, when read(tmpfile) is called later, and then we
don't want to reset the timestamp, etc. If so, a comment would help.
+ pimpl_->timestamp_ =
fs::last_write_time(filename.toFilesystemEncoding());
+ pimpl_->checksum_ = sum(filename);
+ }
+
if (file_format != LYX_FORMAT) {
if (fromstring)
@@ -770,9 +776,6 @@
//MacroTable::localMacros().clear();
pimpl_->file_fully_loaded = true;
- // save the timestamp and checksum of disk file
- pimpl_->timestamp_ =
fs::last_write_time(filename.toFilesystemEncoding());
- pimpl_->checksum_ = sum(filename);
return success;
}
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto