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

Bug#105750: dpkg-source: touch all patched files to avoid race conditions



reopen 105750
retitle 105750 dpkg-source: include timestamps in diff
tags 105750 patch
thanks

dpkg-source uses `diff -L' to set correct filenames in unified diff
headers.  However, this option sets the whole header line, not just
the filename, and timestamps must be included explicitly:

--- dpkg-source.orig
+++ dpkg-source
@@ -390,12 +390,16 @@
                     &syserr("cannot read orig link $origdir/$fn");
                 $n eq $n2 || &unrepdiff2("symlink to $n2","symlink to $n");
             } elsif (-f _) {
+                my $mtime= (stat _)[9];
+                my $omtime;
                 $type{$fn}= 'plain file';
                 if (!lstat("$origdir/$fn")) {
                     $! == ENOENT || &syserr("cannot stat orig file $origdir/$fn");
                     $ofnread= '/dev/null';
+                    $omtime= 0; # this is what diff -N does
                 } elsif (-f _) {
                     $ofnread= "$origdir/$fn";
+                    $omtime= (stat _)[9];
                 } else {
                     &unrepdiff2("something else","plain file");
                     next;
@@ -404,10 +408,9 @@
                 if (!$c3) {
 		    $ENV{'LC_ALL'}= 'C';
 		    $ENV{'LANG'}= 'C';
-		    $ENV{'TZ'}= 'UTC0';
                     exec('diff','-u',
-                         '-L',"$basedirname.orig/$fn",
-                         '-L',"$basedirname/$fn",
+                         '-L',"$basedirname.orig/$fn\t".gmtime($omtime),
+                         '-L',"$basedirname/$fn\t".gmtime($mtime),
                          '--',"$ofnread","$dir/$fn"); &syserr("exec diff");
                 }
                 $difflinefound= 0;

Thanks,

Matej


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: