Blame SOURCES/0176-update-done-ignore-nanosecond-file-timestamp-compone.patch

17b0f1
From 6503fbef433da29fe1f450e44c8eaca61888bcda Mon Sep 17 00:00:00 2001
17b0f1
From: Lennart Poettering <lennart@poettering.net>
17b0f1
Date: Mon, 27 Apr 2015 17:25:57 +0200
17b0f1
Subject: [PATCH] update-done: ignore nanosecond file timestamp components,
17b0f1
 they are not reliable
17b0f1
17b0f1
https://bugs.freedesktop.org/show_bug.cgi?id=90192
17b0f1
(cherry picked from commit 329c542585cd92cb905990e3bf59eda16fd88cfb)
17b0f1
17b0f1
Cherry-picked from: a38a3e0
17b0f1
Resolves: #1222517
17b0f1
---
17b0f1
 src/update-done/update-done.c | 12 +++++++++---
17b0f1
 1 file changed, 9 insertions(+), 3 deletions(-)
17b0f1
17b0f1
diff --git a/src/update-done/update-done.c b/src/update-done/update-done.c
17b0f1
index 561963e5eb..cb5cd6f4ab 100644
17b0f1
--- a/src/update-done/update-done.c
17b0f1
+++ b/src/update-done/update-done.c
17b0f1
@@ -36,9 +36,15 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
17b0f1
         assert(ts);
17b0f1
 
17b0f1
         if (stat(path, &st) >= 0) {
17b0f1
-                /* Is the timestamp file already newer than the OS? If so, there's nothing to do. */
17b0f1
-                if (st.st_mtim.tv_sec > ts->tv_sec ||
17b0f1
-                    (st.st_mtim.tv_sec == ts->tv_sec && st.st_mtim.tv_nsec >= ts->tv_nsec))
17b0f1
+                /* Is the timestamp file already newer than the OS? If
17b0f1
+                 * so, there's nothing to do. We ignore the nanosecond
17b0f1
+                 * component of the timestamp, since some file systems
17b0f1
+                 * do not support any better accuracy than 1s and we
17b0f1
+                 * have no way to identify the accuracy
17b0f1
+                 * available. Most notably ext4 on small disks (where
17b0f1
+                 * 128 byte inodes are used) does not support better
17b0f1
+                 * accuracy than 1s. */
17b0f1
+                if (st.st_mtim.tv_sec > ts->tv_sec)
17b0f1
                         return 0;
17b0f1
 
17b0f1
                 /* It is older? Then let's update it */