When running debuginfod-find repeatedly against some files, it seems that if you rm a file from the cache, it spoils the mtime of all future files being downloaded (so that it results in the current time instead). As a result my gdb-git complains "warning: Source file is more recent than executable." After some IRC debugging, fche suggested trying to run the server using --fdcache-fds=0 which solved the issue. 12:54 PM <@fche> we just neglect to save the timestamps of fdcache'd files extracted from archives 12:54 PM <@fche> ok 12:54 PM <@fche> betcha if you run debuginfod with --fdcache-fds=0 12:54 PM <@fche> and even --fdcache-prefetch=0 12:54 PM <@fche> things will work
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 }