Skip to content

Implement split_maybe_lib_args() to handle paths with spaces #84

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

Closed
wants to merge 1 commit into from

Conversation

laumann
Copy link
Collaborator

@laumann laumann commented Oct 13, 2017

When using link_deps() full paths are added to target_rustcflags,
which doesn't work well with split_maybe_args(), as it splits on space.

Fixes #81

When using `link_deps()` full paths are added to target_rustcflags,
which doesn't work well with split_maybe_args(), as it splits on space.

Fixes #81
@laumann
Copy link
Collaborator Author

laumann commented Oct 13, 2017

@cuviper Could you try this out on Windows? I only ran it on Linux...

// split_maybe_args(), empty strings filtered out.
fn split_maybe_lib_args(&self, argstr: &Option<String>) -> Vec<String> {
if let Some(ref s) = *argstr {
s.split("-L")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I have a path like "-L Ooh-La-La"? Or even if you incorporating spaces in your split, " -L " is also legal in a path.

This will also act weird if people have their own non--L stuff in target_rustcflags.

@laumann
Copy link
Collaborator Author

laumann commented Oct 13, 2017

Yeah, you're right. To solve this properly, target_rustcflags should probably be changed to a Option<Vec<String>> or something.

@cuviper
Copy link

cuviper commented Oct 13, 2017

IMO it's going to be too hard to really split args properly. Maybe you can get it good enough though...

The best solution is really to maintain a vector of args from the start, but I see all the Config fields are public, so changing anything will be an API break.

@laumann
Copy link
Collaborator Author

laumann commented Oct 13, 2017

Yes, that would be new minor version, at least. Proper paths handling is hard :-/ Thanks for the feedback!

@cuviper
Copy link

cuviper commented Oct 13, 2017

BTW AppVeyor is free, and pretty easy to set up. That's how I noticed that the proposed rayon change didn't work on Windows.

But I do have access to a Windows machine too, and this change is enough to get your test-project to pass.

@laumann
Copy link
Collaborator Author

laumann commented Feb 12, 2018

I'll close this. I'll try to see if I can get a proper fix into rustc/compiletest, modelling target_rustcflags as Option<Vec<Path>> or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants