[Mimedefang] utf-8 issue?

Bill Cole mdlist-20140424 at billmail.scconsult.com
Wed Dec 13 20:37:36 EST 2017


On 13 Dec 2017, at 16:39, Dianne Skoll wrote:

> On Wed, 13 Dec 2017 16:28:58 -0500
> "Bill Cole" <mdlist-20140424 at billmail.scconsult.com> wrote:
>
>> Unfortunately, I tested a bit more and found that bug is still extant
>> in 5.509, when tested with the one-liner in that bug report.
>
> That "bug" is a WONTFIX.

Fair enough. I guess the answer to that specific bug report is in fact 
"DON'T DO THAT!"

However, I was wondering how "Invalid Argument" was spitting out in that 
particular place with 2 possibly different root causes, so I spent some 
of my copious free time in the perl debugger and came up with this patch 
(also added to the bug ticket):

--- Body.pm.old	2017-04-05 12:55:57.000000000 -0400
+++ Body.pm.new	2017-12-13 19:04:27.000000000 -0500
@@ -139,6 +139,7 @@
  ### System modules:
  use Carp;
  use IO::File;
+use IO::Scalar;

  ### The package version, both in 1.23 style *and* usable by MakeMaker:
  $VERSION = "5.509";
@@ -522,7 +523,7 @@
  	    die "bad mode: $mode";
      }

-    return IO::File->new(\ $self->{MBS_Data}, $mode);
+    return IO::Scalar->new(\ $self->{MBS_Data}, $mode);
  }

It is unclear to me how the original ever failed to fail, since 
IO::File->new() really wants a filename or nothing and 
MIME::Body->{MBS_Data} isn't a filename. With that patch and a slightly 
modified one-liner (redirecting stderr because it emits a non-fatal 
""Wide character in print"" warning) I get success:

    bigsky:~ root# perl -MMIME::Entity \
   >    -e 'MIME::Entity->build( Data => "\x{1f4a9}\n" )->print' \
   >    2>/dev/null && echo "Success!"
    Content-Type: text/plain
    Content-Disposition: inline
    Content-Transfer-Encoding: binary
    MIME-Version: 1.0
    X-Mailer: MIME-tools 5.509 (Entity 5.509)

    💩
    Success!

(I'm bracing for either a terse tutorial on how That's Not How This All 
Works or a terser "Wrong!")




More information about the MIMEDefang mailing list