/usr/share/lintian/collection/file-info-helper is in lintian 2.5.10.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/usr/bin/perl
use strict;
use warnings;
while ( my $line = <> ) {
my ($file, $type) = $line =~ (m/^(.*?)\x00(.*)$/o);
if ($file =~ m/\.gz$/o && -f $file && ! -l $file && $type !~ m/compressed/o){
# While file could be right, it is unfortunately
# regularly wrong here as well; double check the type
my $text = '';
if (open(my $gzf, '<', $file)) {
my $buff;
# We need to read at least 9 bytes
if (sysread($gzf, $buff, 1024) >= 9) {
# translation of the unpack
# nn nn , NN NN NN NN, nn nn, cc - bytes read (in hex, network order)
# $magic, __ __ __ __, __ __, $comp - variables
my ($magic, undef, undef, $comp) = unpack('nNnc', $buff);
if ($magic == 0x1f8b){ # the gzip file magic
$text = 'gzip compressed data';
# 2 for max compression; RFC1952 suggests this is a flag and not a value,
# hench the bit and operation
if (($comp & 2) == 2){
$text = "$text, max compression";
}
}
}
close($gzf);
}
$type = "$type, $text" if $text;
}
printf "%s%c%s\n", $file , 0, $type;
}
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
|