Conversation
6df2fc7 to
bcdf480
Compare
Fix paths with spaces in Windows batch wrapper scripts by using platform-specific
quoting for linker arguments.
Changes:
- Refactor cc_args to push arguments separately (e.g., push "-target" and
"x86_64-linux-gnu" instead of "-target x86_64-linux-gnu")
- On Unix: use shell_words::join() for single-quote quoting
- On Windows: use custom double-quote quoting for cmd.exe compatibility
- Internal quotes in Windows paths are escaped by doubling ("")
Also replaces shlex with shell-words crate throughout, as shell-words
is more actively maintained.
Fixes #381
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #381 where linking fails when directory paths contain spaces on Windows. The fix involves properly quoting arguments in linker wrapper scripts and replacing the shlex crate with the more actively maintained shell-words crate.
Changes:
- Replaced
shlexdependency withshell-wordscrate throughout the codebase - Split compiler flag arguments (like
-target,-include) into separate vector elements to enable proper per-argument quoting - Implemented platform-specific argument joining:
shell_words::joinfor Unix, customquote_for_batchfunction for Windows batch files - Added
setlocal DisableDelayedExpansionto Windows batch files to prevent!VAR!expansion issues
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Cargo.toml | Replaced shlex dependency with shell-words 1.1.1 |
| Cargo.lock | Updated lockfile to reflect the dependency change |
| src/zig.rs | Migrated from shlex to shell_words API; split combined arguments into separate elements; implemented custom Windows batch file quoting; added DisableDelayedExpansion to Windows batch wrapper; added tests for quoting functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2f28e98 to
1e5312d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
shell_words::jointo properly quote cc_args when joining them for wrapper scripts. This handles paths with spaces (e.g., cache directory on Windows likeC:\Users\Vincent Foo\AppData\Local\...).Also replaces shlex with shell-words crate throughout, as shell-words is more actively maintained.
Fixes #381