detect backup file timewarps
authorTony Finch <dot@dotat.at>
Tue, 18 Nov 2014 21:30:49 +0000 (21:30 +0000)
committerTony Finch <dot@dotat.at>
Tue, 18 Nov 2014 21:30:49 +0000 (21:30 +0000)
sccscheck

index 127bb3c..7b433ec 100755 (executable)
--- a/sccscheck
+++ b/sccscheck
@@ -78,10 +78,16 @@ sub found {
                                my $qback = quotemeta $_;
                                my $qfile = quotemeta "$1/$2";
                                system "diff -u $qback $qfile >/dev/null";
-                               if ($?) {
-                                       print "BACKDIFF $_\n"
-                               } else {
+                               if (not $?) {
                                        print "BACKSAME $_\n"
+                               } else {
+                                       my $backtime = (stat $_)[9];
+                                       my $filetime = (stat "$1/$2")[9];
+                                       if ($backtime < $filetime) {
+                                               print "BACKDIFF $_\n";
+                                       } else {
+                                               print "BACKTIMEWARP $_\n";
+                                       }
                                }
                        }
                        print "BACKLESS $_\n";