GNU bug report logs - #63378
A single X-Debbugs-CC header must be used

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 8 May 2023 17:18:02 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: bug#63378: closed (Re: bug#63378: [PATCH] teams: Fix script to
 produce a single X-Debbugs-Cc header.)
Date: Thu, 11 May 2023 13:19:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#63378: A single X-Debbugs-CC header must be used

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 63378 <at> debbugs.gnu.org.

-- 
63378: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63378
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: rekado <at> elephly.net, 63378-done <at> debbugs.gnu.org
Subject: Re: bug#63378: [PATCH] teams: Fix script to produce a single
 X-Debbugs-Cc header.
Date: Thu, 11 May 2023 09:18:46 -0400
Hi Arun,

Arun Isaac <arunisaac <at> systemreboot.net> writes:

> Hi Maxim,
>
> Thank you for the updated patch! :-) It LGTM. Please push.
>
>> OK!  I opted for simplicity and double-quoted all the names.
>
> Fair enough. Though a check is only one condition away! ;-)
>
> (if (string-contains? (person-name member) ",")
>     (string-append "\"" (person-name member) "\"")
>     (person-name member))

It's string-contains without ?, apparently.  Let's try this (and save a
few bytes per submission :-)):

--8<---------------cut here---------------start------------->8---
modified   etc/teams.scm.in
@@ -618,7 +618,11 @@ (define (sort-members members)

 (define (member->string member)
   "Return the 'email <name>' string representation of MEMBER."
-  (format #false "\"~a\" <~a>" (person-name member) (person-email member)))
+  (let* ((name (person-name member))
+         (quoted-name/maybe (if (string-contains name ",")
+                                (string-append "\"" name "\"")
+                                name)))
+    (format #false "~a <~a>" quoted-name/maybe (person-email member))))

 (define* (list-members team #:optional port (prefix ""))
   "Print the members of the given TEAM."
--8<---------------cut here---------------end--------------->8---

The change is now installed; thanks for the review!

-- 
Thanks,
Maxim

[Message part 3 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Subject: A single X-Debbugs-CC header must be used
Date: Mon, 08 May 2023 13:17:40 -0400
Hi,

After some tests, it appears that a single X-Debbugs-CC header must be
used, otherwise the last one is the one that prevails.  This matches my
reading of the 'process' script of the GNU Debbugs instance [0], and
thus must conform to the same email rules outlined in RFC5322 for the To
or CC fields (only one such header must be used); multiple values can be
separated by a comma. [1]

--8<---------------cut here---------------start------------->8---
my %header;

for my $hdr (@headerlines) {
    $hdr = decode_rfc1522($hdr);
    $_ = $hdr;
    s/\n\s/ /g;
    &finish if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
    my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
           && !m/^From / && !m/^X-Debbugs-/i && !m/^cc:/i && !m/^to:/i;
    $fwd .= $hdr."\n" if $ins;
    # print DEBUG ">$_<\n";
    if (s/^(\S+):\s*//) {
	my $v = lc $1;
	print DEBUG ">$v=$_<\n";
        ## There may be multiple To: or Cc: headers (see bug#5996).
        if ( ($v eq 'to' || $v eq 'cc') &&
	     defined $header{$v} && length($header{$v}) ) {
            $header{$v} = $header{$v} . ', ' . $_ if length($_);
        } else {
            $header{$v} = $_;
        }
    } else {
	print DEBUG "!>$_<\n";
    }
}
$header{'message-id'} = '' if not defined $header{'message-id'};
--8<---------------cut here---------------end--------------->8---

Only 'to' or 'cc' multiple headers are coalesced into one; otherwise the
$header specific key (for a given header) is overridden to the last
value encountered at line '$header{$v} = $_;', IIUC.

Our teams.scm script should be adjusted to produce a single X-Debbugs-CC
header with comma-separated values.

[0]  https://gitlab.com/npostavs/debbugs/-/blob/gnu-reconstruction/scripts/process#L171
[1]  https://datatracker.ietf.org/doc/rfc5322/, 3.6 Field Definitions

-- 
Thanks,
Maxim



This bug report was last modified 2 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.