unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: Ali Alnubani <alialnu@nvidia.com>
Cc: meta@public-inbox.org
Subject: [PATCH] eml: fix undefined vars on <Perl 5.28
Date: Sat, 26 Dec 2020 12:25:42 +0000	[thread overview]
Message-ID: <20201226122542.GA24392@dcvr> (raw)
In-Reply-To: <DM6PR12MB49106F8E3BD697B63B943A22DADB0@DM6PR12MB4910.namprd12.prod.outlook.com>

Ali Alnubani <alialnu@nvidia.com> wrote:
> Hi,
> 
> I see errors similar to the following in Debian 9 (stretch) with Perl 5.24:
> """
> Use of uninitialized value in subroutine entry at /usr/lib/x86_64-linux-gnu/perl5/5.24/Encode/MIME/Header.pm line 198.

Thanks for the bug report, it looks like the default was only
applied in top-level Encode::decode() wrapper and not the
per-object ->decode callbacks which we use with find_encoding().

(separate patch coming for the t/config.t fix)

-----------8<-----------
Subject: [PATCH] eml: fix undefined vars on <Perl 5.28

Encode::MIME::Header::_decode_octets did not correctly default
to Encode::FB_DEFAULT until Encode 2.93 (perl5.git commit
0c541dc5633a341cf44b818014b58e7f8be532e9).  Provide the default
again to work with older Perls.

Reported-by: Ali Alnubani <alialnu@nvidia.com>
Link: https://public-inbox.org/meta/DM6PR12MB49106F8E3BD697B63B943A22DADB0@DM6PR12MB4910.namprd12.prod.outlook.com/
---
 lib/PublicInbox/Eml.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm
index 571edc5c..4d3fffc0 100644
--- a/lib/PublicInbox/Eml.pm
+++ b/lib/PublicInbox/Eml.pm
@@ -378,7 +378,9 @@ sub header_str_set {
 	header_set($self, $name, @vals);
 }
 
-sub mhdr_decode ($) { eval { $MIME_Header->decode($_[0]) } // $_[0] }
+sub mhdr_decode ($) {
+	eval { $MIME_Header->decode($_[0], Encode::FB_DEFAULT) } // $_[0];
+}
 
 sub filename {
 	my $dis = header_raw($_[0], 'Content-Disposition');

  reply	other threads:[~2020-12-26 12:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26 11:27 [Debian 9][Perl 5.24] uninitialized value errors in Encode/MIME/Header.pm Ali Alnubani
2020-12-26 12:25 ` Eric Wong [this message]
2020-12-26 14:10   ` [PATCH] eml: fix undefined vars on <Perl 5.28 Ali Alnubani
2020-12-26 20:35     ` stable 1.6.1 release? [was: [PATCH] eml: fix undefined vars on <Perl 5.28] Eric Wong
2020-12-31  0:06       ` Eric Wong
2020-12-26 12:30 ` [PATCH] t/config: test --get-urlmatch for git <2.26 Eric Wong
2020-12-26 14:12   ` Ali Alnubani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201226122542.GA24392@dcvr \
    --to=e@80x24.org \
    --cc=alialnu@nvidia.com \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).