[Bug debuginfod/25739] client cache sometimes has incorrect mtimes for downloaded files
fche at redhat dot com
sourceware-bugzilla@sourceware.org
Sat Mar 28 20:05:32 GMT 2020
https://sourceware.org/bugzilla/show_bug.cgi?id=25739
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fche at redhat dot com
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
pushing this fix as obvious (in retrospect!)
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 74eb44372099..9f08a683ff15 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1362,6 +1362,13 @@ handle_buildid_r_match (int64_t b_mtime,
throw archive_exception(a, "cannot extract file");
}
+ // Set the mtime so the fdcache file mtimes, even prefetched ones,
+ // propagate to future webapi clients.
+ struct timeval tvs[2];
+ tvs[0].tv_sec = tvs[1].tv_sec = archive_entry_mtime(e);
+ tvs[0].tv_usec = tvs[1].tv_usec = 0;
+ (void) futimes (fd, tvs); /* best effort */
+
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index bba04c1fe20a..7faad3317ddc 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -284,22 +284,27 @@ archive_test() {
buildid=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
-a $filename | grep 'Build ID' | cut -d ' ' -f 7`
test $__BUILDID = $buildid
+ # check that timestamps are plausible - older than the near-present
(tmpdir mtime)
+ test $filename -ot `pwd`
# run again to assure that fdcache is being enjoyed
filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find
executable $__BUILDID`
buildid=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
-a $filename | grep 'Build ID' | cut -d ' ' -f 7`
test $__BUILDID = $buildid
+ test $filename -ot `pwd`
filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo
$__BUILDID`
buildid=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
-a $filename | grep 'Build ID' | cut -d ' ' -f 7`
test $__BUILDID = $buildid
+ test $filename -ot `pwd`
if test "x$__SOURCEPATH" != "x"; then
filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find
source $__BUILDID $__SOURCEPATH`
hash=`cat $filename | sha1sum | awk '{print $1}'`
test $__SOURCESHA1 = $hash
+ test $filename -ot `pwd`
fi
}
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Elfutils-devel
mailing list