-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
parse_flags fails with whitespaces in directories #4382
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
Comments
I investigated this a little bit. The >>> from numpy.distutils.npy_pkg_config import parse_flags
>>> d = parse_flags('"-L/my_folder/with whitespaces/in_it"')
>>> d = parse_flags('-L/my_folder/"with whitespaces"/in_it')
>>> d = parse_flags('-L/my_folder/with\\ whitespaces/in_it') The only issue that I see would be that this is not backwards compatible. It would break any code relying on literal interpretation of quotes and backslashes. It would be unusual for someone to be relying on this, so it may not be an issue. The full details of the parsing rules for POSIX mode and the default mode are documented. If a core developer gives me a go-ahead, I will submit a PR to enable POSIX mode. |
I don't think that that will give problems. Please go ahead with the PR I'd say. Besides the above, checking that raw strings work as expected would also be good. |
First of all, great that someone had a look on that! However, the original problem, namely building scipy with numpy being in a folder with spaces still exists. The reason is, that get_pkg_info from distutils.misc_utils that calls parse_flags calls it with strings like e.g.: "-L/my_folder/with space/in_it -lnpymath -lm" This does however still not work. So either this needs to return the config properly escaped such that the fixed parse_flags can parse it easily or parse_flags needs to be fixed such that it can deal also with not properly escaped input. |
@MichaelAdello Can you supply the command you are using to build SciPy as well as the directory setup so I can reproduce your problem? |
The build will fail for two issues: |
Thanks! I believe I fixed the issue. Can you try the code in PR #4421 and tell me if it works for you? |
Add escaping and quoting of dirs and enabled POSIX support in lexer. Closes numpy#4382.
Doesn't crash during the installation process any longer and source files seem to be escaped properly, however I still spotted that error message in the log: non-existing path in 'scipy/special': "'''/home/mprim/python/folder with space/build/lib/python/numpy/core''/lib' -lnpymath -lm" It is around line 100 in the building log, so you should see it also at the beginning. As that's the argument that is passed to parse_flags there might be still some small issue. |
Can't check, but the linked pull request was merged and claims to fix this. Plus it is an old build issue. gh-5765 may also be related. |
Closing a issue logged almost 5 years ago! Truly a success story for issue tracking tools ;) |
Scipy failed to build today when using a self-compiled version of numpy, being in a folder that had some whitespaces in it. I could track the issue back to numpy's parse_flags method, which fails if there are whitespaces in the directory.
The following 5 lines of python code will allow to reproduce the issue:
from numpy.distutils.npy_pkg_config import parse_flags
d = parse_flags("-L/my_folder/without_whitespaces/in_it")
print d
d = parse_flags("-L/my_folder/with whitespaces/in_it")
print d
The text was updated successfully, but these errors were encountered: