* Jakub Wilk <jw...@debian.org>, 2011-12-04, 16:22:
I propose the attached patch to detect arch-specific files outside multiarch-directories.
Updated version of the patch is attached. (Unlike the previous one, this doesn't break checking arch:all packages. Oops.)
I also fixed a nearby misleading comment. -- Jakub Wilk
diff --git a/checks/binaries b/checks/binaries --- a/checks/binaries +++ b/checks/binaries @@ -128,7 +128,10 @@ my $proc = shift; my $arch; +my $multiarch; my $madir; +my $gnu_triplet_re; +my $ruby_triplet_re; my $dynsyms = 0; my $needs_libc = ''; my $needs_libc_file; @@ -140,6 +143,7 @@ my %SONAME; $arch = $info->field('architecture')//''; +$multiarch = $info->field('multi-arch')//'no'; my $srcpkg = $proc->pkg_src()//''; foreach my $file (sort keys %{$info->objdump_info}) { @@ -184,11 +188,18 @@ # nsswitch modules $madir = $MULTIARCH_DIRS->value($arch); -# In the (unlikely) case that the architecture is unknown (or we do +# In the case that the architecture is "all" or unknown (or we do # not know the multi-arch path for a known architecture) , we assume # it the multi-arch path to be this (hopefully!) non-existent path to # avoid warnings about uninitialized variables. $madir = './!non-existant-path!/./' unless defined $madir; + +$gnu_triplet_re = quotemeta $madir; +$gnu_triplet_re =~ s,^i386,i[3-6]86,; +$ruby_triplet_re = $gnu_triplet_re; +$ruby_triplet_re =~ s,linux\\-gnu$,linux,; +$ruby_triplet_re =~ s,linux\\-gnu,linux\\-,; + sub lib_soname_path { my ($dir, @paths) = @_; foreach my $path (@paths) { @@ -267,6 +278,12 @@ tag 'arch-dependent-file-in-usr-share', $file; } + if ($multiarch eq 'same') { + unless ($file =~ m,/(?:$gnu_triplet_re|$ruby_triplet_re|java-\d+-openjdk-\Q$arch\E)/,) { + tag 'arch-dependent-file-not-in-arch-specific-directory', $file; + } + } + # ELF? next unless $fileinfo =~ m/^[^,]*\bELF\b/o; diff --git a/checks/binaries.desc b/checks/binaries.desc --- a/checks/binaries.desc +++ b/checks/binaries.desc @@ -113,6 +113,13 @@ Info: This package installs an ELF binary in the <tt>/usr/share</tt> hierarchy, which is reserved for architecture-independent files. +Tag: arch-dependent-file-not-in-arch-specific-directory +Severity: serious +Certainty: possible +Ref: https://wiki.ubuntu.com/MultiarchSpec +Info: This package is Multi-Arch "same", but it installs an ELF binary in the + directory that is not architecture-specific. + Tag: binary-in-etc Severity: serious Certainty: certain