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/netip: AddrPort MarshalText and String methods produce different values #50110

Closed
capnspacehook opened this issue Dec 11, 2021 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@capnspacehook
Copy link

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

$ go version
go version devel go1.18-766f89b5c6 Fri Dec 10 19:26:50 2021 +0000 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
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/capnspacehook/.cache/go-build"
GOENV="/home/capnspacehook/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/capnspacehook/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/capnspacehook/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/capnspacehook/Documents/git/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/capnspacehook/Documents/git/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.18-766f89b5c6 Fri Dec 10 19:26:50 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/capnspacehook/Documents/git/go/src/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3691310336=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tested that AddrPort's MarshalText and String methods produced the same values on valid addresses:

https://go.dev/play/p/s6nVtut2v0o?v=gotip

What did you expect to see?

true
"[::ffff:192.168.140.255]:80", "[::ffff:192.168.140.255]:80"

What did you see instead?

false
"[::ffff:c0a8:8cff]:80", "[::ffff:192.168.140.255]:80"

I found this bug and a few others while working on #49367.

@dmitshur dmitshur added this to the Go1.18 milestone Dec 12, 2021
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 12, 2021
@dmitshur
Copy link
Contributor

CC @bradfitz.

@gopherbot
Copy link

Change https://golang.org/cl/371114 mentions this issue: net/netip: make AddrPort.MarshalText format 4-in-6 IPs consistently

capnspacehook pushed a commit to capnspacehook/go that referenced this issue Dec 12, 2021
Thanks again to @capnspacehook.

Fixes golang#50110

Change-Id: I1973bdea68eac9842b45f9524f62152e4f5342cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/371114
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants