Use shell-words to parse output from llvm-config#152712
Use shell-words to parse output from llvm-config#152712rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. |
|
|
|
I haven't added a test for this. Not entirely sure how we can do so, if it's desired? |
This comment has been minimized.
This comment has been minimized.
|
Oh, it seems |
Properly checking would require checking out the source into a directory with a space in its name and trying to build from there. That may be kind of expensive in CI time though. Maybe it would be sufficient to have a wrapper we can unit test. |
This comment was marked as outdated.
This comment was marked as outdated.
|
If a backport is approved then that's definitely better! |
|
Hm, no, that commit is already in the llvm-project submodule that we're using. |
|
Looking again, it seems to be using the system llvm so our backports won't help: |
06e14f1 to
d3679f4
Compare
|
Now determining whether |
llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the shell-words crate to parse the output.
d3679f4 to
c30e20a
Compare
From looking at LLVM's So even if we aren't specifically testing the quoted-spaces case, if this continues to work in Windows CI jobs then that should be a pretty decent proxy-test for quote-aware parsing. (I'm assuming that on Windows, filesystem paths will naturally tend to contain |
Provided one or more of the Windows CI jobs are using LLVM 22? |
|
As I understand it, almost all CI jobs use the in-tree LLVM submodule (which is currently 22), except for the ones that specifically exist to test a numbered out-of-tree LLVM. |
|
Ok, the new dependency looks good to me (and david has checked the license) so I think we're fine on that front. This looks good to go, thanks! @bors r+ |
Use shell-words to parse output from llvm-config llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output. r? ChrisDenton Fixes rust-lang#152707
Use shell-words to parse output from llvm-config llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output. r? ChrisDenton Fixes rust-lang#152707
…uwer Rollup of 4 pull requests Successful merges: - #152164 (Lint unused features) - #152712 (Use shell-words to parse output from llvm-config) - #153223 (Fix LegacyKeyValueFormat report from docker build: host-aarch64) - #153345 (MGCA: fix type error handling for const array and tuple lowering logic)
…uwer Rollup of 4 pull requests Successful merges: - #152712 (Use shell-words to parse output from llvm-config) - #152911 (Stabilize `control_flow_ok`) - #153223 (Fix LegacyKeyValueFormat report from docker build: host-aarch64) - #153345 (MGCA: fix type error handling for const array and tuple lowering logic)
Use shell-words to parse output from llvm-config llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output. r? ChrisDenton Fixes #152707
|
@bors yield |
|
Auto build cancelled. Cancelled workflows: The next pull request likely to be tested is #153355. |
…uwer Rollup of 4 pull requests Successful merges: - #152712 (Use shell-words to parse output from llvm-config) - #152911 (Stabilize `control_flow_ok`) - #153223 (Fix LegacyKeyValueFormat report from docker build: host-aarch64) - #153345 (MGCA: fix type error handling for const array and tuple lowering logic)
|
⌛ Testing commit c30e20a with merge 743f7a2... Workflow: https://github.com/rust-lang/rust/actions/runs/22638541691 |
Use shell-words to parse output from llvm-config llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output. r? ChrisDenton Fixes #152707
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
@bors yield |
|
Auto build cancelled. Cancelled workflows: The next pull request likely to be tested is #153355. |
…uwer Rollup of 4 pull requests Successful merges: - #152712 (Use shell-words to parse output from llvm-config) - #152911 (Stabilize `control_flow_ok`) - #153223 (Fix LegacyKeyValueFormat report from docker build: host-aarch64) - #153345 (MGCA: fix type error handling for const array and tuple lowering logic)
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
How does shell-words compare with shlex? The latter is already a dependency of the cc crate. |
Rollup merge of #152712 - eggyal:quote-lib-paths, r=ChrisDenton Use shell-words to parse output from llvm-config llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output. r? ChrisDenton Fixes #152707
|
I wasn't aware of shlex, but from a cursory glance it actually looks slightly better suited as we can avoid parsing into a |
…risDenton Use shlex instead of shell-words In rust-lang#152712, the [`shell-words`] crate was introduced as a new dependency of `rustc_llvm` in order for its build script to parse the output of `llvm-config --quote-paths` and thereby handle paths containing whitespace; however, as [noted by bjorn3], that build script already transitively depends upon the [`shlex`] crate (via the [`cc`] crate) which provides similar functionality. This patch is based off (the already-approved) rust-lang#153419, which would otherwise conflict. [`cc`]: https://crates.io/crates/cc [noted by bjorn3]: rust-lang#152712 (comment) [`shell-words`]: https://crates.io/crates/shell-words [`shlex`]: https://crates.io/crates/shlex r? ChrisDenton
…risDenton Use shlex instead of shell-words In rust-lang#152712, the [`shell-words`] crate was introduced as a new dependency of `rustc_llvm` in order for its build script to parse the output of `llvm-config --quote-paths` and thereby handle paths containing whitespace; however, as [noted by bjorn3], that build script already transitively depends upon the [`shlex`] crate (via the [`cc`] crate) which provides similar functionality. This patch is based off (the already-approved) rust-lang#153419, which would otherwise conflict. [`cc`]: https://crates.io/crates/cc [noted by bjorn3]: rust-lang#152712 (comment) [`shell-words`]: https://crates.io/crates/shell-words [`shlex`]: https://crates.io/crates/shlex r? ChrisDenton
Rollup merge of #153436 - eggyal:shlex-not-shell_words, r=ChrisDenton Use shlex instead of shell-words In #152712, the [`shell-words`] crate was introduced as a new dependency of `rustc_llvm` in order for its build script to parse the output of `llvm-config --quote-paths` and thereby handle paths containing whitespace; however, as [noted by bjorn3], that build script already transitively depends upon the [`shlex`] crate (via the [`cc`] crate) which provides similar functionality. This patch is based off (the already-approved) #153419, which would otherwise conflict. [`cc`]: https://crates.io/crates/cc [noted by bjorn3]: #152712 (comment) [`shell-words`]: https://crates.io/crates/shell-words [`shlex`]: https://crates.io/crates/shlex r? ChrisDenton
View all comments
llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the shell-words crate by @tmiasko (a new dependency) to parse the output.
r? ChrisDenton
Fixes #152707