Plaggerな世界に0.1歩ほど足を踏み入れるã§DateTime::Format::Mailãã¤ã³ã¹ãã¼ã«ã§ããªãã£ã件ã®ç¶ããã¿ã¤ãã«ãªãããªãã¾ãã
DateTime::Format::Mailãã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ã·ã°ããã£ã¨å®éã®ãã¡ã¤ã«ã®ããã·ã¥å¤ãä¸è´ããªãã¦ã¨ã©ã¼ãçºçããã¤ã³ã¹ãã¼ã«ã§ããªããã©ããt/sample_datesã¨ãããã¡ã¤ã«ã®ããã·ã¥å¤ããããããªããããããã°ãæç²ããã¨ä»¥ä¸ã®ãããªæãã
--- SIGNATURE 2003-10-22 00:22:33.000000000 +0900 +++ - 2006-05-31 19:28:17.000000000 +0900 ~ä¸ç¥~ -SHA1 ebb870712a24d7eb425c63ff8a438b7f1eddabb2 t/sample_dates +SHA1 7db435556975438402ca1156346325dcfd2f4dda t/sample_dates ~ä¸ç¥~ ==> MISMATCHED content between SIGNATURE and distribution files! <==
æå¾ ãããããã·ã¥å¤ã-SHA1ããã¯ãã¾ãè¡ã«è¡¨ç¤ºããã¦ãã¦ãè¨ç®ãããããã·ã¥å¤ã+SHA1ããã¯ãã¾ãè¡ã«è¡¨ç¤ºããã¦ããã
Module::Signatureã®ã½ã¼ã¹èªãã ããã¦ã¿ããã¡ã«ããã®ç¾è±¡ãåç¾ã§ãããåç¾ç¨ã³ã¼ãã¯ä»¥ä¸ãModule::Signaute 0.54ã§ãªãã¨åç¾ããªããçç±ã¯å¾è¿°ã
use strict; use Digest::SHA; my $infile = $ARGV[0]; # DateTime-Format-Mailã®SIGNATUREã¯SHA1 my $sha = Digest::SHA->new(1); # åç´ã«ããã·ã¥ãè¨ç® open SD, $infile; $sha->addfile(*SD); my $hd = $sha->hexdigest; print 'normal: '; print "$hd\n"; # ãªã»ãã $sha->reset; close SD; # Module-Signatureã§åããã¦ããæ¹æ³ã§è¨ç® open SD, $infile; # Module-Signature-0.54ã§ã¯éãã¤ããªãã¡ã¤ã«ã«ä»¥ä¸ã®å¦çãæ½ããã binmode(SD, ':crlf'); $sha->addfile(*SD); $hd = $sha->hexdigest; print 'binmode: '; print "$hd\n";
ããã¦ãå®è¡çµæã¯ä»¥ä¸ã
$ perl sha.pl t/sample_dates normal: ebb870712a24d7eb425c63ff8a438b7f1eddabb2 binmode: 7db435556975438402ca1156346325dcfd2f4dda
ã¤ã³ã¹ãã¼ã«æã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¨åæ§ã®ããã·ã¥å¤ãå¾ãããã
Module::Signatureã§éãã¤ããªãã¡ã¤ã«ã®ããã·ã¥ãè¨ç®ããã¨ãã«å®è¡ãããbimode(SD, ':crlf')ãæªãããã¦ããããã ããã®ã³ã¼ãã¯Module::Signatureã®ææ°ãã¼ã¸ã§ã³ã§ãã0.54ããç¾ããã³ã¼ããªã®ã§ãModule::Signatureãææ°ã§ç¡ãå ´åã¯DateTime::Format::Mailã¯ã¨ã©ã¼ãªãã¤ã³ã¹ãã¼ã«ãããã¨èããããã
ããããçåã§ããã®ã¯ãt/sample_datesæå¤ã®ãã¡ã¤ã«ã§ãã®ã¹ã¯ãªãããå®è¡ãã¦ãåãããã·ã¥å¤ãå¾ãããã¨ãããã¨ããã®t/sample_datesã«ã¯ãªã«ãããããã ãã¦ãããã©ã£ãã«\r\nãç´ãè¾¼ãã§ããããï¼ã¨ãããã¨ã§ã以ä¸ã試ãã¦ã¿ããããã¨ã
$ cat t/sample_dates | perl -n -e 'print "$.: $_" if /\r\n/' 10464: Mon 05 Mar 2001 04:30:10 +1100
10464è¡ç®ã«ãªãããããã¼ï¼ããã¯ããæå³çã«\r\nããµããã§ããã®ãã©ããããããªããã ãã©ãModule::Signatureã¨DateTime::Format::Mailã®ä¸å¹¸ãªçµã¿åããã¨è¨ãããããããæ¢åã®ãã®ã§ã¨ã©ã¼åºãã¦ãã ããModule::Signatureã¯ä¿®æ£å¿ è¦ãªãã§ã¯ã¨æã£ããã
ãªã«ã¯ã¨ããããt/sample_datesã¨ãããã¡ã¤ã«ãæ¹ããããã¦ãããããã¨ã¯ãªããããªã®ã§ãDateTime::Format::Mailãforce installããªã