public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "yohei at jp dot ibm.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug go/63731] Fallback to netgo does not work Date: Tue, 18 Nov 2014 13:52:00 -0000 [thread overview] Message-ID: <bug-63731-4-mptZHujuPZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-63731-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63731 --- Comment #10 from Yohei Ueda <yohei at jp dot ibm.com> --- https://code.google.com/p/go/source/browse/src/net/lookup_unix.go#63 func lookupIP(host string) (addrs []IP, err error) { addrs, err, ok := cgoLookupIP(host) if !ok { addrs, err = goLookupIP(host) } return } This code shows how fallback works. If cgoLookup returns ok == false, then pure-Go goLookupIP is called. When the netgo tag is set, ok is always false. https://code.google.com/p/go/source/browse/src/net/cgo_stub.go#5 When the netgo tag is not set, ok is always true. https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#147 https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#84 If cgoLookupIP can also return ok == false when no nss is available, goLookupIP will be called. This is my first idea. https://code.google.com/p/go/source/browse/src/net/cgo_unix.go#116 However, I realized that we cannot easily distinguish the "not found" errors. getaddrinfo returns "not found" in both cases of invalid hostname lookups and static binaries. If cgoLookup returns ok == false even when an invalid host name is looked up with nss available, goLookupIP also looks it up again, so IP lookup occurs twice, and both fails with "not found" error. I don't think this is desired behavior.
next prev parent reply other threads:[~2014-11-18 13:52 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-04 8:08 [Bug go/63731] New: " yohei at jp dot ibm.com 2014-11-14 4:15 ` [Bug go/63731] " yohei at jp dot ibm.com 2014-11-14 4:49 ` yohei at jp dot ibm.com 2014-11-14 15:54 ` ian at airs dot com 2014-11-17 8:16 ` yohei at jp dot ibm.com 2014-11-17 15:44 ` ian at airs dot com 2014-11-17 18:27 ` boger at us dot ibm.com 2014-11-18 0:24 ` ian at airs dot com 2014-11-18 6:15 ` yohei at jp dot ibm.com 2014-11-18 13:16 ` boger at us dot ibm.com 2014-11-18 13:52 ` yohei at jp dot ibm.com [this message] 2014-11-19 20:32 ` boger at us dot ibm.com 2014-11-20 13:25 ` boger at us dot ibm.com 2014-11-20 14:49 ` yohei at jp dot ibm.com 2014-11-20 20:02 ` boger at us dot ibm.com 2014-11-21 4:26 ` ian at airs dot com 2014-11-21 15:12 ` boger at us dot ibm.com 2014-11-21 17:10 ` ian at airs dot com 2014-11-25 15:35 ` boger at us dot ibm.com 2014-12-03 13:03 ` yohei at jp dot ibm.com 2014-12-03 16:10 ` boger at us dot ibm.com 2014-12-03 18:39 ` boger at us dot ibm.com 2014-12-03 19:17 ` ian at airs dot com 2015-02-28 10:16 ` e29253 at jp dot ibm.com 2015-02-28 21:01 ` ian at airs dot com 2015-03-01 23:40 ` ian at airs dot com 2015-03-02 21:58 ` boger at us dot ibm.com 2015-03-02 23:34 ` ian at airs dot com 2015-03-31 16:06 ` boger at us dot ibm.com 2015-04-01 14:11 ` boger at us dot ibm.com 2015-04-07 18:10 ` ian at gcc dot gnu.org 2015-04-07 18:10 ` ian at airs dot com 2015-04-08 14:41 ` boger at us dot ibm.com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-63731-4-mptZHujuPZ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).