user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Cc: bug-Mail-Thread@rt.cpan.org, meta@public-inbox.org
Subject: libmail-thread-perl: [PATCH] avoid failing grouping by subject with missing references
Date: Mon, 17 Aug 2015 21:35:26 +0000	[thread overview]
Message-ID: <20150817213526.458.81766.reportbug@dcvr.yhbt.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

Package: libmail-thread-perl
Version: 2.55-1
Severity: normal
Tags: upstream patch

Dear Maintainer,

With incomplete threads, It is possible to for the topmost subroutine to
return undef, so do not blindy assume the simple_subject call will be
made on a Mail::Thread::Container object.

Attached is a patch which avoids the issue by skipping as if the
subject were empty.

Note: upstream hasn't been responsive in years, but Cc-ing the RT
address at CPAN just in case.

-- System Information:
Debian Release: 7.8
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
-- no debconf information


[-- Attachment #2: 0001-avoid-failing-grouping-by-subject-with-missing-refer.patch --]
[-- Type: text/x-diff, Size: 1465 bytes --]

>From 9d1837f2118efa614d1acddd09ea7f53aba15ba4 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Mon, 17 Aug 2015 21:16:25 +0000
Subject: [PATCH] avoid failing grouping by subject with missing references

It is possible to for the topmost subroutine to return
undef, so do not blindy assume the simple_subject call
will be made on a Mail::Thread::Container object.
---
 Thread.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Thread.pm b/Thread.pm
index c6f3230..941ae31 100644
--- a/Thread.pm
+++ b/Thread.pm
@@ -70,7 +70,8 @@ sub _group_set_bysubject {
 
     my %subject;
     for (my $walk = $root->child; $walk; $walk = $walk->next) {
-        my $sub = $walk->topmost->simple_subject or next;
+        my $topmost = $walk->topmost or next;
+        my $sub = $topmost->simple_subject or next;
         # Add this container to the hash if:
         # - There is no container in the hash with this subject, or
         # - This one is a dummy container and the old one is not: the dummy
@@ -97,7 +98,8 @@ sub _group_set_bysubject {
     for ($walk = $root->child, $rest = eval{ $walk->next };
          $walk;
          $prev = $walk, $walk = $rest, $rest = eval { $rest->next }) {
-        my $subj = $walk->topmost->simple_subject or next;
+        my $topmost = $walk->topmost or next;
+        my $subj = $topmost->simple_subject or next;
         my $old = $subject{$subj};
         next if $old == $walk;
 
-- 
EW



             reply	other threads:[~2015-08-17 21:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <RT-Ticket-106498@rt.cpan.org>
2015-08-17 21:35 ` Eric Wong [this message]
     [not found]   ` <rt-4.0.18-6738-1439849660-1489.106498-3-0@rt.cpan.org>
2015-08-18  1:27     ` [rt.cpan.org #106498] AutoReply: libmail-thread-perl: [PATCH] avoid failing grouping by subject with missing references Eric Wong
     [not found]   ` <handler.795913.B.143984774816522.ack@bugs.debian.org>
2015-08-18  1:29     ` Bug#795913: Acknowledgement (libmail-thread-perl: [PATCH] avoid failing grouping by subject with missing references) Eric Wong
2016-04-23 20:23       ` libmail-thread-perl: [PATCH] avoid failing grouping by subject with missing references Eric Wong

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=20150817213526.458.81766.reportbug@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=bug-Mail-Thread@rt.cpan.org \
    --cc=meta@public-inbox.org \
    --cc=submit@bugs.debian.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).