LWN.net Logo

I don't use GNOME, but...

I don't use GNOME, but...

Posted Jan 31, 2010 0:37 UTC (Sun) by cortana (subscriber, #24596)
In reply to: I don't use GNOME, but... by cmccabe
Parent article: Stormy Peters: What should the GNOME Foundation accomplish in 2010?

> Atomicity is a solved problem. Just create the new config file as a separate file, then use rename() to get either the old or new file. Every filesystem that I know of has this semantic with rename (yes, I know it's not strictly in POSIX.) Every major UNIX text editor (vi, emacs, etc.) uses the rename() trick by default.

Doesn't that blow away the file ownership, permissions, ACL and extended attribute information?


(Log in to post comments)

I don't use GNOME, but...

Posted Jan 31, 2010 9:35 UTC (Sun) by anselm (subscriber, #2796) [Link]

In the general case, yes. In the case of config files this is rarely an issue -- if you can do »rename()« on the original file (write to the parent directory, really), you're usually in a position to set up the permissions etc. of the new file to match the old, and it's not as if there are lots of obvious choices for these, anyway.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds