{"thread":{"id":"27791","subject":"Resend: [PATCH] Do not log unless all connect() attempts fail","startedAt":"2011-07-11T18:06:15Z","lastAt":"2011-07-13T09:26:35Z","messageCount":5,"participants":["Dave Zarzycki","Jeff King","Junio C Hamano","Erik Faye-Lund"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"171095","messageId":"A3C89B89-4E31-400E-9DF8-C0F289D72D81@apple.com","threadId":"27791","inReplyTo":null,"subject":"Resend: [PATCH] Do not log unless all connect() attempts fail","fromName":"Dave Zarzycki","fromEmail":"zarzycki@apple.com","sentAt":"2011-07-11T18:06:15Z","receivedAt":"2011-07-11T18:06:15Z","isPatch":true,"sender":{"key":"zarzycki@apple.com","avatar":"https://avatars.githubusercontent.com/u/1071982?v=4"},"body":"IPv6 hosts are often unreachable on the primarily IPv4 Internet and\ntherefore we shouldn't print an error if there are still other hosts we\ncan try to connect() to. This helps \"git fetch --quiet\" stay quiet.\n---\n connect.c |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/connect.c b/connect.c\nindex 2119c3f..8eb9f44 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -192,6 +192,7 @@ static const char *ai_name(const struct addrinfo *ai)\n  */\n static int git_tcp_connect_sock(char *host, int flags)\n {\n+       struct strbuf error_message = STRBUF_INIT;\n        int sockfd = -1, saved_errno = 0;\n        const char *port = STR(DEFAULT_GIT_PORT);\n        struct addrinfo hints, *ai0, *ai;\n@@ -225,11 +226,8 @@ static int git_tcp_connect_sock(char *host, int flags)\n                }\n                if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {\n                        saved_errno = errno;\n-                       fprintf(stderr, \"%s[%d: %s]: errno=%s\\n\",\n-                               host,\n-                               cnt,\n-                               ai_name(ai),\n-                               strerror(saved_errno));\n+                       strbuf_addf(&error_message, \"%s[%d: %s]: errno=%s\\n\",\n+                               host, cnt, ai_name(ai), strerror(saved_errno));\n                        close(sockfd);\n                        sockfd = -1;\n                        continue;\n@@ -242,11 +240,13 @@ static int git_tcp_connect_sock(char *host, int flags)\n        freeaddrinfo(ai0);\n\n        if (sockfd < 0)\n-               die(\"unable to connect a socket (%s)\", strerror(saved_errno));\n+               die(\"unable to connect to %s:\\n%s\", host, error_message.buf);\n\n        if (flags & CONNECT_VERBOSE)\n                fprintf(stderr, \"done.\\n\");\n\n+       strbuf_release(&error_message);\n+\n        return sockfd;\n }\n\n-- \n1.7.6.135.g8cdba\n"},{"id":"171126","messageId":"20110712055553.GD11644@sigill.intra.peff.net","threadId":"27791","inReplyTo":"A3C89B89-4E31-400E-9DF8-C0F289D72D81@apple.com","subject":"Re: Resend: [PATCH] Do not log unless all connect() attempts fail","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-07-12T05:55:53Z","receivedAt":"2011-07-12T05:55:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 11, 2011 at 11:06:15AM -0700, Dave Zarzycki wrote:\n\n> IPv6 hosts are often unreachable on the primarily IPv4 Internet and\n> therefore we shouldn't print an error if there are still other hosts we\n> can try to connect() to. This helps \"git fetch --quiet\" stay quiet.\n\nThanks for the resend; I think this got lost in the shuffle between\nreleases. This version addresses my complaints about the original; I\ndon't see any reason it shouldn't be applied.\n\n-Peff\n"},{"id":"171154","messageId":"7v39iba3b2.fsf@alter.siamese.dyndns.org","threadId":"27791","inReplyTo":"A3C89B89-4E31-400E-9DF8-C0F289D72D81@apple.com","subject":"Re: Resend: [PATCH] Do not log unless all connect() attempts fail","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-12T16:09:37Z","receivedAt":"2011-07-12T16:09:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This looks Looks good to me; could you sign-off the patch, please?\n\nThanks.\n"},{"id":"171156","messageId":"A10BFC0E-05BB-41CF-BC86-28D3FF4CC7A8@apple.com","threadId":"27791","inReplyTo":"7v39iba3b2.fsf@alter.siamese.dyndns.org","subject":"Re: Resend: [PATCH] Do not log unless all connect() attempts fail","fromName":"Dave Zarzycki","fromEmail":"zarzycki@apple.com","sentAt":"2011-07-12T16:29:33Z","receivedAt":"2011-07-12T16:29:33Z","isPatch":true,"sender":{"key":"zarzycki@apple.com","avatar":"https://avatars.githubusercontent.com/u/1071982?v=4"},"body":"Sure, no problem-o. (Sorry, I should have read the submitting patches document first.) Thanks again!\n\n\nOn Jul 12, 2011, at 9:09 AM, Junio C Hamano wrote:\n\n> This looks Looks good to me; could you sign-off the patch, please?\n> \n> Thanks.\n"},{"id":"171228","messageId":"CABPQNSYxQDxgDS5z-TMxC3WtNQ7KV_F4f6HTKOH-SpwMQsiHUw@mail.gmail.com","threadId":"27791","inReplyTo":"7v39iba3b2.fsf@alter.siamese.dyndns.org","subject":"Re: Resend: [PATCH] Do not log unless all connect() attempts fail","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-07-13T09:26:35Z","receivedAt":"2011-07-13T09:26:35Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, Jul 12, 2011 at 6:09 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> This looks Looks good to me; could you sign-off the patch, please?\n>\n\nAs I noted on the resend with the sign-off, I believe there's a\nproblem with the patch where saved_errno is written to in one place\nbut the error never gets reported after applying the patch.\n"}]}