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.

-- 
Enrico
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_) {
+               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;
 }
 

Reply via email to