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 653065 - On edit/rotation of image, group permissions eliminated/ changed to "none"
On edit/rotation of image, group permissions eliminated/ changed to "none"
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
2.32.x
Other Linux
: Normal major
: GNOME3.2
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-21 01:38 UTC by DT
Modified: 2011-10-30 16:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix bug #653065 (3.27 KB, patch)
2011-10-16 12:23 UTC, Javier Sánchez Ochando
needs-work Details | Review
Revised patch to fix bug #653065 (3.74 KB, patch)
2011-10-21 17:39 UTC, Javier Sánchez Ochando
none Details | Review
Revised patch to fix bug #653065 (5.06 KB, patch)
2011-10-21 22:17 UTC, Javier Sánchez Ochando
none Details | Review

Description DT 2011-06-21 01:38:31 UTC
Background:  Running Ubuntu 11.04.  Use Eye of Gnome 2.32.1 to rotate home photos downloaded to multi-user/network directory on Ubuntu machine.  For example, when a photo is sideways, I use eye of gnome to rotate it 90 degrees to be straight up and down.

Problem:  Eye of Gnome eliminates the "group" permission every time I save a picture, which means that other members of my private "group" cannot view the pictures remotely.  Pre-edit the permissions are -rw-rw----.  Post-edit the permissions are rw-------.

FWIW, GIMP 2.6.11 also changes permissions, although it adds them to the "others" category (instead of deleting them from the "group" category), so when I edit with GIMP the result is -rw-rw-r--.

I would like EOG to preserve the pre-existing group permissions.  I don't see any FAQs or documentation about this issue, so I assume it is not an intentional part of the function of the program.
Comment 1 Felix Riemann 2011-06-24 13:29:35 UTC
Hmm, yeah we should possibly try to use g_file_replace for saving. From the description it does what we do by hand now (save to temp file and replace target file) and also watches out for the owners and permissions.
Comment 2 Javier Sánchez Ochando 2011-10-16 12:23:18 UTC
Created attachment 199115 [details] [review]
Patch to fix bug #653065

This is my proposal to fix this bug. This patch store UID, GID, and MODE attributes of the target file and try to restore into the temp file before replace it.

I choose this option because g_file_replace returns a stream for overwriting the file, but we don't use streams to save.
Comment 3 Felix Riemann 2011-10-18 15:42:52 UTC
Review of attachment 199115 [details] [review]:

Seems to work good in case of an existing target file (normal Save or overwriting SaveAs). :)
Breaks saving though if the target file doesn't exist (e.g. when making a SaveAs to a new location).

::: src/eog-image.c
@@ +1530,3 @@
+	/* retrieve UID, GID, and MODE of the original file info */
+	file_info = g_file_query_info (file,
+				       "unix::uid,unix::gid,unix::mode",

Why don't you use G_FILE_ATTRIBUTE_UNIX_* here?
Comment 4 Javier Sánchez Ochando 2011-10-21 17:39:46 UTC
Created attachment 199676 [details] [review]
Revised patch to fix bug #653065
Comment 5 Javier Sánchez Ochando 2011-10-21 17:41:16 UTC
(In reply to comment #3)
 
> Seems to work good in case of an existing target file (normal Save or
> overwriting SaveAs). :)
> Breaks saving though if the target file doesn't exist (e.g. when making a
> SaveAs to a new location).

In this new approach I create a new method called tmp_file_restore_unix_attributes that try to restore UID, GID and MODE unix attributes from target file. This method do anything if target file don't exist or its file information is not available.

> ::: src/eog-image.c
> @@ +1530,3 @@
> +    /* retrieve UID, GID, and MODE of the original file info */
> +    file_info = g_file_query_info (file,
> +                       "unix::uid,unix::gid,unix::mode",
> 
> Why don't you use G_FILE_ATTRIBUTE_UNIX_* here?

Well, I think that I could use "unix::*" (G_FILE_ATTRIBUTE_UNIX_* macro isn't defined), but I only need UID, GID and MODE.
Comment 6 Javier Sánchez Ochando 2011-10-21 22:17:53 UTC
Created attachment 199705 [details] [review]
Revised patch to fix bug #653065

New revision of the patch. Remove some code lines from eog_job_save_as_run that it make the same work.

Notice that the bug #320688 could be fixed with the resolution of the #615376 and #653065 bugs.
Comment 7 Felix Riemann 2011-10-30 16:26:14 UTC
(In reply to comment #5)
> > ::: src/eog-image.c
> > @@ +1530,3 @@
> > +    /* retrieve UID, GID, and MODE of the original file info */
> > +    file_info = g_file_query_info (file,
> > +                       "unix::uid,unix::gid,unix::mode",
> > 
> > Why don't you use G_FILE_ATTRIBUTE_UNIX_* here?
> 
> Well, I think that I could use "unix::*" (G_FILE_ATTRIBUTE_UNIX_* macro isn't
> defined), but I only need UID, GID and MODE.

Well, I actually meant why you didn't use G_FILE_ATTRIBUTE_UNIX_UID, G_FILE_ATTRIBUTE_UNIX_GID and G_FILE_ATTRIBUTE_UNIX_MODE. I just didn't want to type them and thus tried to shorten my text using "*". :)

I guess you did it for readability reasons?

(In reply to comment #6)
> Created an attachment (id=199705) [details] [review]
> Revised patch to fix bug #653065
> 
> New revision of the patch. Remove some code lines from eog_job_save_as_run that
> it make the same work.
> 
> Notice that the bug #320688 could be fixed with the resolution of the #615376
> and #653065 bugs.

Actually bug 320688 seems to be fixed by bug 615376 already. But it doesn't matter as I'm about to close this one too now.

There we go:

commit 4626596c2c179bfe35c4212efced15c38d7337d6
Author: Javier Sánchez <>
Date:   Sun Oct 16 13:55:09 2011 +0200

    Fixed Bug 653065 - On edit of image, permissions changed.
    
    - Try to restore file UID, GID, and MODE attributes from original
    image file to temp image file, before replace it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653065

Thanks, Javier! :)

---
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.