{"thread":{"id":"44107","subject":"Homebrew and Git","startedAt":"2016-09-18T15:50:35Z","lastAt":"2016-09-23T04:38:04Z","messageCount":10,"participants":["Jonas Thiel","Heiko Voigt","John Keeping","Jeff King","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"302115","messageId":"trinity-9c8f1bd1-d6be-48f3-8575-03be09bd1243-1474213828361@3capp-gmx-bs53","threadId":"44107","inReplyTo":null,"subject":"Homebrew and Git","fromName":"Jonas Thiel","fromEmail":"jonas.lierschied@gmx.de","sentAt":"2016-09-18T15:50:28Z","receivedAt":"2016-09-18T15:50:35Z","isPatch":false,"sender":{"key":"jonas.lierschied@gmx.de","avatar":null},"body":"Dear Sir or Madame,\n \nA while ago I have described my problem with Homebrew at the following GitHub channel (https://github.com/Homebrew/homebrew-core/issues/2970). In the meanwhile, I believe that I my problem with Homebrew is based on an issues with my Git. I have found the attached Git Crash reports on my Mac and because I am not familiar with reading/analysing Crash Reports, it would be great if someone could give me some feedback on it.\n \nIf you have any question, please do not hesitate to contact me.\n \nThanks a lot in advance and best regards,\nJonas"},{"id":"302220","messageId":"20160920110700.GB64315@book.hvoigt.net","threadId":"44107","inReplyTo":"20160920110228.GA64315@book.hvoigt.net","subject":"Re: Re: Homebrew and Git","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2016-09-20T11:07:00Z","receivedAt":"2016-09-20T11:08:24Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Tue, Sep 20, 2016 at 01:02:28PM +0200, Heiko Voigt wrote:\n> Hi,\n> \n> On Sun, Sep 18, 2016 at 05:50:28PM +0200, Jonas Thiel wrote:\n> > A while ago I have described my problem with Homebrew at the following\n> > GitHub channel\n> > (https://github.com/Homebrew/homebrew-core/issues/2970). In the\n> > meanwhile, I believe that I my problem with Homebrew is based on an\n> > issues with my Git. I have found the attached Git Crash reports on my\n> > Mac and because I am not familiar with reading/analysing Crash\n> > Reports, it would be great if someone could give me some feedback on\n> > it.\n> >  \n> > If you have any question, please do not hesitate to contact me.\n> \n> From your crash reports I see that git is apparently crashing in a\n> strchr() call from within ident_default_email() which is a function that\n> tries to assemble a name and email to put into your commits.\n\nBTW, here is the callstack inlined from the crashreport:\n\nbsystem_platform.dylib      \t0x00007fff840db41c _platform_strchr$VARIANT$Haswell + 28\n1   git                           \t0x000000010ba1d3f4 ident_default_email + 801\n2   git                           \t0x000000010ba1d68f fmt_ident + 66\n3   git                           \t0x000000010ba4b495 files_log_ref_write + 175\n4   git                           \t0x000000010ba4b0a6 commit_ref_update + 106\n5   git                           \t0x000000010ba4c3a8 ref_transaction_commit + 468\n6   git                           \t0x000000010b994dd8 s_update_ref + 271\n7   git                           \t0x000000010b994556 fetch_refs + 1969\n8   git                           \t0x000000010b9935f2 fetch_one + 1913\n9   git                           \t0x000000010b992bc4 cmd_fetch + 549\n10  git                           \t0x000000010b9666c4 handle_builtin + 478\n11  git                           \t0x000000010b96602f main + 376\n12  libdyld.dylib                 \t0x00007fff834ef5ad start + 1\n\nMaybe someone else has an idea what might be causing this...\n\nCheers Heiko\n"},{"id":"302221","messageId":"20160920110228.GA64315@book.hvoigt.net","threadId":"44107","inReplyTo":"trinity-9c8f1bd1-d6be-48f3-8575-03be09bd1243-1474213828361@3capp-gmx-bs53","subject":"Re: Homebrew and Git","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2016-09-20T11:02:40Z","receivedAt":"2016-09-20T11:09:31Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Sun, Sep 18, 2016 at 05:50:28PM +0200, Jonas Thiel wrote:\n> A while ago I have described my problem with Homebrew at the following\n> GitHub channel\n> (https://github.com/Homebrew/homebrew-core/issues/2970). In the\n> meanwhile, I believe that I my problem with Homebrew is based on an\n> issues with my Git. I have found the attached Git Crash reports on my\n> Mac and because I am not familiar with reading/analysing Crash\n> Reports, it would be great if someone could give me some feedback on\n> it.\n>  \n> If you have any question, please do not hesitate to contact me.\n\nFrom your crash reports I see that git is apparently crashing in a\nstrchr() call from within ident_default_email() which is a function that\ntries to assemble a name and email to put into your commits.\n\nCan you post us the output of\n\n\thostname -f\n\nand\n\n\twhoami\n\n?\n\nSince it seems you are using an Apple git can you also give us the\noutput of\n\n\tgit version\n\nSince it seems that Apple is compiling its own git (and not publishing\nthe changes they made conveniently via git). Have you tried\ninstalling a vanilla git via homebrew and seeing whether that also\nproduces the issue?\n\nIn your bugreport you are talking about modifications you do to your\nsystem after which the issue occurred. I would suggest to exactly find\nout which step lead to git crashing (if it actually is the issue). First\nto identify an issue we need something that is reproduceable.\n\nCheers Heiko\n"},{"id":"302230","messageId":"trinity-6d892636-de41-4169-b9e1-491b5b904a4b-1474397128781@3capp-gmx-bs45","threadId":"44107","inReplyTo":"20160920110228.GA64315@book.hvoigt.net","subject":"Aw: Re: Homebrew and Git","fromName":"Jonas Thiel","fromEmail":"jonas.lierschied@gmx.de","sentAt":"2016-09-20T18:45:28Z","receivedAt":"2016-09-20T18:45:45Z","isPatch":false,"sender":{"key":"jonas.lierschied@gmx.de","avatar":null},"body":"Hi Heiko,\n\nthanks for your reply on my issue. \n\nHere are the following outputs you asked for:\n\ngit version\ngit version 2.7.4 (Apple Git-66)\n\nhostname -f\n0x6A6E73\n\nwhoami\njns\n\nI have tried the Homebrew version of git, but no change in case of the issue.\n\nI just customized my system with the Mathias Bynens dotfiles (https://github.com/mathiasbynens/dotfiles) as well as with drduhs OS X Security Guide (https://github.com/drduh/OS-X-Security-and-Privacy-Guide). Because I reinstall my Mac on a regularly basis, wherefore I can say that one year ago these tweaks have not caused any issue.\n\nThanks a lot. I really appreciate your help.\n\nCheers,\nJonas\n\n> Gesendet: Dienstag, 20. September 2016 um 13:02 Uhr\n> Von: \"Heiko Voigt\" <hvoigt@hvoigt.net>\n> An: \"Jonas Thiel\" <jonas.lierschied@gmx.de>\n> Cc: git@vger.kernel.org\n> Betreff: Re: Homebrew and Git\n>\n> Hi,\n> \n> On Sun, Sep 18, 2016 at 05:50:28PM +0200, Jonas Thiel wrote:\n> > A while ago I have described my problem with Homebrew at the following\n> > GitHub channel\n> > (https://github.com/Homebrew/homebrew-core/issues/2970). In the\n> > meanwhile, I believe that I my problem with Homebrew is based on an\n> > issues with my Git. I have found the attached Git Crash reports on my\n> > Mac and because I am not familiar with reading/analysing Crash\n> > Reports, it would be great if someone could give me some feedback on\n> > it.\n> >  \n> > If you have any question, please do not hesitate to contact me.\n> \n> From your crash reports I see that git is apparently crashing in a\n> strchr() call from within ident_default_email() which is a function that\n> tries to assemble a name and email to put into your commits.\n> \n> Can you post us the output of\n> \n> \thostname -f\n> \n> and\n> \n> \twhoami\n> \n> ?\n> \n> Since it seems you are using an Apple git can you also give us the\n> output of\n> \n> \tgit version\n> \n> Since it seems that Apple is compiling its own git (and not publishing\n> the changes they made conveniently via git). Have you tried\n> installing a vanilla git via homebrew and seeing whether that also\n> produces the issue?\n> \n> In your bugreport you are talking about modifications you do to your\n> system after which the issue occurred. I would suggest to exactly find\n> out which step lead to git crashing (if it actually is the issue). First\n> to identify an issue we need something that is reproduceable.\n> \n> Cheers Heiko\n> \n"},{"id":"302245","messageId":"20160920191555.GB1673@john.keeping.me.uk","threadId":"44107","inReplyTo":"20160920110700.GB64315@book.hvoigt.net","subject":"Re: Re: Homebrew and Git","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2016-09-20T19:15:55Z","receivedAt":"2016-09-20T19:16:09Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Tue, Sep 20, 2016 at 01:07:00PM +0200, Heiko Voigt wrote:\n> On Tue, Sep 20, 2016 at 01:02:28PM +0200, Heiko Voigt wrote:\n> > Hi,\n> > \n> > On Sun, Sep 18, 2016 at 05:50:28PM +0200, Jonas Thiel wrote:\n> > > A while ago I have described my problem with Homebrew at the following\n> > > GitHub channel\n> > > (https://github.com/Homebrew/homebrew-core/issues/2970). In the\n> > > meanwhile, I believe that I my problem with Homebrew is based on an\n> > > issues with my Git. I have found the attached Git Crash reports on my\n> > > Mac and because I am not familiar with reading/analysing Crash\n> > > Reports, it would be great if someone could give me some feedback on\n> > > it.\n> > >  \n> > > If you have any question, please do not hesitate to contact me.\n> > \n> > From your crash reports I see that git is apparently crashing in a\n> > strchr() call from within ident_default_email() which is a function that\n> > tries to assemble a name and email to put into your commits.\n> \n> BTW, here is the callstack inlined from the crashreport:\n> \n> bsystem_platform.dylib      \t0x00007fff840db41c _platform_strchr$VARIANT$Haswell + 28\n> 1   git                           \t0x000000010ba1d3f4 ident_default_email + 801\n> 2   git                           \t0x000000010ba1d68f fmt_ident + 66\n> 3   git                           \t0x000000010ba4b495 files_log_ref_write + 175\n> 4   git                           \t0x000000010ba4b0a6 commit_ref_update + 106\n> 5   git                           \t0x000000010ba4c3a8 ref_transaction_commit + 468\n> 6   git                           \t0x000000010b994dd8 s_update_ref + 271\n> 7   git                           \t0x000000010b994556 fetch_refs + 1969\n> 8   git                           \t0x000000010b9935f2 fetch_one + 1913\n> 9   git                           \t0x000000010b992bc4 cmd_fetch + 549\n> 10  git                           \t0x000000010b9666c4 handle_builtin + 478\n> 11  git                           \t0x000000010b96602f main + 376\n> 12  libdyld.dylib                 \t0x00007fff834ef5ad start + 1\n> \n> Maybe someone else has an idea what might be causing this...\n\nThe only strchr I can see that could be called here is in\ncanonical_name(), where it's called with addrinfo::ai_canonname.\n\nSearching for OS X and ai_canonname, leads me straight back to this\nlist, although 7 years ago!  I think ident.c needs a fix similar to\ncommit 3e8a00a (daemon.c: fix segfault on OS X, 2009-04-27); from the\ncommit message there:\n\n\tOn OS X (and maybe other unices), getaddrinfo(3) returns NULL\n\tin the ai_canonname field if it's called with an IP address for\n\tthe hostname.\n"},{"id":"302255","messageId":"20160921084841.phq7cfbagi5k7ku4@sigill.intra.peff.net","threadId":"44107","inReplyTo":"20160920191555.GB1673@john.keeping.me.uk","subject":"Re: Re: Homebrew and Git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-21T08:48:41Z","receivedAt":"2016-09-21T08:48:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 20, 2016 at 08:15:55PM +0100, John Keeping wrote:\n\n> > BTW, here is the callstack inlined from the crashreport:\n> > \n> > bsystem_platform.dylib      \t0x00007fff840db41c _platform_strchr$VARIANT$Haswell + 28\n> > 1   git                           \t0x000000010ba1d3f4 ident_default_email + 801\n> > 2   git                           \t0x000000010ba1d68f fmt_ident + 66\n> > 3   git                           \t0x000000010ba4b495 files_log_ref_write + 175\n> > 4   git                           \t0x000000010ba4b0a6 commit_ref_update + 106\n> > 5   git                           \t0x000000010ba4c3a8 ref_transaction_commit + 468\n> > 6   git                           \t0x000000010b994dd8 s_update_ref + 271\n> > 7   git                           \t0x000000010b994556 fetch_refs + 1969\n> > 8   git                           \t0x000000010b9935f2 fetch_one + 1913\n> > 9   git                           \t0x000000010b992bc4 cmd_fetch + 549\n> > 10  git                           \t0x000000010b9666c4 handle_builtin + 478\n> > 11  git                           \t0x000000010b96602f main + 376\n> > 12  libdyld.dylib                 \t0x00007fff834ef5ad start + 1\n> > \n> > Maybe someone else has an idea what might be causing this...\n> \n> The only strchr I can see that could be called here is in\n> canonical_name(), where it's called with addrinfo::ai_canonname.\n\nThere's one in add_domainname(), too, but it can never be NULL (we could\nwalk off the end of the buffer, but only if gethostname() lies to us\nabout its result code, which seems unlikely). So I agree it's probably\nthe call in canonical_name().\n\n> Searching for OS X and ai_canonname, leads me straight back to this\n> list, although 7 years ago!  I think ident.c needs a fix similar to\n> commit 3e8a00a (daemon.c: fix segfault on OS X, 2009-04-27); from the\n> commit message there:\n> \n> \tOn OS X (and maybe other unices), getaddrinfo(3) returns NULL\n> \tin the ai_canonname field if it's called with an IP address for\n> \tthe hostname.\n\nInteresting. We are already prepared for failure from getaddrinfo()\nhere, so probably:\n\ndiff --git a/ident.c b/ident.c\nindex e20a772..d17b5bd 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)\n \tmemset (&hints, '\\0', sizeof (hints));\n \thints.ai_flags = AI_CANONNAME;\n \tif (!getaddrinfo(host, NULL, &hints, &ai)) {\n-\t\tif (ai && strchr(ai->ai_canonname, '.')) {\n+\t\tif (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {\n \t\t\tstrbuf_addstr(out, ai->ai_canonname);\n \t\t\tstatus = 0;\n \t\t}\n\nwould be sufficient. Jonas, can you see if that patch helps?\n\n-Peff\n"},{"id":"302366","messageId":"trinity-7a55c197-21af-4808-9919-6fc26bdcece2-1474536212197@3capp-gmx-bs75","threadId":"44107","inReplyTo":"20160921084841.phq7cfbagi5k7ku4@sigill.intra.peff.net","subject":"Aw: Re: Re: Homebrew and Git","fromName":"Jonas Thiel","fromEmail":"jonas.lierschied@gmx.de","sentAt":"2016-09-22T09:23:32Z","receivedAt":"2016-09-22T09:23:52Z","isPatch":false,"sender":{"key":"jonas.lierschied@gmx.de","avatar":null},"body":"Sorry for my late reply. Thanks for your support -- I really appreciate that. \n\n@Jeff: Unfortunately, I do not know how to implement the patch you provided. Can you explain how to do that? \n\nThanks and best regards,\nJonas\n\n> Gesendet: Mittwoch, 21. September 2016 um 10:48 Uhr\n> Von: \"Jeff King\" <peff@peff.net>\n> An: \"John Keeping\" <john@keeping.me.uk>\n> Cc: \"Heiko Voigt\" <hvoigt@hvoigt.net>, \"Jonas Thiel\" <jonas.lierschied@gmx.de>, git@vger.kernel.org\n> Betreff: Re: Re: Homebrew and Git\n>\n> On Tue, Sep 20, 2016 at 08:15:55PM +0100, John Keeping wrote:\n> \n> > > BTW, here is the callstack inlined from the crashreport:\n> > > \n> > > bsystem_platform.dylib      \t0x00007fff840db41c _platform_strchr$VARIANT$Haswell + 28\n> > > 1   git                           \t0x000000010ba1d3f4 ident_default_email + 801\n> > > 2   git                           \t0x000000010ba1d68f fmt_ident + 66\n> > > 3   git                           \t0x000000010ba4b495 files_log_ref_write + 175\n> > > 4   git                           \t0x000000010ba4b0a6 commit_ref_update + 106\n> > > 5   git                           \t0x000000010ba4c3a8 ref_transaction_commit + 468\n> > > 6   git                           \t0x000000010b994dd8 s_update_ref + 271\n> > > 7   git                           \t0x000000010b994556 fetch_refs + 1969\n> > > 8   git                           \t0x000000010b9935f2 fetch_one + 1913\n> > > 9   git                           \t0x000000010b992bc4 cmd_fetch + 549\n> > > 10  git                           \t0x000000010b9666c4 handle_builtin + 478\n> > > 11  git                           \t0x000000010b96602f main + 376\n> > > 12  libdyld.dylib                 \t0x00007fff834ef5ad start + 1\n> > > \n> > > Maybe someone else has an idea what might be causing this...\n> > \n> > The only strchr I can see that could be called here is in\n> > canonical_name(), where it's called with addrinfo::ai_canonname.\n> \n> There's one in add_domainname(), too, but it can never be NULL (we could\n> walk off the end of the buffer, but only if gethostname() lies to us\n> about its result code, which seems unlikely). So I agree it's probably\n> the call in canonical_name().\n> \n> > Searching for OS X and ai_canonname, leads me straight back to this\n> > list, although 7 years ago!  I think ident.c needs a fix similar to\n> > commit 3e8a00a (daemon.c: fix segfault on OS X, 2009-04-27); from the\n> > commit message there:\n> > \n> > \tOn OS X (and maybe other unices), getaddrinfo(3) returns NULL\n> > \tin the ai_canonname field if it's called with an IP address for\n> > \tthe hostname.\n> \n> Interesting. We are already prepared for failure from getaddrinfo()\n> here, so probably:\n> \n> diff --git a/ident.c b/ident.c\n> index e20a772..d17b5bd 100644\n> --- a/ident.c\n> +++ b/ident.c\n> @@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)\n>  \tmemset (&hints, '\\0', sizeof (hints));\n>  \thints.ai_flags = AI_CANONNAME;\n>  \tif (!getaddrinfo(host, NULL, &hints, &ai)) {\n> -\t\tif (ai && strchr(ai->ai_canonname, '.')) {\n> +\t\tif (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {\n>  \t\t\tstrbuf_addstr(out, ai->ai_canonname);\n>  \t\t\tstatus = 0;\n>  \t\t}\n> \n> would be sufficient. Jonas, can you see if that patch helps?\n> \n> -Peff\n> \n"},{"id":"302375","messageId":"CAGZ79kYUcyCrjPfqWtyWE-kaqbQZPG1qosc3qJrDfHixivyFew@mail.gmail.com","threadId":"44107","inReplyTo":"trinity-7a55c197-21af-4808-9919-6fc26bdcece2-1474536212197@3capp-gmx-bs75","subject":"Re: Re: Re: Homebrew and Git","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-09-22T15:57:45Z","receivedAt":"2016-09-22T15:57:53Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Sep 22, 2016 at 2:23 AM, Jonas Thiel <jonas.lierschied@gmx.de> wrote:\n> Sorry for my late reply. Thanks for your support -- I really appreciate that.\n>\n> @Jeff: Unfortunately, I do not know how to implement the patch you provided. Can you explain how to do that?\n\nI think this should do:\n\n\n    git clone https://github.com/git/git\n    cd git\n    # get the email\n    wget http://public-inbox.org/git/20160921084841.phq7cfbagi5k7ku4@sigill.intra.peff.net/raw\n    # apply patch:\n    git am raw\n    make\n    make install\n\n>\n> Thanks and best regards,\n> Jonas\n>\n>> Gesendet: Mittwoch, 21. September 2016 um 10:48 Uhr\n>> Von: \"Jeff King\" <peff@peff.net>\n>> An: \"John Keeping\" <john@keeping.me.uk>\n>> Cc: \"Heiko Voigt\" <hvoigt@hvoigt.net>, \"Jonas Thiel\" <jonas.lierschied@gmx.de>, git@vger.kernel.org\n>> Betreff: Re: Re: Homebrew and Git\n>>\n>> On Tue, Sep 20, 2016 at 08:15:55PM +0100, John Keeping wrote:\n>>\n>> > > BTW, here is the callstack inlined from the crashreport:\n>> > >\n>> > > bsystem_platform.dylib            0x00007fff840db41c _platform_strchr$VARIANT$Haswell + 28\n>> > > 1   git                                   0x000000010ba1d3f4 ident_default_email + 801\n>> > > 2   git                                   0x000000010ba1d68f fmt_ident + 66\n>> > > 3   git                                   0x000000010ba4b495 files_log_ref_write + 175\n>> > > 4   git                                   0x000000010ba4b0a6 commit_ref_update + 106\n>> > > 5   git                                   0x000000010ba4c3a8 ref_transaction_commit + 468\n>> > > 6   git                                   0x000000010b994dd8 s_update_ref + 271\n>> > > 7   git                                   0x000000010b994556 fetch_refs + 1969\n>> > > 8   git                                   0x000000010b9935f2 fetch_one + 1913\n>> > > 9   git                                   0x000000010b992bc4 cmd_fetch + 549\n>> > > 10  git                                   0x000000010b9666c4 handle_builtin + 478\n>> > > 11  git                                   0x000000010b96602f main + 376\n>> > > 12  libdyld.dylib                         0x00007fff834ef5ad start + 1\n>> > >\n>> > > Maybe someone else has an idea what might be causing this...\n>> >\n>> > The only strchr I can see that could be called here is in\n>> > canonical_name(), where it's called with addrinfo::ai_canonname.\n>>\n>> There's one in add_domainname(), too, but it can never be NULL (we could\n>> walk off the end of the buffer, but only if gethostname() lies to us\n>> about its result code, which seems unlikely). So I agree it's probably\n>> the call in canonical_name().\n>>\n>> > Searching for OS X and ai_canonname, leads me straight back to this\n>> > list, although 7 years ago!  I think ident.c needs a fix similar to\n>> > commit 3e8a00a (daemon.c: fix segfault on OS X, 2009-04-27); from the\n>> > commit message there:\n>> >\n>> >     On OS X (and maybe other unices), getaddrinfo(3) returns NULL\n>> >     in the ai_canonname field if it's called with an IP address for\n>> >     the hostname.\n>>\n>> Interesting. We are already prepared for failure from getaddrinfo()\n>> here, so probably:\n>>\n>> diff --git a/ident.c b/ident.c\n>> index e20a772..d17b5bd 100644\n>> --- a/ident.c\n>> +++ b/ident.c\n>> @@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)\n>>       memset (&hints, '\\0', sizeof (hints));\n>>       hints.ai_flags = AI_CANONNAME;\n>>       if (!getaddrinfo(host, NULL, &hints, &ai)) {\n>> -             if (ai && strchr(ai->ai_canonname, '.')) {\n>> +             if (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {\n>>                       strbuf_addstr(out, ai->ai_canonname);\n>>                       status = 0;\n>>               }\n>>\n>> would be sufficient. Jonas, can you see if that patch helps?\n>>\n>> -Peff\n>>\n"},{"id":"302425","messageId":"20160923040730.76stbefz2ivyfy45@sigill.intra.peff.net","threadId":"44107","inReplyTo":"CAGZ79kYUcyCrjPfqWtyWE-kaqbQZPG1qosc3qJrDfHixivyFew@mail.gmail.com","subject":"Re: Re: Re: Homebrew and Git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-23T04:07:30Z","receivedAt":"2016-09-23T04:07:37Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 22, 2016 at 08:57:45AM -0700, Stefan Beller wrote:\n\n> On Thu, Sep 22, 2016 at 2:23 AM, Jonas Thiel <jonas.lierschied@gmx.de> wrote:\n> > Sorry for my late reply. Thanks for your support -- I really appreciate that.\n> >\n> > @Jeff: Unfortunately, I do not know how to implement the patch you provided. Can you explain how to do that?\n> \n> I think this should do:\n> \n>     git clone https://github.com/git/git\n>     cd git\n>     # get the email\n>     wget http://public-inbox.org/git/20160921084841.phq7cfbagi5k7ku4@sigill.intra.peff.net/raw\n>     # apply patch:\n>     git am raw\n\nI publish my topic branches via git, too, so it may be easier to replace\nthese steps with:\n\n  git clone -b jk/ident-canonname https://github.com/peff/git\n  cd git\n\n>     make\n>     make install\n\nAfter installing, you probably want to do:\n\n  PATH=/path/to/git/bin-wrappers:$PATH\n\nto run the new git (and make sure that any git sub-commands that are run\ncome from the built version, not the rest of the system).\n\nI have access to an OS X system, but if I understand the bug correctly,\nreproducing it may involve re-setting the system hostname, which is not\nsomething I'll be able to do. But I'll give it a shot.\n\n-Peff\n"},{"id":"302427","messageId":"20160923043753.mfmiarneqc5rxgt3@sigill.intra.peff.net","threadId":"44107","inReplyTo":"20160923040730.76stbefz2ivyfy45@sigill.intra.peff.net","subject":"[PATCH] ident: handle NULL ai_canonname","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-23T04:37:53Z","receivedAt":"2016-09-23T04:38:04Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 23, 2016 at 12:07:30AM -0400, Jeff King wrote:\n\n> I have access to an OS X system, but if I understand the bug correctly,\n> reproducing it may involve re-setting the system hostname, which is not\n> something I'll be able to do. But I'll give it a shot.\n\nActually, it turned out to be pretty simple to reproduce (after reading\n3e8a00a that John found, anyway; hooray for detailed commit messages). \nWe just have to fake the output of gethostname(), but that is easily\ndone since we can modify git's source. :)\n\nSo I was able to reproduce the bug, and indeed, the patch I posted fixes\nit. Here it is with a commit message.\n\nJonas, I'd be curious to know what the output of \"hostname\" is on your\nsystem.\n\n-- >8 --\nSubject: [PATCH] ident: handle NULL ai_canonname\n\nWe call getaddrinfo() to try to convert a short hostname\ninto a fully-qualified one (to use it as an email domain).\nIf there isn't a canonical name, getaddrinfo() will\ngenerally return either a NULL addrinfo list, or one in\nwhich ai->ai_canonname is a copy of the original name.\n\nHowever, if the result of gethostname() looks like an IP\naddress, then getaddrinfo() behaves differently on some\nsystems. On OS X, it will return a \"struct addrinfo\" with a\nNULL ai_canonname, and we segfault feeding it to strchr().\n\nThis is hard to test reliably because it involves not only a\nsystem where we we have to fallback to gethostname() to come\nup with an ident, but also where the hostname is a number\nwith no dots. But I was able to replicate the bug by faking\na hostname, like:\n\n    diff --git a/ident.c b/ident.c\n    index e20a772..b790d28 100644\n    --- a/ident.c\n    +++ b/ident.c\n    @@ -128,6 +128,7 @@ static void add_domainname(struct strbuf *out, int *is_bogus)\n                     *is_bogus = 1;\n                     return;\n             }\n    +        xsnprintf(buf, sizeof(buf), \"1\");\n             if (strchr(buf, '.'))\n                     strbuf_addstr(out, buf);\n             else if (canonical_name(buf, out) < 0) {\n\nand running \"git var GIT_AUTHOR_IDENT\" on an OS X system.\n\nBefore this patch it segfaults, and after we correctly\ncomplain of the bogus \"user@1.(none)\" address (though this\nbogus address would be suitable for non-object uses like\nwriting reflogs).\n\nReported-by: Jonas Thiel <jonas.lierschied@gmx.de>\nDiagnosed-by: John Keeping <john@keeping.me.uk>\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ident.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ident.c b/ident.c\nindex e20a772..d17b5bd 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)\n \tmemset (&hints, '\\0', sizeof (hints));\n \thints.ai_flags = AI_CANONNAME;\n \tif (!getaddrinfo(host, NULL, &hints, &ai)) {\n-\t\tif (ai && strchr(ai->ai_canonname, '.')) {\n+\t\tif (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {\n \t\t\tstrbuf_addstr(out, ai->ai_canonname);\n \t\t\tstatus = 0;\n \t\t}\n-- \n2.10.0.482.gae5a597\n\n"}]}