guile-email discussion
 help / color / mirror / Atom feed
* Mumi inserts spurious underscore in bug title
@ 2022-12-24 22:53 Ricardo Wurmus
  2022-12-29 19:36 ` Arun Isaac
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2022-12-24 22:53 UTC (permalink / raw)
  To: 49115; +Cc: guile-email

> See http://issues.guix.gnu.org/49114, which Mumi currently 
> titles
>
>   ‘guix_ lint’ should catch certificate validation exceptions
>
> There's no underscore in the original subject.

The debbugs “.log” file for issue 49114 contains this line:

  Subject: bug#49114: =?UTF-8?Q?=E2=80=98guix_?= =?UTF-8?Q?lint=E2=80=99?= should catch certificate validation exceptions

This is MIME Q encoding (similar to “quoted printable” encoding), as
specified in RFC 2047.

The underscore is mentioned in 4.2 (2):

   (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
       represented as "_" (underscore, ASCII 95.).  (This character may
       not pass through some internetwork mail gateways, but its use
       will greatly enhance readability of "Q" encoded data with mail
       readers that do not support this encoding.)  Note that the "_"
       always represents hexadecimal 20, even if the SPACE character
       occupies a different code position in the character set in use.

So, the underscore above ought to be replaced with a space.  This seems
to be a bug in guile-email.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mumi inserts spurious underscore in bug title
  2022-12-24 22:53 Mumi inserts spurious underscore in bug title Ricardo Wurmus
@ 2022-12-29 19:36 ` Arun Isaac
  2023-01-01 12:15   ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: Arun Isaac @ 2022-12-29 19:36 UTC (permalink / raw)
  To: Ricardo Wurmus, 49115; +Cc: guile-email


Hi Ricardo,

Thanks for the bug report!

It's very strange, but I'm not able to reproduce this. I tried the
following. bug_49114.mbox is downloaded from
https://debbugs.gnu.org/cgi/bugreport.cgi?mbox=yes;bug=49114

--8<---------------cut here---------------start------------->8---
(use-modules (email email))

(pk
 (parse-email-headers "Subject: bug#49114: =?UTF-8?Q?=E2=80=98guix_?= =?UTF-8?Q?lint=E2=80=99?= should catch certificate validation exceptions
"))

(for-each (lambda (bv)
            (pk (assoc-ref (email-headers (parse-email bv))
                           'subject)))
          (call-with-input-file "bug_49114.mbox"
            mbox->emails))
--8<---------------cut here---------------end--------------->8---

Even at https://issues.guix.gnu.org/49114 , only the "bug title" has the
spurious underscore. The subject of the first message does not. Is the
bug title something stored in the xapian index? Could it be that this
was an older bug that has corrupted the xapian index?

If I understand correctly, mumi does not rebuild its xapian index. I
think it should do so from time to time. It would help prevent old bugs
from getting persisted in storage.

Cheers, and wish you a Happy New Year! :-)
Arun


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mumi inserts spurious underscore in bug title
  2022-12-29 19:36 ` Arun Isaac
@ 2023-01-01 12:15   ` Ricardo Wurmus
  2023-01-02 17:43     ` [PATCH 0/1] Do not check for MIME encoded words Arun Isaac
  2023-01-02 17:43     ` [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject Arun Isaac
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2023-01-01 12:15 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 49115-done, guile-email


Hi Arun,

> Thanks for the bug report!
>
> It's very strange, but I'm not able to reproduce this.

Thank you for your analysis!

> Even at https://issues.guix.gnu.org/49114 , only the "bug title" has the
> spurious underscore. The subject of the first message does not. Is the
> bug title something stored in the xapian index? Could it be that this
> was an older bug that has corrupted the xapian index?

As part of #60410 I rebuilt the xapian database (deleted it and then ran
“mumi fetch”), so it’s not that.

[… time passes …]

I think I found the culprit in mumi/debbugs.scm:

    (define qp-pattern "=\\?UTF-8\\?Q\\?([^?]+)\\?=")
    …
    (let ((subject (or (assoc-ref properties "Subject") "")))
      (if (string-contains subject "=?UTF-8?Q?")
          (or (false-if-exception
               (utf8->string
                (quoted-printable-decode
                 (regexp-substitute/global #f qp-pattern
                                           subject 'pre 1 'post))))
              subject)
          subject))

I’m probably not using quoted-printable-decode correctly.  My apologies
for assuming a bug in Guile Email.  I changed this with commit
9d7eb3c5efe6427a1a89fb3e4c7165259edff4dd, using parse-email-headers.

> If I understand correctly, mumi does not rebuild its xapian index. I
> think it should do so from time to time. It would help prevent old bugs
> from getting persisted in storage.

True.  I’ll be sure to rebuild the index on the next upgrade.

> Cheers, and wish you a Happy New Year! :-)

Thank you, and a Happy New Year to you too!

-- 
Ricardo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/1] Do not check for MIME encoded words
  2023-01-01 12:15   ` Ricardo Wurmus
@ 2023-01-02 17:43     ` Arun Isaac
  2023-01-02 17:43     ` [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject Arun Isaac
  1 sibling, 0 replies; 6+ messages in thread
From: Arun Isaac @ 2023-01-02 17:43 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Arun Isaac, 49115-done, guile-email

Hi Ricardo,

I have an additional small improvement. guile-email transparently
handles MIME encoded words. We need not check for them. Patch follows.

Regards,
Arun

Arun Isaac (1):
  debbugs: Do not check for MIME encoded words in subject.

 mumi/debbugs.scm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject.
  2023-01-01 12:15   ` Ricardo Wurmus
  2023-01-02 17:43     ` [PATCH 0/1] Do not check for MIME encoded words Arun Isaac
@ 2023-01-02 17:43     ` Arun Isaac
  2023-01-02 19:34       ` Ricardo Wurmus
  1 sibling, 1 reply; 6+ messages in thread
From: Arun Isaac @ 2023-01-02 17:43 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Arun Isaac, 49115-done, guile-email

guile-email transparently handles MIME encoded words. We do not have
to check for them.

* mumi/debbugs.scm (bug-status): Do not check for MIME encoded words
in subject.
---
 mumi/debbugs.scm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mumi/debbugs.scm b/mumi/debbugs.scm
index 16bff8e..7e95ddf 100644
--- a/mumi/debbugs.scm
+++ b/mumi/debbugs.scm
@@ -1,5 +1,6 @@
 ;;; mumi -- Mediocre, uh, mail interface
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2023 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This program is free software: you can redistribute it and/or
 ;;; modify it under the terms of the GNU Affero General Public License
@@ -280,10 +281,10 @@ defaults to 30 days."
                      (assoc-ref properties "Submitter")
                      (assoc-ref properties "Owner")
                      (or (assoc-ref properties "Severity") "normal")
-                     (let ((subject (or (assoc-ref properties "Subject") "")))
-                       (if (string-contains subject "=?UTF-8?Q?")
-                           (match (parse-email-headers (string-append "Subject: " subject "\n"))
-                             ((('subject . sub) . rest) sub)
-                             (other subject))
-                           subject))
+                     (assq-ref
+                      (parse-email-headers
+                       (string-append "Subject: "
+                                      (or (assoc-ref properties "Subject") "")
+                                      "\n"))
+                      'subject)
                      (assoc-ref properties "Tags"))))
-- 
2.38.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject.
  2023-01-02 17:43     ` [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject Arun Isaac
@ 2023-01-02 19:34       ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2023-01-02 19:34 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 49115-done, guile-email


Arun Isaac <arunisaac@systemreboot.net> writes:

> guile-email transparently handles MIME encoded words. We do not have
> to check for them.
>
> * mumi/debbugs.scm (bug-status): Do not check for MIME encoded words
> in subject.

Thank you, I applied it.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-02 19:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24 22:53 Mumi inserts spurious underscore in bug title Ricardo Wurmus
2022-12-29 19:36 ` Arun Isaac
2023-01-01 12:15   ` Ricardo Wurmus
2023-01-02 17:43     ` [PATCH 0/1] Do not check for MIME encoded words Arun Isaac
2023-01-02 17:43     ` [PATCH 1/1] debbugs: Do not check for MIME encoded words in subject Arun Isaac
2023-01-02 19:34       ` Ricardo Wurmus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox