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 680326 - thumbnailer should not modify atime of file
thumbnailer should not modify atime of file
Status: RESOLVED FIXED
Product: gnome-desktop
Classification: Core
Component: libgnome-desktop
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Desktop Maintainers
Desktop Maintainers
Depends on:
Blocks: 145255
 
 
Reported: 2012-07-20 16:16 UTC by William Jon McCann
Modified: 2013-06-07 20:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Try not to modify atime on files while thumbnailing (5.78 KB, patch)
2012-07-20 18:17 UTC, William Jon McCann
none Details | Review
Try not to modify atime on files while thumbnailing (6.51 KB, patch)
2012-07-20 19:13 UTC, William Jon McCann
reviewed Details | Review
use gs_file_read_noatime from libgsystem (2.57 KB, patch)
2012-08-10 21:29 UTC, Colin Walters
committed Details | Review

Description William Jon McCann 2012-07-20 16:16:33 UTC
The thumbnailer should not modify the atime of file.

        input_stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));

g_local_file_read doesn't set O_NOATIME. I guess we should open the file ourselves and pass the fd.
Comment 1 William Jon McCann 2012-07-20 18:17:05 UTC
Created attachment 219343 [details] [review]
Try not to modify atime on files while thumbnailing
Comment 2 Cosimo Cecchi 2012-07-20 19:03:08 UTC
Where is _open_fd() defined? Did you have it in another previous patch maybe?
Comment 3 William Jon McCann 2012-07-20 19:13:27 UTC
Created attachment 219346 [details] [review]
Try not to modify atime on files while thumbnailing
Comment 4 Ray Strode [halfline] 2012-08-10 19:35:56 UTC
Review of attachment 219346 [details] [review]:

Is this really necessary?  We won't update the atime on these files in linux anyway, since relatime is the default mount option, and you only do it in the linux codepath.

::: libgnome-desktop/gnome-desktop-thumbnail.c
@@ +27,3 @@
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif

this should go in configure.ac as 

AC_USE_SYSTEM_EXTENSIONS

@@ +314,3 @@
+  g_return_val_if_fail (path != NULL, -1);
+
+#if defined(__linux__)

I think i'd rather HAVE_ONOATIME than __linux__

@@ +316,3 @@
+#if defined(__linux__)
+  fd = g_open (path, O_RDONLY | O_NOATIME, 0);
+  if (fd == -1 && errno == EPERM)

this should have a comment saying "O_NOATIME isn't allowed if we don't own the file"
Comment 5 Colin Walters 2012-08-10 21:29:16 UTC
Created attachment 220914 [details] [review]
use gs_file_read_noatime from libgsystem
Comment 6 Ray Strode [halfline] 2012-08-15 14:19:42 UTC
Review of attachment 220914 [details] [review]:

::: autogen.sh
@@ +31,3 @@
+if test ! -f libgnome-desktop/libgsystem/README; then
+  echo "+ Setting up submodules"
+  git submodule init

isn't git subtree en vogue now?  No idea which one is better, just heard people talking about subtree recently.

::: libgnome-desktop/Makefile.am
@@ +19,3 @@
+libgsystem_srcpath := libgsystem
+libgsystem_cflags = $(GNOME_DESKTOP_CFLAGS)
+libgsystem_libs = $(GNOME_DESKTOP_LIBS)

Why does it need the cflags/libs of the parent ?

::: libgnome-desktop/gnome-desktop-thumbnail.c
@@ +347,2 @@
     if (input_stream == NULL) {
+        input_stream = gs_file_read_noatime (file, NULL, NULL);

cool, that's easy.
Comment 7 Colin Walters 2012-08-15 14:47:05 UTC
(In reply to comment #6)
> Review of attachment 220914 [details] [review]:
> 
> ::: autogen.sh
> @@ +31,3 @@
> +if test ! -f libgnome-desktop/libgsystem/README; then
> +  echo "+ Setting up submodules"
> +  git submodule init
> 
> isn't git subtree en vogue now?  No idea which one is better, just heard people
> talking about subtree recently.

I'd never heard of it until now, but:
https://github.com/apenwarr/git-subtree/blob/master/THIS-REPO-IS-OBSOLETE

Basically only in newer git versions, and only if you have some "contrib" thing enabled.

> ::: libgnome-desktop/Makefile.am
> @@ +19,3 @@
> +libgsystem_srcpath := libgsystem
> +libgsystem_cflags = $(GNOME_DESKTOP_CFLAGS)
> +libgsystem_libs = $(GNOME_DESKTOP_LIBS)
> 
> Why does it need the cflags/libs of the parent ?

For Gio basically.  It doesn't hurt really to over-link it since it just ends up as part of the same .so anyways.