After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 433898 - Set perms on ~/.face and cleanup
Set perms on ~/.face and cleanup
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: [obsolete] about-me
git master
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-27 15:40 UTC by Bastien Nocera
Modified: 2007-04-30 17:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
control-center-trunk-set-face-perms.patch (709 bytes, patch)
2007-04-27 15:40 UTC, Bastien Nocera
reviewed Details | Review
control-center-trunk-set-face-perms-3.patch (1.23 KB, patch)
2007-04-30 14:47 UTC, Bastien Nocera
reviewed Details | Review
control-center-trunk-set-face-perms-4.patch (1.20 KB, patch)
2007-04-30 16:55 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2007-04-27 15:40:15 UTC
Sometimes, the ~/.face set by about-me won't be used by gdm, because gdm is anal about the permissions of the file.

See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=236393#c10 for details

The attached patch cleans up the code a bit (fwrite without retval checking is gross), and sets the permissions on the file after it's been created, whatever the default umask, so that gdm can use it.
Comment 1 Bastien Nocera 2007-04-27 15:40:38 UTC
Created attachment 87151 [details] [review]
control-center-trunk-set-face-perms.patch
Comment 2 Jens Granseuer 2007-04-27 20:09:44 UTC
Shouldn't you check the return codes of the unlink and set_contents calls as well? 

Also, why 755? I would have expected 644. From a quick look at the gdm code, that should work as well.
Comment 3 Bastien Nocera 2007-04-27 21:31:42 UTC
(In reply to comment #2)
> Shouldn't you check the return codes of the unlink and set_contents calls as
> well? 

To do what? We could certainly check for errors, and print a warning on the command-line.

> Also, why 755? I would have expected 644. From a quick look at the gdm code,
> that should work as well.

Agreed. It's just that the default perms for that file was 775 when created, on a default install. 644 is fine by me as well :)

Comment 4 Jens Granseuer 2007-04-28 18:52:35 UTC
> To do what? We could certainly check for errors, and print a warning on the
> command-line.

I admit it probably isn't terribly important, but if e.g. removing the file failed, trying to rewrite it or change its permissions doesn't make a lot of sense.
Comment 5 Bastien Nocera 2007-04-30 14:47:14 UTC
Created attachment 87270 [details] [review]
control-center-trunk-set-face-perms-3.patch

Fix build warnings, and print an untranslated error on the command-line if there's a problem with creating the ~/.face
Comment 6 Jens Granseuer 2007-04-30 16:10:07 UTC
Hm, do we actually need the g_unlink()?

Apart from that, I'll still insist on 644. Otherwise ok.
Comment 7 Bastien Nocera 2007-04-30 16:55:43 UTC
Created attachment 87277 [details] [review]
control-center-trunk-set-face-perms-4.patch

Use 0644 as the mode, don't use g_unlink
Comment 8 Bastien Nocera 2007-04-30 17:13:36 UTC
Fixed in trunk, should I also commit to gnome-2-18?

2007-04-30  Bastien Nocera  <hadess@hadess.net>

        * gnome-about-me.c: (about_me_update_photo): Use g_file_set_contents
        instead of a single fwrite to write the ~/.face image, also set the
        default permission to be 0644, even if the umask is more permissive,
        otherwise GDM won't show the icon in the chooser (Closes: #433898)
Comment 9 Jens Granseuer 2007-04-30 17:35:37 UTC
(In reply to comment #8)
> Fixed in trunk, should I also commit to gnome-2-18?

I'd say it's not serious enough, so unless somebody disagrees...