Commit 9f5271bf authored by Dmitry Bogatov's avatar Dmitry Bogatov Committed by Chris Lamb

Check for commands in /sbin or /usr/sbin with manpages in the incorrect section. (Closes: #570998)

Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent d787ef35
Pipeline #53509 passed with stages
in 87 minutes and 10 seconds
......@@ -258,3 +258,16 @@ Info: The manual page appears to have an overly generic name that is likely to
clash with other packages.
.
Please check your debian/rules or upstream Makefile.
Tag: command-in-sbin-has-manpage-in-incorrect-section
Certainty: possible
Severity: normal
Ref: hier(7)
Info: The command in <tt>/sbin</tt> or <tt>/usr/sbin</tt> are system
administration commands; their manpages thus belong in section 8, not
section 1.
.
Please check whether the command is actually useful to non-privileged
user in which case it should be moved to <tt>/bin</tt> or
<tt>/usr/bin</tt>, or alternatively the manual page should be moved to
section 8 instead, ie. <tt>/usr/share/man/man8</tt>.
......@@ -60,8 +60,9 @@ sub run {
or ($path eq 'usr/games/'))
) {
my $bin = $fname;
$binary{$bin} = $file;
my $bin = $fname;
my $sbin = ($path eq 'sbin/') || ($path eq 'usr/sbin/');
$binary{$bin} = { file => $file, sbin => $sbin };
$link{$bin} = $link if $link;
next;
......@@ -118,7 +119,8 @@ sub run {
if (scalar @pieces && $section_num =~ s/^(\d).*$/$1/) {
my $bin = join('.', @pieces);
$manpage{$bin} = [] unless $manpage{$bin};
push @{$manpage{$bin}}, { file => $file, lang => $lang };
push @{$manpage{$bin}},
{ file => $file, lang => $lang, section => $section };
# number of directory and manpage extension equal?
if ($section_num != $section) {
......@@ -317,12 +319,19 @@ sub run {
}
for my $f (sort keys %binary) {
if (exists $manpage{$f}) {
if (none { $_->{lang} eq '' } @{$manpage{$f}}) {
tag 'binary-without-english-manpage', "$binary{$f}";
my $binfo = $binary{$f};
my $minfo = $manpage{$f};
if ($minfo) {
if ($binfo->{sbin} && $minfo->[0]{section} == 1) {
tag 'command-in-sbin-has-manpage-in-incorrect-section',
$binfo->{file};
}
if (none { $_->{lang} eq '' } @{$minfo}) {
tag 'binary-without-english-manpage', $binfo->{file};
}
} else {
tag 'binary-without-manpage', "$binary{$f}";
tag 'binary-without-manpage', $binfo->{file};
}
}
......
Skeleton: upload-native
Testname: command-in-sbin-has-manpage-in-incorrect-section
Version: 1.0
Description: Binary in /sbin with manpage in section 1
Check: manpages
.TH fixcr 1
.SH NAME
fixcr \- make sure that there is a CR before each LF
.SH SYNOPSIS
.B fixcr
.SH DESCRIPTION
.B fixcr
inserts CR at the end of each line of input where a CR is not already present.
It does not insert CR at the end of a partial final line.
.SH "SEE ALSO"
addcr(1)
command-in-sbin-has-manpage-in-incorrect-section (binary): command-in-sbin-has-manpage-in-incorrect-section usr/sbin/sbin-binary
......@@ -31,6 +31,7 @@ manpages-general (binary): empty-manual-page usr/share/man/man6/usr-games-binary
manpages-general (binary): empty-manual-page usr/share/man/man1/usr-sbin-binary.1.gz
manpages-general (binary): empty-manual-page usr/share/man/man1/usr-bin-binary-alt.1.gz
manpages-general (binary): empty-manual-page usr/share/man/de/man1/binary-without-english-manpage.1
manpages-general (binary): command-in-sbin-has-manpage-in-incorrect-section usr/sbin/usr-sbin-binary
manpages-general (binary): binary-without-manpage usr/bin/rstartd
manpages-general (binary): binary-without-english-manpage usr/bin/binary-without-english-manpage
manpages-general (binary): bad-so-link-within-manual-page usr/share/man/man1/bad-so.1.gz
......
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