[tex-live] check files

Heiko Oberdiek oberdiek at uni-freiburg.de
Tue Jun 17 13:23:33 CEST 2008


Hello,

I have written a script to "check" files based on the file extension.
See below in the Perl script, which programs I have used for "checking".

As result the problematic files of the first 2193 checked files:

[ERROR] 346. texmf-dist/doc/latex/ctib/ctib4tex.pdf
[ERROR] 347. texmf-dist/doc/latex/easy/doc.dvi
[ERROR] 484. texmf-dist/doc/latex/csquotes/csquotes.pdf
[ERROR] 839. texmf-dist/doc/latex/engpron/engpron.xml
[ERROR] 922. texmf-dist/doc/latex/minitoc/minitoc.pdf
[ERROR] 923. texmf-dist/doc/latex/minitoc/fminitoc.pdf
[ERROR] 928. texmf-dist/doc/latex/minitoc/images/basque-de.pdf
[ERROR] 929. texmf-dist/doc/latex/minitoc/images/basque-df.pdf
[ERROR] 953. texmf-dist/doc/latex/minitoc/images/slovak-ok.pdf
[ERROR] 975. texmf-dist/doc/latex/minitoc/images/euro-lan.pdf
[ERROR] 981. texmf-dist/doc/latex/minitoc/images/spain.pdf
[ERROR] 1006. texmf-dist/doc/latex/minitoc/images/occitanie.pdf
[ERROR] 1010. texmf-dist/doc/latex/minitoc/images/xyugo.pdf
[ERROR] 1029. texmf-dist/doc/latex/minitoc/images/germ-w.pdf
[ERROR] 1052. texmf-dist/doc/latex/minitoc/images/mongols.pdf
[ERROR] 1058. texmf-dist/doc/latex/minitoc/images/euskara.pdf
[ERROR] 1091. texmf-dist/doc/latex/minitoc/images/slovenian.pdf
[ERROR] 1106. texmf-dist/doc/latex/minitoc/images/galician-l.pdf
[ERROR] 1121. texmf-dist/doc/latex/minitoc/images/africa-lf.pdf
[ERROR] 1128. texmf-dist/doc/latex/minitoc/images/latvian-d.pdf
[ERROR] 1138. texmf-dist/doc/latex/minitoc/images/china-ch.pdf
[ERROR] 1143. texmf-dist/doc/latex/minitoc/images/same-f.pdf
[ERROR] 1191. texmf-dist/doc/latex/spotcolor/readme.pdf
[ERROR] 1213. texmf-dist/doc/latex/eCards/graphics/uakron.png
[ERROR] 1396. texmf-dist/doc/latex/movie15/movie15.pdf
[ERROR] 1398. texmf-dist/doc/latex/movie15/overlay-example.pdf
[ERROR] 1451. texmf-dist/doc/latex/isodoc/isodoc.pdf
[ERROR] 1496. texmf-dist/doc/latex/uwthesis/uwthesis.pdf
[ERROR] 1498. texmf-dist/doc/latex/memoir/memman.pdf
[ERROR] 1510. texmf-dist/doc/latex/miller/miller.xml
[ERROR] 1523. texmf-dist/doc/latex/montex/mlsquick.pdf
[ERROR] 1526. texmf-dist/doc/latex/montex/montex.pdf
[ERROR] 1634. texmf-dist/doc/latex/oberdiek/bitset.pdf
[ERROR] 1635. texmf-dist/doc/latex/oberdiek/askinclude.pdf
[ERROR] 1639. texmf-dist/doc/latex/oberdiek/stringenc.pdf
[ERROR] 1640. texmf-dist/doc/latex/oberdiek/embedfile.pdf
[ERROR] 1645. texmf-dist/doc/latex/oberdiek/luatex.pdf
[ERROR] 1647. texmf-dist/doc/latex/oberdiek/intcalc.pdf
[ERROR] 1666. texmf-dist/doc/latex/oberdiek/kvoptions.pdf
[ERROR] 1667. texmf-dist/doc/latex/oberdiek/zref.pdf
[ERROR] 1669. texmf-dist/doc/latex/oberdiek/pdfescape.pdf
[ERROR] 1676. texmf-dist/doc/latex/oberdiek/soulutf8.pdf
[ERROR] 1679. texmf-dist/doc/latex/oberdiek/inputenx.pdf
[ERROR] 1680. texmf-dist/doc/latex/oberdiek/bmpsize.pdf
[ERROR] 1681. texmf-dist/doc/latex/oberdiek/bookmark.pdf
[ERROR] 1684. texmf-dist/doc/latex/oberdiek/bigintcalc.pdf
[ERROR] 1695. texmf-dist/doc/latex/oberdiek/attachfile2.pdf

The last ones :-((( are now fixed (again a problem with the last step
with Multivaltent to generate compressed PDF 1.5) by generating
PDF 1.4 instead. The update is on its way to CTAN.

I have put a more detailed protocol file on the Web:
  http://www.informatik.uni-freiburg.de/~oberdiek/tmp/check-files.log.gz

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

PS: the Perl script:

#!/usr/bin/env perl
use strict;
$^W=1;

my @list = (
    [
        ['afm'],
        ['afm2tfm {IN} {OUT}']
    ],[
        ['dvi'],
        ['dvitype {IN}{NULL}']
    ],[
        ['gif'],
        ['giftopnm <{IN}{NULL}']
    ],[
        ['jpg', 'jpeg'],
        ['jpegtopnm <{IN}{NULL}']
    ],[
        ['pdf'],
        ['pdftops {IN} {OUT}',
         'pdf2ps {IN} {OUT}',
         'acroread -toPostScript -pairs {IN} {OUT}']
    ],[
        ['pfb'],
        ['pfbtopfa {IN} {OUT}',
         'pfb2pfa {IN} {OUT}',
         'pfbtops {IN}{NULL}']
    ],[
        ['pk'],
        ['pktogf {IN} {OUT}']
    ],[
        ['png'],
        ['pngtopnm <{IN}{NULL}{CHECK_STDERR}']
    ],[
        ['tar', 'tar.bz2', 'tar.gz', 'tgz'],
        ['tar tf {IN}{NULL}']
    ],[
        ['vf'],
        ['vftovp {IN} {OUT} {OUT2}']
    ],[
        ['xml'],
        ['xmllint --noout {IN}']
    ],[
        ['zip'],
        ['unzip -t {IN}']
    ]
);

my $out1 = "/tmp/tmp_$$.out";
my $out2 = "/tmp/tmp2_$$.out";

my $syntax = "Syntax: $0 <TL root> [start index]\n";

@ARGV == 1 || @ARGV == 2 || die $syntax;

my $tlroot = shift @ARGV;
-d $tlroot or die "!!! Error: `$tlroot' isn't a directory!\n";
my $start = 1;
$start = shift @ARGV if @ARGV;

my $find_options = ' -false';
foreach my $entry (@list) {
    foreach my $ext (@{@$entry[0]}) {
        $find_options .= " -or -name \\*.$ext";
    }
}
my $cmd = "cd $tlroot && find .$find_options|";
open(IN, $cmd);

sub check_file {
    my $file = shift;
    my $cmd_ref = shift;
    foreach my $cmd_template (@$cmd_ref) {
        my $cmd = "$cmd_template";
        $cmd =~ s|{IN}|$file|g;
        $cmd =~ s|{OUT}|$out1|g;
        $cmd =~ s|{OUT2}|$out2|g;
        if ($cmd =~ /{NULL}/) {
            $cmd =~ s|{NULL}| 2>&1 >/dev/null|;
        }
        else {
            $cmd .= ' 2>&1';
        }
        my $check_stderr = 0;
        if ($cmd =~ /{CHECK_STDERR}/) {
            $cmd =~ s|{CHECK_STDERR}||;
            $cmd .= '|| true';
            $check_stderr = 1;
        }

        my @lines = `cd $tlroot && $cmd`;
        next if $check_stderr ? @lines == 0 : $? == 0;

        print "*" x 70, "\n";
        print "* [$cmd]\n";
        foreach my $line (@lines) {
            print "* $line";
        }
        if ($check_stderr == 0) {
            if ($? == -1) {
                print "* [failed to execute: $!]\n";
            }
            elsif ($? & 127) {
                printf "* [child died with signal %d]\n", ($? & 127);
            }
            else {
                printf "* [child exited with value %d]\n", $? >> 8;
            }
        }
        return 0;
    }
    return 1;
}

my $index = 0;
while (<IN>) {
    $index++;
    next if $index < $start;
    chomp;
    s|^\./||;

    my $ok = 0;
    foreach my $entry (@list) {
        my @ext = @{@$entry[0]};
        my $pattern = '';
        if (@ext > 1) {
            $pattern = "\\.(" . join('|', @ext) . ')$';
        }
        else {
            $pattern = "\\." . $ext[0] . '$';
        }
        if (/$pattern/) {
            $ok = check_file($_, @$entry[1]);
            last;
        }
    }
    if ($ok) {
        print "[OK] $index. $_\n";
    }
    else {
        print "[ERROR] $index. $_\n";
    }
}

close(IN);

unlink $out1;
unlink $out2;

__END__


More information about the tex-live mailing list