-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/cgo: cannot convert from type *_Ctype_char to type _Ctype_HANDLE (1.18 regression) #51726
Comments
@josharian is this a problem in tip too? (I assume it is). If that's the case, this issue should be put in the 1.19 milestone (to track fixing on tip), and the backport issue that you can ask gopherbot to open will be the one in the 1.18.1 milestone (to track the backporting). |
@ALTree oh right. thanks. @gopherbot please open a backport issue for Go 1.18. This is a compilation regression. |
Backport issue(s) opened: #51728 (for 1.18). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
(This bug was minimized from https://github.com/cyolosecurity/certstore/blob/main/certstore_windows.go#L666) /cc @ianlancetaylor |
…to Windows handle types" This reverts commit 635e493. This is a temporary workaround for golang#51726. It isn't a good one, as that commit was fixing an important bug, but it is at least no worse than Go 1.17. Once that issue has been fixed properly upstream, we can revert this revert and pull in the proper fix. Change-Id: I8b3fbad2392d12a84f977761a57e545a4678cca9
…ws handle types" This reverts commit 635e493. This is a temporary workaround for golang#51726. It isn't a good one, as that commit was fixing an important bug, but it is at least no worse than Go 1.17. Once that issue has been fixed properly upstream, we can revert this revert and pull in the proper fix. Change-Id: I8b3fbad2392d12a84f977761a57e545a4678cca9
…lscale Go toolchain The certstore code is impacted by golang/go#51726. The Tailscale Go toolchain fork contains a temporary workaround, so it can compile it. Once the upstream toolchain can compile certstore, presumably in Go 1.18.1, we can revert this change. Signed-off-by: Josh Bleecher Snyder <[email protected]>
…lscale Go toolchain The certstore code is impacted by golang/go#51726. The Tailscale Go toolchain fork contains a temporary workaround, so it can compile it. Once the upstream toolchain can compile certstore, presumably in Go 1.18.1, we can revert this change. Note that depaware runs with the upstream toolchain. Signed-off-by: Josh Bleecher Snyder <[email protected]>
…lscale Go toolchain The certstore code is impacted by golang/go#51726. The Tailscale Go toolchain fork contains a temporary workaround, so it can compile it. Once the upstream toolchain can compile certstore, presumably in Go 1.18.1, we can revert this change. Note that depaware runs with the upstream toolchain. Signed-off-by: Josh Bleecher Snyder <[email protected]>
…lscale Go toolchain The certstore code is impacted by golang/go#51726. The Tailscale Go toolchain fork contains a temporary workaround, so it can compile it. Once the upstream toolchain can compile certstore, presumably in Go 1.18.1, we can revert this change. Note that depaware runs with the upstream toolchain. Signed-off-by: Josh Bleecher Snyder <[email protected]>
CL 350070 is based on the valid observation that although the type of Windows Now, perhaps it's true that Anyhow, if we are expected to convert Go pointers to I don't see a problem with the code in cyolosecurity, and the code can easily be changed to compile by writing defer C.LocalFree(C.HLOCAL(unsafe.Pointer(cmsg))) So it seems to me that the Go 1.18 behavior is safer and code that plays fast and loose with pointers should be adjusted. (Note that the Go 1 compatibility guarantee does not apply to cgo code.) Of course it would be better if that code could continue to work, and I'm certainly open to suggestions. |
See golang/go#51726 for discussion.
I'll offer a bit more context here: The Nowadays, for better or worse, the In general, I'd suggest that the best rule of thumb is to avoid allocating memory using those functions unless other APIs involved specifically require it -- eg the Win32 clipboard APIs expect to work with |
See golang/go#51726 for discussion.
…to Windows handle types"" This reverts commit 860e090. Per conversation in golang#51726, we are going to work around the issue in github.com/tailscale/certstore by explicitly casting to unsafe.Pointer.
…to Windows handle types"" This reverts commit 860e090. Per conversation in golang#51726, we are going to work around the issue in github.com/tailscale/certstore by explicitly casting to unsafe.Pointer.
@dblohm7 Thanks. It looks like the code that led to this issue is calling So I think there is a plausible argument that the code in question is technically incorrect and this change caught the error. |
OK, sounds like this working as intended. Thanks, @ianlancetaylor and @dblohm7. |
Thanks, closing this issue as there currently doesn't seem to be anything to change in the Go tools. Please comment if you disagree. |
This code compiled on Windows with Go 1.17, but not with Go 1.18:
The error message is:
Reverting 635e493 allows the code to compile again.
cc @eliasnaur @randall77 @dsnet @bradfitz
The text was updated successfully, but these errors were encountered: