git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH RFC] mailmap: fix check-mailmap with full mailmap line

From
Jacob Keller <jacob.keller@gmail.com>
Date
Feb 15, 2025, 00:24 UTC
Message-ID
<CA+P7+xr4EaTqSw0vqpJz17iF9gMFqhAt_6rvTsv+49mrWYntDw@mail.gmail.com>
In-Reply-To
<xmqqwmdtmmsl.fsf@gitster.g>
On Thu, Feb 13, 2025 at 3:45 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 44 quoted lines
>
> Jacob Keller <jacob.e.keller@intel.com> writes:
>
> > I recently had reported to me a crash from a coworker using the recently
> > added sendemail mailmap support:
> >
> >   3724814 Segmentation fault      (core dumped) git check-mailmap "bugs@company.xx"
>
> Thanks for relaying the report.
>
> I can easily reproduce your segfault with our own mailmap, by
> picking at random an entry with both name and e-mail listed as
> the mapping source, e.g.
>
>     $ git check-mailmap ksaitoh560@gmail.com
>
> > With a mailmap file containing:
> >
> > A <a@domain.com> B <b@domain.com>
> >
> > I get the following unexpected result:
> >
> > $ git check-mailmap b@domain.com
> > <b@domain.com>
> >
> > Based on my interpretation of the mailmap documentation, I would have
> > expected this to translate to "A <a@domain.com>".
>
> After reading "git help mailmap" twice, my interpretation is
> different (disclaimer: I haven't read the implementation of the
> mailmap code lately, and the last time I read any part of it is
> probably at least a few years ago if not before).
>
> Unlike "please map anybody with this e-mail address to 'A <a>'"
> entry, which is spelled "A <a> <b>", the "fully spelled" form limits
> the damage to those that match both name and e-mail, in order to
> avoid "D <b>" from getting modified, while rewriting "B <b>" to "A
> <a>".  So I would not expect a request with no name to be mapped at
> all.
>
> And the command emits the e-mail intact when it does not find any
> match, "b@domain.com" being answered by "<b@domain.com>" is quite
> expected from my point of view.
>

Re-reading the manual, that is a fair interpretation. I can share that with my coworker and he can adapt his mailmap to match this expectation I think.

In that case, I think the simple fix is to just replace the NULL with a "" to resolve the segmentation fault and add a suitable test case for that?

Thanks, Jake

> Thanks.
Previous: Junio C Hamano
Message 3 of 3 in “mailmap: fix check-mailmap with full mailmap line”
  1. mailmap: fix check-mailmap with full mailmap lineJacob Keller, Feb 13, 2025
  2. Junio C HamanoFeb 13, 2025
  3. Jacob KellerFeb 15, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.