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

Re: Lintian trunk: ready for release?



On Sun, Feb 15, 2004 at 12:57:41PM +0100, Frank Lichtenheld wrote:
> On Sun, Feb 15, 2004 at 01:52:29AM +0100, Jeroen van Wolffelaar wrote:
> > Hi,
> > 
> > Since r40, I think lintian trunk is ready for release. But first,
> > testing is needed.
> 
> I'm not happy with the current deb-format thingy. Why don't we depend
> on libarchive-tar-perl? I find the message that is output for every
> binary package annoying. I would just depend on libarchive-tar-perl
> and go for it. Or at least only print the message in verbose mode.

Here is an alternative script without any dependency (and thus without
bugs? ;)).  It only checks for short names (either files, devices,
directories, etc.) of exactly 100 characters, as described in #230910,
I did not yet look at dpkg internals to see how it exactly is broken,
but at least it should solve #232875.

Denis
#! /usr/bin/perl -w

# deb-format -- lintian check script

# Copyright (C) 2004 Denis Barbier
# Based on a check provided by Marc 'HE' Brockschmidt.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.

use strict;
    
($#ARGV == 1) or fail("syntax: deb-format <pkg> <type>");
my $pkg = shift;
my $type = shift;

sub get_block_size {
        my $size = shift;
        my $nblocks = int($size / 512);
        $nblocks ++ if (($size % 512) > 0);
        return 512*$nblocks;
}

open INPUT, "ar p deb data.tar.gz | gzip -dc |";

my $chunk;
my $is_long = 0;
while (read(INPUT, $chunk, 512)) {
        last if length($chunk) != 512;
        my ($name, $size, $type) = unpack "A100x24A12x20A1", $chunk;
        $size = oct($size);

        if ($type eq 'L') {
                #  Long file name
                read(INPUT, $chunk, get_block_size($size)) or last;
                $is_long = 1;
                next;
        }
        next if $size == 0;
        #  Read content
        read(INPUT, $chunk, get_block_size($size)) or last;
        print "E: $pkg $type: deb-created-with-broken-tar broken file: /$name\n"
                if $is_long == 0 && length($name) == 100;
        $is_long = 0;
}

close INPUT;

Reply to: