Louis-Philippe Véronneau pushed to branch master at lintian / lintian
Commits:
-
27aea38c
by Rafael Laboissière at 2025-11-19T22:27:08+00:00
6 changed files:
- debian/control
- lib/Lintian/Index/Ar.pm
- + t/recipes/checks/unpack/not-an-ar-archive/build-spec/fill-values
- + t/recipes/checks/unpack/not-an-ar-archive/build-spec/orig/text-file.a
- + t/recipes/checks/unpack/not-an-ar-archive/eval/desc
- + t/recipes/checks/unpack/not-an-ar-archive/eval/hints
Changes:
| ... | ... | @@ -29,6 +29,7 @@ Build-Depends: |
| 29 | 29 | libconst-fast-perl,
|
| 30 | 30 | libcrypt-dev,
|
| 31 | 31 | libfile-basedir-perl,
|
| 32 | + libfile-libmagic-perl,
|
|
| 32 | 33 | libio-prompt-tiny-perl <!nocheck>,
|
| 33 | 34 | libipc-run3-perl,
|
| 34 | 35 | liblist-someutils-perl <!nocheck>,
|
| ... | ... | @@ -107,6 +108,7 @@ Depends: |
| 107 | 108 | libemail-address-xs-perl,
|
| 108 | 109 | libfile-basedir-perl,
|
| 109 | 110 | libfile-find-rule-perl,
|
| 111 | + libfile-libmagic-perl,
|
|
| 110 | 112 | libfont-ttf-perl,
|
| 111 | 113 | libhtml-html5-entities-perl,
|
| 112 | 114 | libhtml-tokeparser-simple-perl,
|
| ... | ... | @@ -31,6 +31,8 @@ use Lintian::IPC::Run3 qw(safe_qx); |
| 31 | 31 | use Moo::Role;
|
| 32 | 32 | use namespace::clean;
|
| 33 | 33 | |
| 34 | +use File::LibMagic;
|
|
| 35 | + |
|
| 34 | 36 | const my $EMPTY => q{};
|
| 35 | 37 | const my $NEWLINE => qq{\n};
|
| 36 | 38 | |
| ... | ... | @@ -64,9 +66,14 @@ sub add_ar { |
| 64 | 66 | |
| 65 | 67 | my $errors = $EMPTY;
|
| 66 | 68 | |
| 67 | - my @archives
|
|
| 68 | - = grep { $_->name =~ / [.]a $/msx && $_->is_regular_file }
|
|
| 69 | - @{$self->sorted_list};
|
|
| 69 | + my $magic = File::LibMagic->new;
|
|
| 70 | + |
|
| 71 | + my @archives= grep {
|
|
| 72 | + $_->name =~ / [.]a $/msx
|
|
| 73 | + && $_->is_regular_file
|
|
| 74 | + && $magic->info_from_filename($_->name)->{mime_type} eq
|
|
| 75 | + 'application/x-archive'
|
|
| 76 | + }@{$self->sorted_list};
|
|
| 70 | 77 | |
| 71 | 78 | for my $archive (@archives) {
|
| 72 | 79 |
| 1 | +Skeleton: upload-non-native
|
|
| 2 | +Testname: not-an-ar-archive
|
|
| 3 | +Description: Check for ar files detected by libmagic only |
| 1 | +dummy content |
| 1 | +Testname: not-an-ar-archive
|
|
| 2 | +Test-Against:
|
|
| 3 | + unpack-message-for-source
|
|
| 4 | + unpack-message-for-orig
|
|
| 5 | +Check: unpack |
| 1 | + |