In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/dc3c11c5b3d54ab8fc396c19fa05e08481207107?hp=e7f023fff87036c495789856bca5970f890d386b>
- Log ----------------------------------------------------------------- commit dc3c11c5b3d54ab8fc396c19fa05e08481207107 Author: Chris 'BinGOs' Williams <ch...@bingosnet.co.uk> Date: Mon Dec 25 19:33:02 2017 +0000 Update Digest-SHA to CPAN version 6.01 [DELTA] 6.01 Mon Dec 25 00:08:08 MST 2017 - added "--ignore-missing" and "--strict" options to shasum -- consistent with GNU coreutils -- ref. rt.cpan.org #123897 - removed PERL_CORE preambles from test scripts -- preambles no longer needed for core testing -- thanks to Chris Williams for patch -- ref. rt.cpan.org #123863 ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 28 +------------------ cpan/Digest-SHA/lib/Digest/SHA.pm | 6 +++-- cpan/Digest-SHA/shasum | 57 +++++++++++++++++++++++++-------------- cpan/Digest-SHA/src/sha.c | 4 +-- cpan/Digest-SHA/src/sha.h | 4 +-- cpan/Digest-SHA/src/sha64bit.c | 4 +-- cpan/Digest-SHA/src/sha64bit.h | 4 +-- t/porting/customized.dat | 23 ---------------- 8 files changed, 50 insertions(+), 80 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 8db1e2328b..3d748c8cee 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -377,7 +377,7 @@ use File::Glob qw(:case); }, 'Digest::SHA' => { - 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-6.00.tar.gz', + 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-6.01.tar.gz', 'FILES' => q[cpan/Digest-SHA], 'EXCLUDED' => [ qw( t/pod.t @@ -385,32 +385,6 @@ use File::Glob qw(:case); examples/dups ), ], - # https://rt.cpan.org/Public/Bug/Display.html?id=123863 - CUSTOMIZED => [qw[ - t/allfcns.t - t/base64.t - t/bitbuf.t - t/bitorder.t - t/fips180-4.t - t/fips198.t - t/gg.t - t/gglong.t - t/hmacsha.t - t/inheritance.t - t/ireland.t - t/methods.t - t/nistbit.t - t/nistbyte.t - t/rfc2202.t - t/sha1.t - t/sha224.t - t/sha256.t - t/sha384.t - t/sha512.t - t/state.t - t/unicode.t - t/woodbury.t - ] ], }, 'Dumpvalue' => { diff --git a/cpan/Digest-SHA/lib/Digest/SHA.pm b/cpan/Digest-SHA/lib/Digest/SHA.pm index 53b3f06f5d..2e86d4eea1 100644 --- a/cpan/Digest-SHA/lib/Digest/SHA.pm +++ b/cpan/Digest-SHA/lib/Digest/SHA.pm @@ -4,15 +4,16 @@ require 5.003000; use strict; use warnings; -use vars qw($VERSION @ISA @EXPORT_OK); +use vars qw($VERSION @ISA @EXPORT_OK $errmsg); use Fcntl qw(O_RDONLY); use integer; -$VERSION = '6.00'; +$VERSION = '6.01'; require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw( + $errmsg hmac_sha1 hmac_sha1_base64 hmac_sha1_hex hmac_sha224 hmac_sha224_base64 hmac_sha224_hex hmac_sha256 hmac_sha256_base64 hmac_sha256_hex @@ -67,6 +68,7 @@ sub add_bits { sub _bail { my $msg = shift; + $errmsg = $!; $msg .= ": $!"; require Carp; Carp::croak($msg); diff --git a/cpan/Digest-SHA/shasum b/cpan/Digest-SHA/shasum index 25330ddd94..f8bc02098d 100644 --- a/cpan/Digest-SHA/shasum +++ b/cpan/Digest-SHA/shasum @@ -4,8 +4,8 @@ ## ## Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved ## - ## Version: 6.00 - ## Fri Dec 8 22:44:44 MST 2017 + ## Version: 6.01 + ## Mon Dec 25 00:08:08 MST 2017 ## shasum SYNOPSIS adapted from GNU Coreutils sha1sum. Add ## "-a" option for algorithm selection, @@ -18,7 +18,7 @@ use strict; use warnings; use Fcntl; use Getopt::Long; -use Digest::SHA; +use Digest::SHA qw($errmsg); my $POD = <<'END_OF_POD'; @@ -44,10 +44,12 @@ shasum - Print or Check SHA Checksums ASCII '1' interpreted as 1-bit, all other characters ignored - The following three options are useful only when verifying checksums: - -s, --status don't output anything, status code shows success - -q, --quiet don't print OK for each successfully verified file - -w, --warn warn about improperly formatted checksum lines + The following five options are useful only when verifying checksums: + --ignore-missing don't fail or report status for missing files + -q, --quiet don't print OK for each successfully verified file + -s, --status don't output anything, status code shows success + --strict exit non-zero for improperly formatted checksum lines + -w, --warn warn about improperly formatted checksum lines -h, --help display this help and exit -v, --version output version information and exit @@ -105,7 +107,7 @@ I<shasum> is implemented using the Perl module L<Digest::SHA>. END_OF_POD -my $VERSION = "6.00"; +my $VERSION = "6.01"; sub usage { my($err, $msg) = @_; @@ -133,7 +135,7 @@ select((select(STDERR), $| = 1)[0]); ## Collect options from command line my ($alg, $binary, $check, $text, $status, $quiet, $warn, $help); -my ($version, $BITS, $UNIVERSAL, $tag); +my ($version, $BITS, $UNIVERSAL, $tag, $strict, $ignore_missing); eval { Getopt::Long::Configure ("bundling") }; GetOptions( @@ -145,6 +147,8 @@ GetOptions( '0|01' => \$BITS, 'U|UNIVERSAL' => \$UNIVERSAL, 'tag' => \$tag, + 'strict' => \$strict, + 'ignore-missing' => \$ignore_missing, ) or usage(1, ""); @@ -161,6 +165,10 @@ usage(1, "shasum: --status option used only when verifying checksums\n") if $status && !$check; usage(1, "shasum: --quiet option used only when verifying checksums\n") if $quiet && !$check; +usage(1, "shasum: --ignore-missing option used only when verifying checksums\n") + if $ignore_missing && !$check; +usage(1, "shasum: --strict option used only when verifying checksums\n") + if $strict && !$check; usage(1, "shasum: --tag does not support --text mode\n") if $tag && $text; usage(1, "shasum: --tag does not support Universal Newlines mode\n") @@ -211,7 +219,7 @@ sub sumfile { my $mode = $binary ? 'b' : ($UNIVERSAL ? 'U' : ($BITS ? '0' : '')); my $digest = eval { Digest::SHA->new($alg)->addfile($file, $mode) }; - if ($@) { warn "shasum: $file: $!\n"; return } + if ($@) { warn "shasum: $file: $errmsg\n"; return } $digest->hexdigest; } @@ -239,7 +247,7 @@ sub unescape { sub verify { my $checkfile = shift; my ($err, $fmt_errs, $read_errs, $match_errs) = (0, 0, 0, 0); - my ($num_lines, $num_files) = (0, 0); + my ($num_fmt_OK, $num_OK) = (0, 0); my ($bslash, $sum, $fname, $rsp, $digest, $isOK); local *FH; @@ -248,7 +256,7 @@ sub verify { or sysopen(FH, $checkfile, O_RDONLY) or die "shasum: $checkfile: $!\n"; while (<FH>) { - next if /^#/; $num_lines++; + next if /^#/; if (/^[ \t]*\\?SHA/) { $modesym = '*'; ($bslash, $alg, $fname, $sum) = @@ -265,10 +273,13 @@ sub verify { warn("shasum: $checkfile: $.: improperly " . "formatted SHA checksum line\n") if $warn; $fmt_errs++; + $err = 1 if $strict; next; } + $num_fmt_OK++; $fname = unescape($fname) if $bslash; - $rsp = "$fname: "; $num_files++; + next if $ignore_missing && ! -e $fname; + $rsp = "$fname: "; ($binary, $text, $UNIVERSAL, $BITS) = map { $_ eq $modesym } ('*', ' ', 'U', '^'); $isOK = 0; @@ -276,17 +287,18 @@ sub verify { $rsp .= "FAILED open or read\n"; $err = 1; $read_errs++; } - else { - if (lc($sum) eq $digest) { $rsp .= "OK\n"; $isOK = 1 } - else { $rsp .= "FAILED\n"; $err = 1; $match_errs++ } + elsif (lc($sum) eq $digest) { + $rsp .= "OK\n"; + $isOK = 1; + $num_OK++; } + else { $rsp .= "FAILED\n"; $err = 1; $match_errs++ } print $rsp unless ($status || ($quiet && $isOK)); } close(FH); - unless ($num_files) { - $alg = 1 unless defined $alg; + if (! $num_fmt_OK) { warn("shasum: $checkfile: no properly formatted " . - "SHA$alg checksum lines found\n"); + "SHA checksum lines found\n"); $err = 1; } elsif (! $status) { @@ -297,6 +309,11 @@ sub verify { warn("shasum: WARNING: $match_errs computed checksum" . ($match_errs>1?'s':'') . " did NOT match\n") if $match_errs; } + if ($ignore_missing && ! $num_OK && $num_fmt_OK) { + warn("shasum: $checkfile: no file was verified\n") + unless $status; + $err = 1; + } return($err == 0); } @@ -317,4 +334,4 @@ for $file (@ARGV) { } else { $STATUS = 1 } } -exit($STATUS) +exit($STATUS); diff --git a/cpan/Digest-SHA/src/sha.c b/cpan/Digest-SHA/src/sha.c index ee1b4d82c6..79557fff8f 100644 --- a/cpan/Digest-SHA/src/sha.c +++ b/cpan/Digest-SHA/src/sha.c @@ -5,8 +5,8 @@ * * Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved * - * Version: 6.00 - * Fri Dec 8 22:44:44 MST 2017 + * Version: 6.01 + * Mon Dec 25 00:08:08 MST 2017 * */ diff --git a/cpan/Digest-SHA/src/sha.h b/cpan/Digest-SHA/src/sha.h index 3347e9192c..91f181b0be 100644 --- a/cpan/Digest-SHA/src/sha.h +++ b/cpan/Digest-SHA/src/sha.h @@ -5,8 +5,8 @@ * * Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved * - * Version: 6.00 - * Fri Dec 8 22:44:44 MST 2017 + * Version: 6.01 + * Mon Dec 25 00:08:08 MST 2017 * */ diff --git a/cpan/Digest-SHA/src/sha64bit.c b/cpan/Digest-SHA/src/sha64bit.c index 988a04ccf0..4d6e9dd404 100644 --- a/cpan/Digest-SHA/src/sha64bit.c +++ b/cpan/Digest-SHA/src/sha64bit.c @@ -5,8 +5,8 @@ * * Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved * - * Version: 6.00 - * Fri Dec 8 22:44:44 MST 2017 + * Version: 6.01 + * Mon Dec 25 00:08:08 MST 2017 * */ diff --git a/cpan/Digest-SHA/src/sha64bit.h b/cpan/Digest-SHA/src/sha64bit.h index f57d03cf0d..2b8dc55a9b 100644 --- a/cpan/Digest-SHA/src/sha64bit.h +++ b/cpan/Digest-SHA/src/sha64bit.h @@ -5,8 +5,8 @@ * * Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved * - * Version: 6.00 - * Fri Dec 8 22:44:44 MST 2017 + * Version: 6.01 + * Mon Dec 25 00:08:08 MST 2017 * * The following macros supply placeholder values that enable the * sha.c module to successfully compile when 64-bit integer types diff --git a/t/porting/customized.dat b/t/porting/customized.dat index 2efe884583..9c9b00ddad 100644 --- a/t/porting/customized.dat +++ b/t/porting/customized.dat @@ -3,29 +3,6 @@ # ./perl -I../lib porting/customized.t --regen Devel::PPPort dist/Devel-PPPort/parts/embed.fnc e030719d9c6921810554a8e2d398543348b4878c Digest cpan/Digest/Digest.pm 43f7f544cb11842b2f55c73e28930da50774e081 -Digest::SHA cpan/Digest-SHA/t/allfcns.t 9ee294dc3f6a1c6b6c8e9bf7e17a3100ab7f98e3 -Digest::SHA cpan/Digest-SHA/t/base64.t 092e88b25f56ae01dce42c3c073603c648ba8f55 -Digest::SHA cpan/Digest-SHA/t/bitbuf.t 2bbc0d301391affadba59152ca6c85c0e0900f09 -Digest::SHA cpan/Digest-SHA/t/bitorder.t e46044e2915895044933579f11c4801341ab1fdc -Digest::SHA cpan/Digest-SHA/t/fips180-4.t 9cd39dfedb5905a5693c9e97e00070db072a471e -Digest::SHA cpan/Digest-SHA/t/fips198.t 1482029f8f7dd4f000bbb34e9cbc09e1b3ae0893 -Digest::SHA cpan/Digest-SHA/t/gg.t e3bfaf58efb1dcc5aa7e26a889b600213c766c00 -Digest::SHA cpan/Digest-SHA/t/gglong.t 0ce33514b02891957fef68de2909b642cc06868f -Digest::SHA cpan/Digest-SHA/t/hmacsha.t d5f3f5ea89d63c4586fb7a22bbbf9e536e4fff99 -Digest::SHA cpan/Digest-SHA/t/inheritance.t 0b5953e9a2ef4aa9a1d6c09a828e806c5d39aa85 -Digest::SHA cpan/Digest-SHA/t/ireland.t 7c2c84aa8894022dc538b5d6dc86640d8ba75f4b -Digest::SHA cpan/Digest-SHA/t/methods.t 85ab0c185c3a0444ab68ea41178f4c169624f7c3 -Digest::SHA cpan/Digest-SHA/t/nistbit.t 345a5a54b853b8633eec5e73190322c0856506d6 -Digest::SHA cpan/Digest-SHA/t/nistbyte.t b12f6c887888bb7454ad09fba2c191467b4c001c -Digest::SHA cpan/Digest-SHA/t/rfc2202.t 521a1ab31f8ed2072d4d358c09670c016add1b99 -Digest::SHA cpan/Digest-SHA/t/sha1.t 608824b77e2a47ef8357d4b72ccc05990f89dc98 -Digest::SHA cpan/Digest-SHA/t/sha224.t 0b690d62c1b13610c57e87fe5d1c42d3919968dc -Digest::SHA cpan/Digest-SHA/t/sha256.t 8219d5d2c1561114f063eeba42ca2738637b3f5c -Digest::SHA cpan/Digest-SHA/t/sha384.t c21cd7de72060eb6f9ae4d9c30ae8d13d0a0b856 -Digest::SHA cpan/Digest-SHA/t/sha512.t bbe44c7cb600c29ef6763d0782b0aae0269ba5f3 -Digest::SHA cpan/Digest-SHA/t/state.t b7146b91d9dcc276c4e3c0c251794bf5f46c1dfa -Digest::SHA cpan/Digest-SHA/t/unicode.t f62768510104cde42af8544e04af722ee2cbb85e -Digest::SHA cpan/Digest-SHA/t/woodbury.t 1efec6fae3600f891d27f944d05d6e363444d9c8 Locale::Maketext::Simple cpan/Locale-Maketext-Simple/lib/Locale/Maketext/Simple.pm 57ed38905791a17c150210cd6f42ead22a7707b6 Math::Complex cpan/Math-Complex/lib/Math/Complex.pm 198ea6c6c584f5ea79a0fd7e9d411d0878f3b2af Math::Complex cpan/Math-Complex/t/Complex.t 4f307ed6fc59f1e5fb0e6b11103fc631b6bdb335 -- Perl5 Master Repository