summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-01-24 03:55:35 +0000
committerNorbert Preining <preining@logic.at>2018-01-24 03:55:35 +0000
commit9eaa775cf46f42eee783f48b085b765d08cf3296 (patch)
tree05411d5843f285dcd5416d3872e39cfced4c9b7d /Master/tlpkg
parenta2e0081ad0b36cecf31817297ce96467110d71d0 (diff)
better debugging and stronger integrity checks
git-svn-id: svn://tug.org/texlive/trunk@46421 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLCrypto.pm14
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm7
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm9
3 files changed, 23 insertions, 7 deletions
diff --git a/Master/tlpkg/TeXLive/TLCrypto.pm b/Master/tlpkg/TeXLive/TLCrypto.pm
index ed54df1cc42..2d6a0a1cd5a 100644
--- a/Master/tlpkg/TeXLive/TLCrypto.pm
+++ b/Master/tlpkg/TeXLive/TLCrypto.pm
@@ -180,7 +180,7 @@ sub tlchecksum {
} elsif ($::checksum_method eq "digest::sha") {
$cs = $out;
}
- ddebug("tlchecksum: cs ===$cs===\n");
+ debug("tlchecksum($file): ===$cs===\n");
if (length($cs) != 128) {
tlwarn("unexpected output from $::checksum_method: $out\n");
return "";
@@ -247,23 +247,29 @@ sub verify_checksum {
# next step is verification of tlpdb checksum with checksum file
# existenc of checksum_file was checked above
if (!$checksum_file) {
+ debug("verify_checksum: download did not succeed for $checksum_url\n");
return($VS_CONNECTION_ERROR, "download did not succeed: $checksum_url");
}
# check the signature
my ($ret, $msg) = verify_signature($checksum_file, $checksum_url);
- return ($ret, $msg) if ($ret != 0);
+
+ if ($ret != 0) {
+ debug("verify_checksum: returning $ret and $msg\n");
+ return ($ret, $msg)
+ }
# verify local data
open $cs_fh, "<$checksum_file" or die("cannot read file: $!");
if (read ($cs_fh, $remote_digest, $ChecksumLength) != $ChecksumLength) {
close($cs_fh);
+ debug("verify_checksum: incomplete read from\n $checksum_file\nfor\n $file\nand\n $checksum_url\n");
return($VS_CHECKSUM_ERROR, "incomplete read from $checksum_file");
} else {
close($cs_fh);
- ddebug("found remote digest: $remote_digest\n");
+ debug("verify_checksum: found remote digest\n $remote_digest\nfrom\n $checksum_file\nfor\n $file\nand\n $checksum_url\n");
}
$local_digest = tlchecksum($file);
- ddebug("local_digest = $local_digest\n");
+ debug("verify_checksum: local_digest = $local_digest\n");
if ($local_digest ne $remote_digest) {
return($VS_CHECKSUM_ERROR, "digest disagree");
}
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 905a37c7859..6f116ace21b 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -1896,7 +1896,7 @@ sub not_virtual_install_package {
} elsif (&media eq 'NET') {
$container = "$root/$Archive/$pkg.$TeXLive::TLConfig::DefaultContainerExtension";
}
- $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containermd5)
+ $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containerchecksum)
|| return(0);
# if we are installing from local_compressed or NET we have to fetch the respective
# source and doc packages $pkg.source and $pkg.doc and install them, too
@@ -1915,13 +1915,13 @@ sub not_virtual_install_package {
if ($container_src_split && $opt_src && $tlpobj->srcfiles) {
my $srccontainer = $container;
$srccontainer =~ s/(\.tar\.xz|\.zip)$/.source$1/;
- $self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainermd5)
+ $self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainerchecksum)
|| return(0);
}
if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) {
my $doccontainer = $container;
$doccontainer =~ s/(\.tar\.xz|\.zip)$/.doc$1/;
- $self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainermd5)
+ $self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainerchecksum)
|| return(0);
}
#
@@ -2054,6 +2054,7 @@ sub _install_data {
$target .= "/$TeXLive::TLConfig::RelocTree";
}
}
+ debug("tlpdb:_install_data: what=$what, target=$target, size=$whatsize, checksum=$whatcheck, tmpdir=$tempdir\n");
my ($ret, $pkg) = TeXLive::TLUtils::unpack($what, $target, 'size' => $whatsize, 'checksum' => $whatcheck, 'tmpdir' => $tempdir);
if (!$ret) {
tlwarn("TLPDB::_install_package: $pkg\n");
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 2a6c940ac89..5fa568e01be 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -2064,6 +2064,11 @@ not agree. If a check argument is not given, that check is not performed.
sub check_file {
my ($xzfile, $checksum, $checksize) = @_;
+ debug("check_file $xzfile, $checksum, $checksize\n");
+ if (!$checksum && !$checksize) {
+ tlwarn("TLUtils::check_file: neither checksum nor checksize available for $xzfile, cannot check integrity!\n");
+ return;
+ }
# only run checksum tests if we can actually compute the checksum
if ($checksum && $::checksum_method) {
my $tlchecksum = TeXLive::TLCrypto::tlchecksum($xzfile);
@@ -2072,6 +2077,10 @@ sub check_file {
tlwarn("TLUtils::check_file: TL=$tlchecksum, arg=$checksum\n");
unlink($xzfile);
return;
+ } else {
+ debug("TLUtils::check_file: checksums for $xzfile agree\n");
+ # if we have checked the checksum, we don't need to check the size, too
+ return;
}
}
if ($checksize) {