-
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
bootstrap: add quoting support to avoid splitting #132635
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @onur-ozkan (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Can this use something like https://docs.python.org/3.10/library/shlex.html#shlex.split? |
Does that work for python2 aswell? |
AFAICT that exists for python2 https://docs.python.org/2.7/library/shlex.html as well (Unrelated: do we really need to keep supporting python 2?) |
Not as is. That splits on whitespace, right? We want to split on periods. If you want me to use |
9eae8f9
to
435e53e
Compare
AFAIUI, the splitting in |
Bootstrap should be compatible with python versions older than 3.6. Some distros (and possibly even some of our build runners) might still use very old python versions. |
435e53e
to
fe04396
Compare
Got it. I've added the relevant word character to the last commit. |
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.
LGTM.
Could you please squash your commits?
@rustbot author |
With this change, it is now possible to pass quotes to the configure script, such as `./configure.py --set=target.\"thumbv8m.main-none-eabi\".linker=/linker` , which will treat `thumbv8.main-none-eabi` as a whole part. Currently, the string would be split into two elements: `thumbv8`, and `main-none-eabi`.
fe04396
to
8471c6b
Compare
@rustbot review @onur-ozkan done! |
@bors r+ rollup=iffy |
☀️ Test successful - checks-actions |
Finished benchmarking commit (fe43131): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.0%, secondary 4.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 1.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 780.818s -> 781.131s (0.04%) |
With this change, it is now possible to pass quotes to the configure script, such as
./configure.py --set=target.\"thumbv8m.main-none-eabi\".linker=/linker
or
./configure.py '--set=target."thumbv8m.main-none-eabi".linker=/linker'
, which will treat
thumbv8.main-none-eabi
as a whole part. Currently, the string would be split into two elements:thumbv8
, andmain-none-eabi
.The approach taken is to perform custom splitting instead of using
str.split()
and then repairing the split. Also, There are numerous corner cases not handled: the custom split doesn't differentiate between single quotes or double quotes, so it is perfectly possible to pass./configure.py --set=target.\"thumbv8m.main-none-eabi\'.linker=/linker
and the behaviour would be the same as with all double quotes or single quotes.As for the code, i'm unsure on whether to delimit strings with double or single quotes. I've seen both single quotes and double quotes used to delimit strings, like in
and this a handful of lines down:
Please advise on the wanted one.
Fixes #130602
r? @onur-ozkan
Thanks in advance for the feedback!