Commit e069e846 authored by Chris Lamb's avatar Chris Lamb 💬

Warn about files referencing /usr/bin/foo if the binary is actually installed...

Warn about files referencing /usr/bin/foo if the binary is actually installed under /usr/sbin/foo. (Closes: #930702)
parent d528ba88
Pipeline #52825 failed with stages
in 95 minutes and 35 seconds
......@@ -2129,3 +2129,16 @@ Info: The package installs the listed file to a directory in / (the
.
A compatibility symlink to the corresponding file in /usr will not
trigger this warning but a symlink to anywhere else will.
Tag: bin-sbin-mismatch
Severity: wishlist
Certainty: possible
Experimental: yes
Info: The package installs a binary under <tt>/usr/sbin</tt> or
<tt>/sbin</tt> but the specified file or maintainer script appears to
incorrectly reference it under <tt>/usr/bin</tt> or <tt>/bin</tt>.
.
This is likely due to the maintainer identifying that the package
requires root privileges or similar and thus installing the files to
the <tt>sbin</tt> variant, but the package has not been comprehensively
or completely updated to match.
......@@ -304,6 +304,7 @@ sub run {
my %linked_against_libvga;
my @devhelp;
my @devhelp_links;
my @bin_binaries;
# X11 bitmapped font directories under /usr/share/fonts/X11 in which we've
# seen files.
......@@ -423,6 +424,11 @@ sub run {
my $link = $file->link;
my $finfo = $file->file_info;
# If we have a /usr/sbin/foo, check for references to
# /usr/bin/foo
push(@bin_binaries, "/$1bin/$2")
if $file->is_file and $fname =~ m,^(usr/)?sbin/(.+),;
$arch_dep_files = 1
if not $file->is_dir
and $fname !~ m,^usr/share/,o
......@@ -1520,7 +1526,8 @@ sub run {
# ---------------- contents checks
my %checks
= get_checks_for_file($info, $file, $source_pkg, $build_path);
= get_checks_for_file($info, $file, $source_pkg,
$build_path, @bin_binaries);
if (%checks) {
my $stringsfd = $info->strings($file);
......@@ -2059,7 +2066,8 @@ sub run {
next if not $file or not $file->is_open_ok;
my %checks
= get_checks_for_file($info, $file, $source_pkg, $build_path);
= get_checks_for_file($info, $file, $source_pkg, $build_path,
@bin_binaries);
my $fd2 = $file->open;
while (<$fd2>) {
foreach my $tag (sort keys %checks) {
......@@ -2370,7 +2378,7 @@ sub detect_privacy_breach {
}
sub get_checks_for_file {
my ($info, $file, $source_pkg, $build_path) = @_;
my ($info, $file, $source_pkg, $build_path, @bin_binaries) = @_;
my %checks;
return %checks if $source_pkg eq 'lintian';
......@@ -2391,6 +2399,10 @@ sub get_checks_for_file {
$checks{'file-references-package-build-path'} = $build_path
if defined $build_path && $build_path =~ m,^/.+,g;
# If we have a /usr/sbin/foo, check for references to /usr/bin/foo
$checks{'bin-sbin-mismatch'} = "(" . join('|', @bin_binaries) . ")"
if @bin_binaries;
return %checks;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment