{"thread":{"id":"56643","subject":"git send-email splits name with comma","startedAt":"2021-10-04T14:11:18Z","lastAt":"2021-10-04T23:55:24Z","messageCount":6,"participants":["Geert Uytterhoeven","Andreas Schwab","Junio C Hamano","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"437893","messageId":"CAMuHMdXuTqUu6-b0y6VSFbEz7HKdH6U+__n7B8JRnO_ZWNeeLQ@mail.gmail.com","threadId":"56643","inReplyTo":null,"subject":"git send-email splits name with comma","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2021-10-04T14:11:04Z","receivedAt":"2021-10-04T14:11:18Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"Hi all,\n\nIf the name of an email address contains a comma, it will be split\nincorrectly into multiple addresses.  A public example can be found\nat[1].  I originally say this with git 2.25.1, as packaged by my distro,\nbut I could reproduce it with the latest version from git:\n\n    $ git send-email  --to \"foo bar, geert <geert@linux-m68k.org>\"\n/tmp/dummy.patch\n    /tmp/dummy.patch\n    (mbox) Adding cc: Geert Uytterhoeven <geert@linux-m68k.org> from\nline 'From: Geert Uytterhoeven <geert@linux-m68k.org>'\n\n    From: Geert Uytterhoeven <geert@linux-m68k.org>\n    To: foo,\n            bar,\n            geert <geert@linux-m68k.org>\n    Subject: [PATCH] dummy test\n    Date: Mon,  4 Oct 2021 15:52:53 +0200\n    Message-Id: <git-2.33.0.610.3.git.geert@linux-m68k.org\n    X-Mailer: git-send-email 2.33.0.610.gcefe983a320c03d7\n    MIME-Version: 1.0\n    Content-Transfer-Encoding: 8bit\n\n        The Cc list above has been expanded by additional\n        addresses found in the patch commit message. By default\n        send-email prompts before sending whenever this occurs.\n        This behavior is controlled by the sendemail.confirm\n        configuration setting.\n\n        For additional information, run 'git send-email --help'.\n        To retain the current behavior, but squelch this message,\n        run 'git config --global sendemail.confirm auto'.\n\n    Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll):\n    OK. Log says:\n    Sendmail: /usr/sbin/sendmail -i foo bar geert@linux-m68k.org\n    From: Geert Uytterhoeven <geert@linux-m68k.org>\n    To: foo,\n            bar,\n            geert <geert@linux-m68k.org>\n    Subject: [PATCH] dummy test\n    Date: Mon,  4 Oct 2021 15:52:53 +0200\n    Message-Id: <git-2.33.0.610.3.git.geert@linux-m68k.org\n    X-Mailer: git-send-email 2.33.0.610.gcefe983a320c03d7\n    MIME-Version: 1.0\n    Content-Transfer-Encoding: 8bit\n\n    Result: OK\n\nSo \"foo bar, geert <geert@linux-m68k.org>\" is split in three parts,\nand /usr/sbin/sendmail (exim 4.93 in my case) will have sent the email to\n\"foo\" and \"bar\" (both  extended with my local non-public domain) and\n\"geert <geert@linux-m68k.org>\".\n\nThanks!\n\n[1] \"Enrico Weigelt, metux IT consult <lkml@metux.net>\" is split in 3 parts\n    https://lore.kernel.org/linux-gpio/c987d0bf744150ca05bd952f5f9e5fb3244d27b0.1633350340.git.geert+renesas@glider.be/raw\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n-- \nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"},{"id":"437898","messageId":"87r1d0svy4.fsf@igel.home","threadId":"56643","inReplyTo":"CAMuHMdXuTqUu6-b0y6VSFbEz7HKdH6U+__n7B8JRnO_ZWNeeLQ@mail.gmail.com","subject":"Re: git send-email splits name with comma","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2021-10-04T14:31:31Z","receivedAt":"2021-10-04T14:39:01Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Okt 04 2021, Geert Uytterhoeven wrote:\n\n> If the name of an email address contains a comma, it will be split\n> incorrectly into multiple addresses.\n\nIf you want to include a comma in the display-name part of an address,\nyou need to use the quoted-string form of the phrase.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"437923","messageId":"CAMuHMdUk5=sqFvy51nxv5g3UFPhQnZ-6dBOS=xVDWdTxuLKuRQ@mail.gmail.com","threadId":"56643","inReplyTo":"87r1d0svy4.fsf@igel.home","subject":"Re: git send-email splits name with comma","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2021-10-04T17:18:35Z","receivedAt":"2021-10-04T17:18:48Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"Hi Andreas,\n\nOn Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab <schwab@linux-m68k.org> wrote:\n> On Okt 04 2021, Geert Uytterhoeven wrote:\n> > If the name of an email address contains a comma, it will be split\n> > incorrectly into multiple addresses.\n>\n> If you want to include a comma in the display-name part of an address,\n> you need to use the quoted-string form of the phrase.\n\nAdding more quoting like:\n\n    git send-email --to \"\\\"foo bar, geert\\\" <geert@linux-m68k.org>\"\n\nindeed works.  But I feel git send-email could do better, given it already\nreceives the full email address in a single argv[] entry.\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n-- \nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"},{"id":"437931","messageId":"xmqqczokwrt9.fsf@gitster.g","threadId":"56643","inReplyTo":"CAMuHMdUk5=sqFvy51nxv5g3UFPhQnZ-6dBOS=xVDWdTxuLKuRQ@mail.gmail.com","subject":"Re: git send-email splits name with comma","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-04T18:47:14Z","receivedAt":"2021-10-04T18:47:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Geert Uytterhoeven <geert@linux-m68k.org> writes:\n\n> Hi Andreas,\n>\n> On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab <schwab@linux-m68k.org> wrote:\n>> On Okt 04 2021, Geert Uytterhoeven wrote:\n>> > If the name of an email address contains a comma, it will be split\n>> > incorrectly into multiple addresses.\n>>\n>> If you want to include a comma in the display-name part of an address,\n>> you need to use the quoted-string form of the phrase.\n>\n> Adding more quoting like:\n>\n>     git send-email --to \"\\\"foo bar, geert\\\" <geert@linux-m68k.org>\"\n>\n> indeed works.  But I feel git send-email could do better, given it already\n> receives the full email address in a single argv[] entry.\n\nSorry, but I do not quite follow.\n\nIf I were to send a message both to the list and to you, wouldn't\n\n    git send-email --to \"l-k@vger.k.org, geert <g@l-m68k.o>\"\n\na valid way to do so?\n"},{"id":"437939","messageId":"CAMuHMdVHuxzKv7z+oVnPXSBi8bLnGMZDcXdgtGR4N15UQttciQ@mail.gmail.com","threadId":"56643","inReplyTo":"xmqqczokwrt9.fsf@gitster.g","subject":"Re: git send-email splits name with comma","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2021-10-04T19:56:59Z","receivedAt":"2021-10-04T19:57:13Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"Hi Junio,\n\nOn Mon, Oct 4, 2021 at 8:47 PM Junio C Hamano <gitster@pobox.com> wrote:\n> Geert Uytterhoeven <geert@linux-m68k.org> writes:\n> > On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab <schwab@linux-m68k.org> wrote:\n> >> On Okt 04 2021, Geert Uytterhoeven wrote:\n> >> > If the name of an email address contains a comma, it will be split\n> >> > incorrectly into multiple addresses.\n> >>\n> >> If you want to include a comma in the display-name part of an address,\n> >> you need to use the quoted-string form of the phrase.\n> >\n> > Adding more quoting like:\n> >\n> >     git send-email --to \"\\\"foo bar, geert\\\" <geert@linux-m68k.org>\"\n> >\n> > indeed works.  But I feel git send-email could do better, given it already\n> > receives the full email address in a single argv[] entry.\n>\n> Sorry, but I do not quite follow.\n>\n> If I were to send a message both to the list and to you, wouldn't\n>\n>     git send-email --to \"l-k@vger.k.org, geert <g@l-m68k.o>\"\n>\n> a valid way to do so?\n\nOh wait, I never realized --to and --cc take multiple email addresses;\nI also use multiple --to/--cc options instead.\nSo the behavior I see is actually the expected behavior.\nThanks, and sorry for the noise.\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n-- \nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"},{"id":"437948","messageId":"87pmskl508.fsf@evledraar.gmail.com","threadId":"56643","inReplyTo":"CAMuHMdVHuxzKv7z+oVnPXSBi8bLnGMZDcXdgtGR4N15UQttciQ@mail.gmail.com","subject":"Re: git send-email splits name with comma","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-10-04T23:47:36Z","receivedAt":"2021-10-04T23:55:24Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Oct 04 2021, Geert Uytterhoeven wrote:\n\n> Hi Junio,\n>\n> On Mon, Oct 4, 2021 at 8:47 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> Geert Uytterhoeven <geert@linux-m68k.org> writes:\n>> > On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab <schwab@linux-m68k.org> wrote:\n>> >> On Okt 04 2021, Geert Uytterhoeven wrote:\n>> >> > If the name of an email address contains a comma, it will be split\n>> >> > incorrectly into multiple addresses.\n>> >>\n>> >> If you want to include a comma in the display-name part of an address,\n>> >> you need to use the quoted-string form of the phrase.\n>> >\n>> > Adding more quoting like:\n>> >\n>> >     git send-email --to \"\\\"foo bar, geert\\\" <geert@linux-m68k.org>\"\n>> >\n>> > indeed works.  But I feel git send-email could do better, given it already\n>> > receives the full email address in a single argv[] entry.\n>>\n>> Sorry, but I do not quite follow.\n>>\n>> If I were to send a message both to the list and to you, wouldn't\n>>\n>>     git send-email --to \"l-k@vger.k.org, geert <g@l-m68k.o>\"\n>>\n>> a valid way to do so?\n>\n> Oh wait, I never realized --to and --cc take multiple email addresses;\n> I also use multiple --to/--cc options instead.\n> So the behavior I see is actually the expected behavior.\n> Thanks, and sorry for the noise.\n>\n> Gr{oetje,eeting}s,\n\nFWIW git-send-email just defers to Perl's Mail::Address module here:\n\nperl -MMail::Address -MData::Dumper -wE 'warn qq[For @ARGV got: ] .\n     Dumper [map { $_->format } map { Mail::Address->parse($_) } @ARGV]\n' 'foo, bar <x@example.com>'\nFor foo, bar <x@example.com> got: $VAR1 = [\n          'foo',\n          'bar <x@example.com>'\n        ];\n\nAs has been noted the quotes are needed, and the same should go for yor\nmailer.\n\nAnyway, that's covered already, but if anyone cared to make it\nfriendlier I don't see why it couldn't be made to be nicer.\n\nI.e. we could loop over the list, use $_->address to see that the \"foo\"\ndoesn't even have an \"@\" in it, and either fix it up to what th user\nprobably meant, or do so conditionally, warn or whatever.\n"}]}