[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#551671: a rudimentary info cruft checker



Package: info
Version: 4.13a.dfsg.1-5
Severity: wishlist

Gentlemen, I hereby submit my info cruft checker, for you to improve on
and somehow use to catch problems before the user bumps into them.
Note however that it only checks the info files that happen to be
installed on the particular users system.

$ ./check
In index but not on disk: exim_filtering
In index but not on disk: gpg
In index but not on disk: grub
Has .info in name in index: hexeditor.info
In index but not on disk: the_exim_mta
On disk but not in index: /usr/share/info/cpp.info.gz
On disk but not in index: /usr/share/info/cppinternals.info.gz
On disk but not in index: /usr/share/info/emacs-23/info.gz
On disk but not in index: /usr/share/info/exim4-filter.info.gz
On disk but not in index: /usr/share/info/exim4.info.gz
On disk but not in index: /usr/share/info/gnupg1.info.gz
On disk but not in index: /usr/share/info/grub-legacy.info.gz
On disk but not in index: /usr/share/info/ispell.info.gz
On disk but not in index: /usr/share/info/quelcom.info.gz
$ cat check
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
my $D = '/usr/share/info';
my ( %disk, %h );
for (`find $D -type f -o -type l`) {
    chomp;
    next if /-\d+\.gz|\/dir(.old)?\b/;
    $disk{$_}++;
}
open( DIR, "$D/dir" ) || die;
while (<DIR>) { /: \(([^)]+)\)/ && $h{$1}++; }
for ( sort keys %h ) {
    print "Has .info in name in index: $_\n" if /\.info/;
    delete $disk{"$D/${_}.gz"}
      or delete $disk{"$D/${_}.info.gz"}
      or print "In index but not on disk: $_\n";
}
for ( sort keys %disk ) { print "On disk but not in index: $_\n" }



Reply to: