Skip to content

Possible unparsable subject line #6

Description

@davehayes

Consider the following code snippet:

    my $env = $imap->get_envelope($uid); # <<< Here is where the trouble begins
    unless (defined($env)) {
      warn "Unable to get envelope for uid $uid: " . $imap->LastError . ", trying fetch now.\n";
      try {
        my $out = $imap->fetch($uid, "ENVELOPE"); # <<< Trying to do what the lower level code does
        die "Nothing returned by fetch\n" unless (defined($out) && length($out) > 0);

        elapsed("ENVELOPE: " . Dumper($out));  # from Data::Dumper

        my $class = $imap->_load_module("BodyStructure") or die "Cannot load this body class\n";
        $class .= "::Envelope";
        my $ob2 = $class->new($out);
        print "No caught error from '$class': " . Dumper($ob2);
      } catch {
        print "WHOOPS: $@\n";
      }
    }

This prints the following:

Unable to get envelope for uid 264209: , trying fetch now.
[ 0.0608s] - ENVELOPE: $VAR1 = [
          '6 UID FETCH 264209 ENVELOPE',
          '* 262059 FETCH (UID 264209 ENVELOPE ("Sat, 2 Sep 2023 00:35:34 -0700" ',
          'Re: [Bug 273506] main [so: 15] aarch64 kyua python use fails with: . . . and dlerror is reporting "/usr/lib/ossl-modules/legacy.so: Undefined symbol \\"MD4_Update\\"", \'\\000\' <repeats 449 times>',
          ' (("Mark Millard" NIL "marklmi" "yahoo.com")) ((NIL NIL "owner-freebsd-arm" "freebsd.org")) (("Mark Millard" NIL "marklmi" "yahoo.com")) (("freebsd-arm" NIL "freebsd-arm" "freebsd.org")("Current FreeBSD" NIL "freebsd-current" "freebsd.org")) NIL NIL NIL "<721EBF15-6905-437E-9B23-A4E3D1129658@yahoo.com>"))
',
          '6 OK Fetch completed (0.001 + 0.000 secs).
'
        ];

No caught error from 'Mail::IMAPClient::BodyStructure::Envelope': $VAR1 = undef;

Here's a link to the message that caused this behavior

From my admittedly brief glance at this code, it seems the parser failed on that Subject line which is what produces the undef. I see a note to the effect of "there is not much point in debugging " and I know these are a pain to debug. Thus I have no expectations from filing this issue. However, someone responsible should at least know about the issue. Also, if I have committed some egregious software error then constructive criticism is warmly encouraged. :)

The software that uses this otherwise fine module will let the examples sit there forever, so I remain available to help debug a fix, should that fix ever appear.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions