Package: mhonarc Version: 2.6.19-2 Severity: normal Tags: patch upstream Dear Maintainer,
Consider the attached UUCP-style mbox, where for each message the byte-length of its body is indicated with a Content-Length: header. The ‘-conlen’ [0] flag is meant to make MHonArc read the correct body length and remove the need for unescaping lines starting with “From: ”. This works well except when it's the *last* line that starts with “From: ”. $ mhonarc -conlen -outdir /tmp/out - </tmp/test.mbox This is MHonArc v2.6.19+, Perl 5.030003 linux Converting messages to /tmp/out Reading - .. Warning: Could not parse date for message Message-Id: <d41d8cd98f00b204e9800998ecf84...@no-id-found.mhonarc.org> Date: . Writing mail ... Writing /tmp/out/maillist.html ... Writing /tmp/out/threads.html ... Writing database ... 3 new messages 3 total messages $ grep X-Message-Id /tmp/out/msg*.html /tmp/out/msg00000.html:<!--X-Message-Id: f...@example.net --> /tmp/out/msg00001.html:<!--X-Message-Id: d41d8cd98f00b204e9800998ecf8427e@NO-ID-FOUND.mhonarc.org --> /tmp/out/msg00002.html:<!--X-Message-Id: b...@example.net --> That's because MHonArc slurps “bogus” lines after after the message with # Slurp up bogus data if required (should I do this?) while (!/$FROM/o && !eof($handle)) { $_ = <$handle>; } where $_ is initially set to the last body line… (By that loop is AFAICT required to read “\nFrom …\n”.) The fix is use a post condition instead: $ mhonarc -conlen -outdir /tmp/out - </tmp/test.mbox This is MHonArc v2.6.19+, Perl 5.030003 linux Converting messages to /tmp/out Reading - .. Writing mail .. Writing /tmp/out/maillist.html ... Writing /tmp/out/threads.html ... Writing database ... 2 new messages 2 total messages $ grep X-Message-Id /tmp/out/msg*.html /tmp/out/msg00000.html:<!--X-Message-Id: f...@example.net --> /tmp/out/msg00001.html:<!--X-Message-Id: b...@example.net --> Cheers, -- Guilhem. [0] https://www.mhonarc.org/MHonArc/doc/resources/conlen.html
test.mbox
Description: application/mbox
--- mhonarc-2.6.19/lib/mhamain.pl +++ mhonarc-2.6.19/lib/mhamain.pl @@ -1017,9 +1017,9 @@ } } # Slurp up bogus data if required (should I do this?) - while (!/$FROM/o && !eof($handle)) { + do { $_ = <$handle>; - } + } while (!/$FROM/o && !eof($handle)); } else { # No content-length while (<$handle>) {
signature.asc
Description: PGP signature