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

x/sys: stdio handle inheritance getting changed after dynamic loading of a DLL #52498

Closed
aayush13890 opened this issue Apr 22, 2022 · 7 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@aayush13890
Copy link

This issue was first reported against golang/go repo and was addressed in Go 1.17.
Issue: #44876
Fix: 4c8f48e

But this change is not part of golang/sys code. Changes in the above commit need to be made in golang/sys repo as well. Thanks!

@gopherbot gopherbot added this to the Unreleased milestone Apr 22, 2022
@thanm thanm added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 22, 2022
@thanm
Copy link
Contributor

thanm commented Apr 22, 2022

Sounds like a good change to make.

Want to send a CL?

@alexbrainman
Copy link
Member

I doubt anyone uses golang.org/x/sys/windows.Stdin. People use either os.Stdin or syscall.Stdin.

But sure. We should change golang.org/x/sys/windows code too.

@aayush13890 do you want to send a change?

Here is how to contribute

https://go.dev/doc/contribute

Alex

@rkennedy
Copy link

I agree that few people actually use that Stdin. However, the init function will still always initialize those variables, which has the process-wide side effect of clearing the inheritance flags from the standard handles, so it's definitely a bug that needs fixing.

On the other hand, if it's really the case that nobody uses the identifiers from x/sys, then perhaps the best action would be to remove the declarations entirely?

@aayush13890
Copy link
Author

@alexbrainman @thanm any suggestions on the @rkennedy 's question above? I will go through the steps to contribute in the meanwhile. Thanks!

@alexbrainman
Copy link
Member

@alexbrainman @thanm any suggestions on the @rkennedy 's question above?

@aayush13890 if you refer to

the best action would be to remove the declarations entirely

I don't think we can remove the declarations. We always try not to break people code. So even if one person is using this code, we should try and fix them.

Alex

@gopherbot
Copy link

Change https://go.dev/cl/402714 mentions this issue: windows: do not change stdio handle inheritance

@aayush13890
Copy link
Author

aayush13890 commented Apr 27, 2022

@alexbrainman @rkennedy @thanm I have submitted the CL. I am making a change to this repo for the first time. Please let me know if I am missing anything. Also, how do I build the code and run all the tests inside
sys/windows folder in my source code (https://github.com/golang/sys/tree/master/windows)?

I tried running:

-bash-4.2#pwd
/root/Aayush/go-repos/go-sys/sys

-bash-4.2# ls
AUTHORS codereview.cfg CONTRIBUTING.md CONTRIBUTORS cpu execabs go.mod internal LICENSE PATENTS plan9 README.md unix windows

-bash-4.2# go test ./...
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
ok golang.org/x/sys/cpu (cached)
ok golang.org/x/sys/execabs 0.016s
ok golang.org/x/sys/internal/unsafeheader (cached)
ok golang.org/x/sys/unix 0.612s
ok golang.org/x/sys/unix/internal/mkmerge (cached)
? golang.org/x/sys/windows/mkwinsyscall [no test files]

@golang golang locked and limited conversation to collaborators Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants