]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Status.pm
output to transcript even in cases of internal requests
[debbugs.git] / Debbugs / Status.pm
index e70643fbe6244f86c799b9149e4fc44e51a653bf..d44d0bdea277da4add795748ab9c200cabafc3b1 100644 (file)
@@ -45,6 +45,7 @@ use Debbugs::Versions;
 use Debbugs::Versions::Dpkg;
 use POSIX qw(ceil);
 use File::Copy qw(copy);
+use Encode qw(decode encode);
 
 use Storable qw(dclone);
 use List::Util qw(min max);
@@ -239,6 +240,9 @@ sub read_bug{
 
     my %namemap = reverse %fields;
     for my $line (@lines) {
+       eval {
+           $line = decode("utf8",$line,Encode::FB_CROAK);
+       };
         if ($line =~ /(\S+?): (.*)/) {
             my ($name, $value) = (lc $1, $2);
            # this is a bit of a hack; we should never, ever have \r
@@ -547,12 +551,8 @@ sub new_bug {
     close $nn_fh;
     overwritefile("nextnumber",
                  ($nn+1)."\n");
+    unfilelock();
     my $nn_hash = get_hashname($nn);
-    use IO::File;
-    my $t_fh = IO::File->new("/home/don/temp.txt",'a') or die "Unable to open ~don/temp.txt for writing: $!";
-    use Data::Dumper;
-    print {$t_fh} Dumper({%param,nn => $nn, nn_hash => $nn_hash, nextnumber => qx(cat nextnumber)});
-    close $t_fh;
     if ($param{copy}) {
        my $c_hash = get_hashname($param{copy});
        for my $file (qw(log status summary report)) {
@@ -640,11 +640,14 @@ sub makestatus {
                 # Output field names in proper case, e.g. 'Merged-With'.
                 my $properfield = $fields{$field};
                 $properfield =~ s/(?:^|(?<=-))([a-z])/\u$1/g;
-                $contents .= "$properfield: $newdata{$field}\n";
+               my $data = $newdata{$field};
+                $contents .= "$properfield: $data\n";
             }
         }
     }
-
+    eval {
+       $contents = encode("utf8",$contents,Encode::FB_CROAK);
+    };
     return $contents;
 }