[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Use maximum of modification and change time for detecting old files



When uploading using scp, the mtime might be set to the time from the
uploader's host.  Especially for the upstream tarballs this might result
in a mtime a long time in the past and queued might remove the uploaded
files right away as stray files.

Note that this removal only happens when the file is not processed: for
example when the upstream tarball gets uploaded (with an old mtime) and
queued processes uploads and removes stray files before the .changes for
the upload including the "old" tarball arrives.
---
 tools/debianqueued-0.9/debianqueued | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/debianqueued-0.9/debianqueued b/tools/debianqueued-0.9/debianqueued
index 7b02551..7a6c18c 100755
--- a/tools/debianqueued-0.9/debianqueued
+++ b/tools/debianqueued-0.9/debianqueued
@@ -16,6 +16,7 @@
 require 5.002;
 no lib '.';
 use strict;
+use List::Util;
 use POSIX;
 use POSIX qw( strftime sys_stat_h sys_wait_h signal_h );
 use Net::Ping;
@@ -557,7 +558,8 @@ sub check_dir() {
       # yet-incomplete upload, with the .changes still missing.
       # Cannot send any notification, since owner unknown.
       next if !( @stats = stat($file) );
-      my $age = time - $stats[ST_MTIME];
+      my $cmtime = List::Util::max($stats[ST_CTIME], $stats[ST_MTIME]);
+      my $age = time - $cmtime;
       my ( $maint, $pattern, @job_files );
       if (    $file =~ /^junk-for-writable-test/
            || $file !~ m,$conf::valid_files,
-- 
2.1.4


Reply to: