]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
various: don't say that the timestamp 'changed' on initial load 19792/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 1 Jun 2021 15:40:51 +0000 (17:40 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Jun 2021 14:23:54 +0000 (16:23 +0200)
I always found this a bit annoying.
With the patch:

$ SYSTEMD_LOG_LEVEL=debug build/udevadm test /sys/class/block/dm-1
...
Loaded timestamp for '/etc/systemd/network'.
Loaded timestamp for '/usr/lib/systemd/network'.
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /etc/systemd/network/10-eth0.link
Created link configuration context.
Loaded timestamp for '/etc/udev/rules.d'.
Loaded timestamp for '/usr/lib/udev/rules.d'.
...

src/basic/path-util.c

index 82f3709042771ec1786f3531f2d5d8349e803bfc..eb547e7467280b7ae05c1eaf73e8180d324aa28e 100644 (file)
@@ -713,7 +713,7 @@ int find_executable_full(const char *name, bool use_path_envvar, char **ret_file
 }
 
 bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) {
-        bool changed = false;
+        bool changed = false, originally_unset;
         const char* const* i;
 
         assert(timestamp);
@@ -721,6 +721,8 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
         if (!paths)
                 return false;
 
+        originally_unset = *timestamp == 0;
+
         STRV_FOREACH(i, paths) {
                 struct stat stats;
                 usec_t u;
@@ -730,11 +732,11 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
 
                 u = timespec_load(&stats.st_mtim);
 
-                /* first check */
+                /* check first */
                 if (*timestamp >= u)
                         continue;
 
-                log_debug("timestamp of '%s' changed", *i);
+                log_debug(originally_unset ? "Loaded timestamp for '%s'." : "Timestamp of '%s' changed.", *i);
 
                 /* update timestamp */
                 if (update) {