-
Notifications
You must be signed in to change notification settings - Fork 12.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
[WIP] Add size-limited command interface, take 2 #82930
Conversation
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Oh right, the notorious doc problem. Heh. |
On Linux at least, you should round up to a multiple of the page size, since the arguments are allocated one page at a time: https://stackoverflow.com/a/46946024/502399 POSIX documents that xargs should subtract an additional 2048 bytes for extra headroom: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing assignment. Please r?
request review when you need a look.
@tavianator Judging from what FreeBSD xargs is doing, it looks like subtracting a whole page size is a surer way to go. Updated the code, will push after check. |
I ran into a situation where ARG_MAX was only two pages, on ppc64le with 64k pages: tavianator/bfs#34. So don't overestimate by too much, but one page is probably okay. |
73e0f2f
to
1725fb7
Compare
This comment has been minimized.
This comment has been minimized.
I can really use some help with the doc beast... |
☔ The latest upstream changes (presumably #84103) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hmm, some macro_use problems emerged after the latest pull. Time to go lie down and do nothing about it. |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #82973) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
windows/process: fix some obvious issues, create some more It looks like I really can't get away with the whole storing error thing as they don't have Copy. Maybe I will end up using the ugly problem enum thing like I did with Unix too. Grrr... unix: incremental size, no strlen windows: sort the error type out unix, windows: add temporary dead_code unix: cache envp Windows: draft traits for raw args and custom escapers Windows: raw args trait Windows: minor rename while I figure out where to put sized unix: minor error stuff windows: very rough xargs minor: run formatter it wants tight lines! Windows commandext: apply review suggestions Attempt at code reuse Windows builds. Unix not so much. It builds! Uh. fixup! re-enable set_errno on linux cleanup after slighty botched rebase remove a redundant macro arg appease tidy process_common: subtract page size for headroom
Closing this due to inactivity |
This is a reboot of #74549, which aims to fix #40384. I've changed the thing to use one shared
Arg
trait, and there is a working-looking xargs impl. The things to do are:maybe
interface and check that they succeed.xargs
are more testable. Maybe later.as_inner_mut()
). Should be a quick thing.force_quote
thing will make it the new append-while-adding a sneaky behavior change.