-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
regexp: Invalid character class on Windows ARM #68268
Comments
I reported this downstream google/go-cmp#359, but I believe the issue is in go. |
None of the related issues match this problem. |
Hi @anacrolix I am having trouble reproducing this problem -- when I build + run your test case on our Your |
Thanks for looking. Specifically I cross compiled from darwin to windows/amd64, then ran that binary on Windows 11 on windows/arm64. |
Still can't reproduce. From my darwin arm64 machine I built the program you listed via GOOS=windows GOARCH=amd64 go build prog.go downloaded the resulting executable to a |
I couldn't reproduce as well. This feels like the error you would get by copying the regexp from the internet and some character in the regexp string would have a different encoding. But given this happens with a library upstream I'd say it is probably something to do with the OS. |
Could it be CGO related? I am linking in a bunch of other stuff, and using a cross compiler (x86_64-unknown-linux-gnu-gcc) for some of those cgo parts. At a stretch, could it be triggered by some kind of memory or emultation corruption? Are your windows/arm64 instances emulated (mine is). The (downstream) library you mention is heavily used, AFAICT the character classes it's using are well defined too. Let me know what else I can provide? Thanks |
CGO: sure, I can certainly imagine problems there, but it depends on the code of course.
The Go team windows/arm64 builders are Azure VMs, and I am pretty sure they are backed by actual arm hardware. |
I'll try to construct a minimal reproduction. Thanks for looking into it |
I'm only able to reproduce with upx involved. I've mentioned an issue in upx that looks related. Obviously this could be out of the scope of Go, however I'm able to reproduce it from a part of my code that additionally seems to incorrectly depend on I've created a repo to reproduce at https://github.com/anacrolix/go-issue-68268. It contains some code guarded by conditions, and additionally that can be commented out to avoid compiling in the dependencies. The behaviour varies significantly if you mess around with it. The justfile contains some build steps, and copies to my Windows ARM VM. If I use my package
CGO is not related at all. I don't have real ARM hardware running Windows, but I also think that's not the problem either. |
@anacrolix The best way to help make progress on the upx side is to "Paste, drop, or click to add files" (or give the URL) of an actual (never compressed yet) executable file which runs, but which fails when compressed by upx. (ref: upx/upx#443) So far I cannot find such a file here. |
@jreiser I thought it would be preferable to build it yourself from source (per the repo). Here's the exe that runs fine before upx. |
@anacrolix Thank you for the file. An actual executable file is a cut point in the graph of debugging possibilities, so it is the first place to look. Repo, integrated development environment (options, menu settings, environment variables, compiler/linker, Python site packages integrations, etc.), and system or local static libraries often introduce dozens of variables. Variations in the OS (Windows 11, latest 10, early 10, 7) sometimes present their own problems, but having a specific actual executable file still helps. |
@jreiser what's the next step? Should I open a new issue in upx? Is there any possibility that Go is at fault here? Since this issue only occurs if upx is involved, should I close it? |
Yes, please open a new issue in upx, and close this issue with golang. We have seen issues where a program that has been compressed by upx gets lost trying to inspect the address space or the compressed file. This is the fault of the program, because upx guarantees only the mappings that are described by the PE file. If there are Resources in the file that are not mapped into the address space, then you should try the various upx compression options for a PE file
|
Go version
master and 1.22 (and probably other versions)
Output of
go env
in your module/workspace:What did you do?
I'm using github.com/google/go-cmp on Windows ARM. It was compiled for amd64. This is a playground for it, but obviously it's not cross compiled: https://go.dev/play/p/8a4Kt1DD-al?v=gotip.
What did you see happen?
A panic during init. The init code looks fine. The binary also appears to be loading fine, it just doesn't like this character class.
What did you expect to see?
go-cmp's init to work normally and main to start.
The text was updated successfully, but these errors were encountered: