The cache cleaning logic requires atime to be correct (strictatime or
relatime) but some users on Linux only have noatime.
Attempt to update the atime manually so that the cache works properly.
Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+
+ * debuginfod-client.c (update_atime): New function.
+ (extract_section, debuginfod_query_server): Call it.
+
2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* debuginfod-client.c (debuginfod_query_server): Don't modify
dest[q] = '\0';
}
+/* Attempt to update the atime */
+static void
+update_atime (int fd)
+{
+ struct timespec tvs[2];
+
+ tvs[0].tv_sec = tvs[1].tv_sec = 0;
+ tvs[0].tv_nsec = UTIME_NOW;
+ tvs[1].tv_nsec = UTIME_OMIT;
+
+ (void) futimens (fd, tvs); /* best effort */
+}
+
/* Attempt to read an ELF/DWARF section with name SECTION from FD and write
it to a separate file in the debuginfod cache. If successful the absolute
path of the separate file containing SECTION will be stored in USR_PATH.
*usr_path = sec_path;
else
free (sec_path);
+ update_atime(fd);
rc = sec_fd;
goto out2;
}
}
}
/* Success!!!! */
+ update_atime(fd);
rc = fd;
goto out;
}