Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: LookupAddr does not set IsNotFound with cgo resolver #57548

Open
rudis opened this issue Jan 2, 2023 · 5 comments · May be fixed by #57549
Open

net: LookupAddr does not set IsNotFound with cgo resolver #57548

rudis opened this issue Jan 2, 2023 · 5 comments · May be fixed by #57549
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rudis
Copy link

rudis commented Jan 2, 2023

What version of Go are you using (go version)?

$ go version
go version go1.19.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/.cache/go-build"
GOENV="$HOME/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="$HOME/dev/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/go1.19.4"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/go1.19.4/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/run/user/$UID/go-build1957738364=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ cat > x.go <<EOF
package main
import (
        "fmt"
        "net"
)
func main() {
        _, err := net.LookupAddr("1.2.3.4")
        fmt.Printf("%v\n", err.(*net.DNSError).IsNotFound)
}
EOF

$ GODEBUG=netdns=go go run x.go
true

$ GODEBUG=netdns=cgo go run x.go
false

What did you expect to see?

Both go and cgo resolver correctly report IsNotFound.

What did you see instead?

Only go resolver does so.

There's already a pull request for this but it wasn't merged: #45959

@rudis
Copy link
Author

rudis commented Jan 2, 2023

I think this CL is unrelated because it changes cgoLookupIPCNAME and not cgoLookupAddrPTR which is used by LookupAddr.

@mateusz834
Copy link
Contributor

@rudis you are right, my mistake, deleted that comment. I will make a new CL for this.

@gopherbot
Copy link

Change https://go.dev/cl/460255 mentions this issue: net: report IsNotFound when getnameinfo returns EAI_NONAME

@heschi
Copy link
Contributor

heschi commented Jan 3, 2023

cc @neild @ianlancetaylor

@heschi heschi added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 3, 2023
@heschi heschi added this to the Go1.20 milestone Jan 3, 2023
@rudis
Copy link
Author

rudis commented Jan 3, 2023

@rudis you are right, my mistake, deleted that comment. I will make a new CL for this.

Thanks for the quick response. CL looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants