<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - FILESAVE: Saving a document creates a new file (new inode number) thereby messing-up with the creation time of the document"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=125401#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - FILESAVE: Saving a document creates a new file (new inode number) thereby messing-up with the creation time of the document"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=125401">bug 125401</a>
              from <span class="vcard"><a class="email" href="mailto:alex.dwd@gmail.com" title="Alex <alex.dwd@gmail.com>"> <span class="fn">Alex</span></a>
</span></b>
        <pre>Some additional thoughts.

Reading about the g_file_set_contents() function[1] it points to the fact that
changing the inode number also breaks existing hard links to the original file
(wow!).

I don't know how it is done exactly at the code level, but to solve both the
'creation time' (crtime) and 'hard link' issues, here is another suggestion:
why not overwrite the content of the original file with the content of the
temporary file rather than overwriting the file itself?

To avoid the risk of losing any information in case of crash (whether the
original data or the new data), just before the overwriting of the content an
additional temporary copy of the original file could be created. This would
preserve the content of that file in case of crash in the process of writing.

Added to note: mind that ctime (change time) and crtime (creation time) are
different attributes.


[1]
<a href="https://developer.gnome.org/glib/stable/glib-File-Utilities.html#g-file-set-contents">https://developer.gnome.org/glib/stable/glib-File-Utilities.html#g-file-set-contents</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>