[PATCH] Make dbus-uuidgen atomic

Colin Walters walters at verbum.org
Fri Sep 3 11:37:08 PDT 2010


On Fri, Sep 3, 2010 at 1:24 PM, Ray Strode <halfline at gmail.com> wrote:
>
> I've come across bugs on a several occasions before where admins set
> their umasks to be very restrictive and files ended up not being
> readable when they should be.

Hmm, yes, I guess sadly the legacy Unix init systems allow inheriting
random crap (umask, environment variables) from administrator login
shells into daemon environments, so we need to work around this.

> Well, dbus-uuidgen --ensure is already doing a lot of checks on the
> machine-id file.  It actually loads the file (if it already exists)
> and makes sure its the right format.  If the file isn't the right
> format it sets an error.  If it's going to go to the trouble to make
> sure the file is the right format, why shouldn't it also make sure the
> file is right permissions.

I can't think of a real world scenario where this would happen,
though.  If it's filesystem corruption, we're screwed anyways.  If
it's a stray administrator chmod -R -h, we're screwed anyways.  etc.
Honestly I'd rather spend time here fixing Fedora so that we install a
UUID file along with the OS, and just symlink the dbus one to it.

I went ahead and pushed a patch which adds the fchmod().  Thanks a lot
for the review!


More information about the dbus mailing list