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 568593 - saving a file does not respect umask - wrong permissions
saving a file does not respect umask - wrong permissions
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
2.24.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-21 20:34 UTC by Michael Chudobiak
Modified: 2009-01-22 20:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use default permissions when saving a file (480 bytes, patch)
2009-01-22 18:00 UTC, Michael Chudobiak
none Details | Review
corrected patch (477 bytes, patch)
2009-01-22 19:24 UTC, Michael Chudobiak
committed Details | Review

Description Michael Chudobiak 2009-01-21 20:34:46 UTC
evince always saves files with "600" permissions, disregarding both the original file permissions and the user's umask.

It should save files respecting the umask (and disregarding original permissions), since it is a new file. Otherwise, it wreaks havoc in an office filesharing environment. You can't share files with your group (or the gid group), even if your umask is set appropriately, without manually using chmod. Which sucks.

Tested in 2.24.2.

- Mike
Comment 1 Michael Chudobiak 2009-01-21 21:01:24 UTC
Also confirmed in 2.25.5.

- Mike
Comment 2 Michael Chudobiak 2009-01-21 21:05:15 UTC
Maybe G_FILE_COPY_TARGET_DEFAULT_PERMS should be set for file copies. I see that is only listed for "unstable" gio:

http://library.gnome.org/devel/gio/unstable/GFile.html#GFileCopyFlags

- Mike
Comment 3 Michael Chudobiak 2009-01-22 18:00:37 UTC
Created attachment 127014 [details] [review]
Use default permissions when saving a file

This patch uses the G_FILE_COPY_TARGET_DEFAULT_PERMS (new in glib 2.19.0) so that copied/saved files are created with the default permissions (respecting the user's umask, and the setgid bit on the directory, if set).

Please review, I can commit if OK.

- Mike
Comment 4 Michael Chudobiak 2009-01-22 19:24:10 UTC
Created attachment 127027 [details] [review]
corrected patch

changes #ifdef to #if. Oops.
Comment 5 Nickolay V. Shmyrev 2009-01-22 20:36:13 UTC
Please commit
Comment 6 Michael Chudobiak 2009-01-22 20:48:38 UTC
Thanks! Committed.

- Mike