* W. Trevor King <[email protected]> [140924 11:20]: > On Tue, Sep 09, 2014 at 11:06:26AM -0400, Joey Hess wrote: > > Each time it is used to update list of feeds, r2e rewrites > > rss2email.cfg, and neglects to preserve its file permissions when > > doing so. > > Hmm. It's possible we can use shutil.copy2 to seed the new versions > [1]. The approach would be: > > * copy2 to create the new file, preserving as much metadata as > possible > * truncate the new file > * fill it in with the new data > * move it over the original file > > I'm also open to other approaches that still address atomic writes > [2,3].
Hi, I think that you can just add a call to shutil.copystat (that's what copy2 uses) between creating the tempfile and the call to rename. As an aside, I'm surprised that *every* Python application has to handle all of this itself. There's probably room for a (small) library here. -- Etienne Millon -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

