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

all: add support for FreeBSD 11 #7849

Closed
gopherbot opened this issue Apr 23, 2014 · 20 comments
Closed

all: add support for FreeBSD 11 #7849

gopherbot opened this issue Apr 23, 2014 · 20 comments

Comments

@gopherbot
Copy link
Contributor

by smith.winston.101:

Building Go 1.3-beta1 on FreeBSD-CURRENT-r264670/armv6 (Beaglebone Black) fails the
following tests (see below for details):
    1) math
    2) net
    3) strconv

Go 1.3beta1 was built as follows:

CC=clang ./all.bash


`go version` shows:

go version devel +f8b50ad4cac4 Mon Apr 21 17:00:27 2014 -0700 + freebsd/arm


`clang --version` shows:

FreeBSD clang version 3.4 (tags/RELEASE_34/final 197956) 20140216
Target: armv6--freebsd11.0-gnueabi
Thread model: posix


NOTES:
    1) Go 1.3-beta1 compiled and ran tests OK on FreeBSD-RELEASE-10 using Clang 3.3 (tags/RELEASE_33/final 183502)
    2) Go 1.3-beta1 compiled and ran tests OK on the same BeagleBone Black hardware running Linux (Debian Wheezy, GCC 4.6.3).



--- FAIL: TestFrexp (0.00 seconds)
        all_test.go:2048: Frexp(0) = 0, 0, want 0.9999999999999998, -1022
        all_test.go:2048: Frexp(0) = 0, 0, want 0.5, -1073
        all_test.go:2048: Frexp(0) = 0, 0, want -0.9999999999999998, -1022
        all_test.go:2048: Frexp(0) = 0, 0, want -0.5, -1073
--- FAIL: TestIlogb (0.00 seconds)
        all_test.go:2108: Ilogb(0) = -2147483648, want -1023
        all_test.go:2108: Ilogb(0) = -2147483648, want -1074
        all_test.go:2108: Ilogb(0) = -2147483648, want -1023
        all_test.go:2108: Ilogb(0) = -2147483648, want -1074
--- FAIL: TestLdexp (0.00 seconds)
        all_test.go:2169: Ldexp(0.9999999999999998, -1022) = 2.225073858507201e-308, want 0
        all_test.go:2169: Ldexp(0.5, -1073) = 5e-324, want 0
        all_test.go:2169: Ldexp(-0.9999999999999998, -1022) = -2.225073858507201e-308, want 0
        all_test.go:2169: Ldexp(-0.5, -1073) = -5e-324, want 0
        all_test.go:2169: Ldexp(2.2250738585072014e-308, -52) = 5e-324, want 0
        all_test.go:2169: Ldexp(0, 1074) = 0, want 1
        all_test.go:2169: Ldexp(1.7976931348623157e+308, -2097) = 1e-323, want 0
--- FAIL: TestLogb (0.00 seconds)
        all_test.go:2229: Logb(0) = -Inf, want -1023
        all_test.go:2229: Logb(0) = -Inf, want -1074
        all_test.go:2229: Logb(0) = -Inf, want -1023
        all_test.go:2229: Logb(0) = -Inf, want -1074
--- FAIL: TestNextafter (0.00 seconds)
        all_test.go:2314: Nextafter(0, -1) = -5e-324 want 0
        all_test.go:2314: Nextafter(-0, 1) = 5e-324 want 0
        all_test.go:2314: Nextafter(-0, -1) = -5e-324 want 0
--- FAIL: TestFloatMinMax (0.00 seconds)
        all_test.go:2577: Sprint(SmallestNonzeroFloat64) = 0, want 5e-324
        all_test.go:2577: Sprint(SmallestNonzeroFloat32) = 0, want 1e-45
FAIL
FAIL    math    1.036s



--- FAIL: TestInterfaces (0.00 seconds)
        interface_test.go:59: table: len/cap = 2/2
        interface_test.go:71: InterfaceByName("") failed: invalid network interface name
FAIL
FAIL    net     5.944s



--- FAIL: TestFtoa (0.01 seconds)
        ftoa_test.go:149: testN=64 0 g -1 want 2.225073858507201e-308 got 0
        ftoa_test.go:149: AppendFloat testN=64 0 g -1 want abc2.225073858507201e-308 got abc0
        ftoa_test.go:147: testN=32 0 g -1 want 2.225073858507201e-308 got 0
        ftoa_test.go:151: AppendFloat testN=32 0 g -1 want abc2.225073858507201e-308 got abc0
FAIL
FAIL    strconv 6.168s
@ianlancetaylor
Copy link
Member

Comment 1:

Labels changed: added repo-main, release-go1.3.

@minux
Copy link
Member

minux commented Apr 23, 2014

Comment 2:

i know the reason for math and strconv:
freebsd-current uses runfast mode of vfp by default, which flushes denormal fp numbers
to zero. Our toolchain needs to be able to reprent denormal numbers faithfully for some
of the math/strconv tests.
I'm not sure about the net test failure though.

@minux
Copy link
Member

minux commented Apr 23, 2014

Comment 3:

could you please give this CL:
https://golang.org/cl/89610043
a try to see if it could fix the math and strconv test failures?

Owner changed to @minux.

Status changed to WaitingForReply.

@gopherbot
Copy link
Contributor Author

Comment 4 by smith.winston.101:

I rebuilt and retested on the BBB using FreeBSD-10-STABLE (r264836) -- Go 1.3beta1
builds and tests OK.  I'll retry 11-CURRENT with the patches in #3.

@minux
Copy link
Member

minux commented Apr 24, 2014

Comment 5:

great! that means freebsd-11 does make some incompatible changes compared to 10.
thank you for the confirmation.

@gopherbot
Copy link
Contributor Author

Comment 6 by smith.winston.101:

@minux, your CL RESOLVED the math and strconv issues on FreeBSD-CURRENT.
There's still an issue with the net package failing interface_test; it looks like the
results from syscall.ParseRoutingSockaddr() returns a zero length list -- I'm digging
into that, hopefully, I'll figure out what's going on (I can see the if names when I
hex.Dump() out the InterfaceMessage.Data blocks).

@gopherbot
Copy link
Contributor Author

Comment 7 by smith.winston.101:

FYI: In my original report I wasn't clear that in NOTE #1 I was actually referring to
testing Go1.3beta1 on an x64 FreeBSD-10-RELEASE system.  Comment #4 was actually when I
tested FreeBSD-10-STABLE on the armv6 (BeagleBone Black).

@minux
Copy link
Member

minux commented Apr 25, 2014

Comment 8:

Thank you for testing the CL!
I will remove irrelevant part of CL and get the essential fix included in 1.3 beta 2.
I currently don't know why TestInterface fails on freebsd-current/arm, so if you find
anything, please comment, thank you very much!
(mikio mentioned that it could be due to "a side effect of multicast and sockaddr_dl
cleanups on 11-current." in a recent post "[golang-dev] add support for FreeBSD 10")

@mikioh
Copy link
Contributor

mikioh commented Apr 25, 2014

Comment 9:

Thanks for the testing Go 1.3-beta1 on FreeBSD 11-CURRENT.  We now understand that
freebsd11 has more surprises than we expected but its release is two or more years away
(at least after Jan. 2016), so remove Release-Go1.3Maybe tag from this issue for now.

Labels changed: removed release-go1.3.

Status changed to New.

@rsc
Copy link
Contributor

rsc commented May 21, 2014

Comment 10:

If we need a portable frexp/ldexp I'll write a much shorter one than the SunPro code you
found.

Labels changed: added release-go1.4.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 25, 2014

Comment 11:

Can assign a release once the release date is clearer. #9 says it is at least after Jan
2016

Labels changed: added release-none, removed release-go1.4.

Owner changed to @minux.

@l-d-x
Copy link

l-d-x commented Aug 20, 2015

types_freebsd.go if_data8 needs to be changed to work with FreeBSD-11 for network interfaces. see my comments in issue #11641

@mikioh
Copy link
Contributor

mikioh commented Aug 20, 2015

@l-d-x,

Thanks for the information of ABI changes in 11-CURRENT.

@mpasternacki
Copy link

FreeBSD ports issue for if_data8: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202504

Right now, there is a conditionally applied patch that changes the syscall module on FreeBSD-11. I'm not sure what would be a proper approach to get this solved properly in Go source itself without losing compatibility with FreeBSD 10 and earlier. Would a C preprocessor conditional in types_freebsd.go be a good idea? In that case, what about the generated ztypes files that are checked into the repository?

Looking at the source, it seems like golang.org/x/sys/unix is also affected; not sure how to proceed on that front either.

@ianlancetaylor
Copy link
Member

A C preprocessor conditional would not be a good idea.

I don't understand how the change in the if_data8 struct is causing trouble. As far as I can see, if_data8 is used in exactly one place: a field in if_msghdr8. And as far as I can see, if_msghdr8 is not used at all. I don't know why those types are defined.

I think the real problem is the type IfData in ztypes_freebsd_.go, and its effect on IfMsghdr, and its use in route_freebsd_.go. The code in route_freebsd_32bit.go already does crazy stuff based on the kernel version. We would just have to do more of it there and in route_freebsd_64bit.go. Probably we would have to change IfMsghdr to the FreeBSD11 version, which would break compatibility slightly but that's OK since this is the syscall package.

@l-d-x
Copy link

l-d-x commented Aug 26, 2015

It's the offset and size of the ifi_datalen field that has changed in FreeBSD-11 which is causing problems; it's now 16-bits but types_freebsd/ztypes:IfData.Datalen is still 8bits. When parseInterfaceMessage accesses p.Header.Data.Datalen, it's not fetching the entire 16-bit value (little-endian results in a zero value from the MSB) so it returns a wrong InterfaceMessage.Data.

@mikioh
Copy link
Contributor

mikioh commented Aug 26, 2015

already does crazy stuff ...

And freebsd/386 on freebsd/amd64 shows us more crazy things. I think the solution would be just adding support for if_msghdrl into x/sys/unix and internal/syscall packages. It provides TLV-style data access view (at last) so we can make a type like type IfMsghdrl struct { FixedHeaderFields; Len int; Data []byte } for freebsd10 and beyond without worrying about future ABI changes.

@mikioh
Copy link
Contributor

mikioh commented Mar 9, 2016

It's a time to fix this issue. My rough plan is like the following:

  • net: pull routing message/socket parsers off from syscall and put them into a single internal package such as net/internal/route not only for fixing the current ABI breakages on FreeBSD 11 but supporting for future ABI/KBI changes,
  • os: looks like no change seems to be needed,
    • freebsd-11/386 on freebsd-11/amd64 might be needed to test
  • runtime: the use of kqueue/kevent in network poller might require small changes,
    • freebsd-11/386 on freebsd-11/amd64 might be needed to test
  • syscall: deprecate routing message APIs,
  • buildbot farm: having freebsd-11/amd64 buildbot is nice.
    • freebsd-11/386 on freebsd-11/amd64 too

@gopherbot
Copy link
Contributor Author

CL https://golang.org/cl/22451 mentions this issue.

@gopherbot
Copy link
Contributor Author

CL https://golang.org/cl/22990 mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue May 11, 2016
This change reorganizes test cases for surveying network interfaces and
address prefixes to make sure which part of the functionality is broken.

Updates golang#7849.

Change-Id: If6918075802eef69a7f1ee040010b3c46f4f4b97
Reviewed-on: https://go-review.googlesource.com/22990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators May 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants