chiark / gitweb /
dgit-repos-policy-debian: Fix add_taint
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 May 2015 07:57:52 +0000 (08:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:11 +0000 (11:54 +0100)
infra/dgit-repos-policy-debian

index ac427127464f4c932baa460a9e8ad170626d552f..b25a560109f96b719b1f3b951da1589edcda6706 100755 (executable)
@@ -150,21 +150,28 @@ sub getpackage () {
 }
 
 sub add_taint ($$) {
-    my ($refobj, $reason);
+    my ($refobj, $reason) = @_;
+
+    printdebug "TAINTING $refobj\n",
+        (map { "\%| $_" } split "\n", $reason),
+        "\n";
 
     my $tf = new File::Temp or die $!;
     print $tf "$refobj^0\n" or die $!;
+    flush $tf or die $!;
+    seek $tf,0,0 or die $!;
 
     my $gcfpid = open GCF, "-|";
     defined $gcfpid or die $!;
     if (!$gcfpid) {
        open STDIN, "<&", $tf or die $!;
-       exec 'git', 'cat-file';
+       exec 'git', 'cat-file', '--batch';
        die $!;
     }
 
     close $tf or die $!;
     $_ = <GCF>;
+    defined $_ or die;
     m/^(\w+) (\w+) (\d+)\n/ or die "$_ ?";
     my $gitobjid = $1;
     my $gitobjtype = $2;
@@ -178,7 +185,7 @@ sub add_taint ($$) {
     close GCF;
 
     $poldbh->do("INSERT INTO taints".
-               " (package, gitobjid, gitobjtype, gitobjdata, time, comment)",
+               " (package, gitobjid, gitobjtype, gitobjdata, time, comment)".
                " VALUES (?,?,?,?,?,?)", {},
                $pkg, $gitobjid, $gitobjtype, $gitobjdata, time, $reason);
 
@@ -186,7 +193,7 @@ sub add_taint ($$) {
     die unless defined $taint_id;
 
     $poldbh->do("INSERT INTO taintoverrides".
-               " (taint_id, deliberately)",
+               " (taint_id, deliberately)".
                " VALUES (?, 'include-questionable-history')", {},
                $taint_id);
 }