-
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
proposal: syscall,x/sys/windows: deprecate CommandLineToArgv due to inappropriate return type #63236
Comments
Change https://go.dev/cl/530275 mentions this issue: |
I'm not sure how we should address this. Options include:
|
Change https://go.dev/cl/531175 mentions this issue: |
I prefer option 2. Current I also like that users looking for |
…discrepancies Notably, this fixes the escaping of the first argument when it contains quoted spaces, and fixes a panic in DecomposeCommandLine when it contains more than 8192 arguments. Fixes golang/go#58817. For golang/go#17149. For golang/go#63236. Change-Id: Ib72913b8182998adc1420d73ee0f9dc017dfbf32 Reviewed-on: https://go-review.googlesource.com/c/sys/+/530275 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
For golang/go#63236. Change-Id: Id6c458e2ee2291e28685d24e86c05702d9fd132a Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/sys/+/531175 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/531176 mentions this issue: |
This also affects the |
It just occurred to me that the observed limit was almost certainly a side effect of the Go wrapper for CommandLineToArgv (golang/go#63236) rather than a behavior of the system call itself. Updates golang/go#63236. Updates golang/go#58817. Change-Id: Icc9db01f201f54a78044d1c48e0883e098cfb5e5 Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/sys/+/531176 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
Converting to a proposal based on option (2). The proposal is, specifically:
|
What version of Go are you using (
go version
)?https://pkg.go.dev/golang.org/x/sys@v0.12.0/windows#CommandLineToArgv
What did you do?
Fuzz test
windows.DecomposeCommandLine
, which used to usewindows.CommandLineToArgv
as follows:What did you expect to see?
A return type from
CommandLineToArgv
that is consistent with itsargc
return value, and matches the signature documented in https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw.What did you see instead?
Go's
CommandLineToArgv
wrapper hard-codes the bounds on the return value at 8192 entries of 8192 characters each:The hard-coded bound is incorrect, and can cause callers to panic when attempting to index into
argv
byargc
.(attn @golang/windows)
The text was updated successfully, but these errors were encountered: