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
Prevent non-ar *.a files from triggering false positives in
unpack-message-for-{source,orig,deb-data}
Closes: #1120737
- - - - -
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:
=====================================
debian/control
=====================================
@@ -29,6 +29,7 @@ Build-Depends:
libconst-fast-perl,
libcrypt-dev,
libfile-basedir-perl,
+ libfile-libmagic-perl,
libio-prompt-tiny-perl <!nocheck>,
libipc-run3-perl,
liblist-someutils-perl <!nocheck>,
@@ -107,6 +108,7 @@ Depends:
libemail-address-xs-perl,
libfile-basedir-perl,
libfile-find-rule-perl,
+ libfile-libmagic-perl,
libfont-ttf-perl,
libhtml-html5-entities-perl,
libhtml-tokeparser-simple-perl,
=====================================
lib/Lintian/Index/Ar.pm
=====================================
@@ -31,6 +31,8 @@ use Lintian::IPC::Run3 qw(safe_qx);
use Moo::Role;
use namespace::clean;
+use File::LibMagic;
+
const my $EMPTY => q{};
const my $NEWLINE => qq{\n};
@@ -64,9 +66,14 @@ sub add_ar {
my $errors = $EMPTY;
- my @archives
- = grep { $_->name =~ / [.]a $/msx && $_->is_regular_file }
- @{$self->sorted_list};
+ my $magic = File::LibMagic->new;
+
+ my @archives= grep {
+ $_->name =~ / [.]a $/msx
+ && $_->is_regular_file
+ && $magic->info_from_filename($_->name)->{mime_type} eq
+ 'application/x-archive'
+ }@{$self->sorted_list};
for my $archive (@archives) {
=====================================
t/recipes/checks/unpack/not-an-ar-archive/build-spec/fill-values
=====================================
@@ -0,0 +1,3 @@
+Skeleton: upload-non-native
+Testname: not-an-ar-archive
+Description: Check for ar files detected by libmagic only
=====================================
t/recipes/checks/unpack/not-an-ar-archive/build-spec/orig/text-file.a
=====================================
@@ -0,0 +1 @@
+dummy content
=====================================
t/recipes/checks/unpack/not-an-ar-archive/eval/desc
=====================================
@@ -0,0 +1,5 @@
+Testname: not-an-ar-archive
+Test-Against:
+ unpack-message-for-source
+ unpack-message-for-orig
+Check: unpack
=====================================
t/recipes/checks/unpack/not-an-ar-archive/eval/hints
=====================================
@@ -0,0 +1 @@
+
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/27aea38cd0fea538deddaedd206495fcbe3a3c44
--
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/27aea38cd0fea538deddaedd206495fcbe3a3c44
You're receiving this email because of your account on salsa.debian.org.