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

[Git][lintian/lintian][bts_1110969] use try-catch again instead of eval, not to fail silently



Title: GitLab

Louis-Philippe Véronneau pushed to branch bts_1110969 at lintian / lintian

Commits:

  • 11e3c632
    by Louis-Philippe Véronneau at 2025-09-03T00:16:11-04:00
    use try-catch again instead of eval, not to fail silently
    

1 changed file:

Changes:

  • lib/Lintian/Check/Fonts/Postscript/Type1.pm
    ... ... @@ -50,6 +50,7 @@ sub visit_installed_files {
    50 50
     
    
    51 51
         my @command = ('t1disasm', $item->unpacked_path);
    
    52 52
         my $bytes = safe_qx(@command);
    
    53
    +    my $enc_warning = 'In file ' . $item->name . $COLON . $SPACE;
    
    53 54
     
    
    54 55
         my $output;
    
    55 56
         try {
    
    ... ... @@ -58,12 +59,14 @@ sub visit_installed_files {
    58 59
     
    
    59 60
         } catch ($e) {
    
    60 61
             if ($e =~ m{^cp1252 "\\x81" does not map to Unicode at .+}) {
    
    61
    -            eval {
    
    62
    +            try {
    
    62 63
                     # sometimes, the file is utf8
    
    63 64
                     $output = decode('utf8', $bytes, Encode::FB_CROAK);
    
    65
    +            } catch {
    
    66
    +                die $enc_warning . $@;
    
    64 67
                 }
    
    65 68
             } else {
    
    66
    -            die 'In file ' . $item->name . $COLON . $SPACE . $@;
    
    69
    +            die $enc_warning . $@;
    
    67 70
             }
    
    68 71
         }
    
    69 72
     
    


  • Reply to: