Skip to content
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

Fixed file paths with spaces causing pip to choke on *nix systems #611

Closed
wants to merge 1 commit into from

Conversation

blakfeld
Copy link

@blakfeld blakfeld commented May 18, 2014

Spaces in the file path causes virtualenv pip to choke. I added a bit to re-write the shebang if the system is not windows, and the path contains a space. I basically just modified the "fixup_scripts" function.

Tested locally, seems to work pretty well :)

@kevinmarks
Copy link

How has this bug from 2011 been allowed to persist for so long? I have lost hours debugging this on Mac OS X

@ludovicriffault
Copy link

Any updates on this please? I still have the problem :(

@blakfeld
Copy link
Author

Sadly I don't think they have any intention of merging this or fixing the problem.

@pfmoore
Copy link
Member

pfmoore commented Feb 10, 2016

I'm not a Unix user but my understanding is that not all Unix systems support the sort of quoting you're doing. (This has been debated at length on at least one other PR). If this PR is to have any chance (and it won't be me that commits it - as I say I don't have the Unix knowledge) it'll need to be confirmed as a correct fix on various Unix systems

@blakfeld
Copy link
Author

Hmm, maybe, I'll have to go hunt that down. All I'm doing is escaping the space with a backslash. That should be supported by all the major shells (sh, bash, and zsh for sure).

@pfmoore
Copy link
Member

pfmoore commented Feb 10, 2016

Shebang lines are supported by the kernel, not by the shell. And the kernel can be pretty simple.

I believe there is one Unix flavour that insists on hash, bang, no more than 32 arbitrary characters, newline. And then uses the characters between #! and the newline as a completely uninterpreted filename (so backslashes are treated as actual backslashes, spaces as actual spaces, etc). On that version, no form of excaping is needed, but equally no form works. Compare that to other versions which allow arguments and terminate the executable name with a space - some of those have escaping conventions. There is no valid way of satisfying both of those sets of rules simultaneously.

As I say, my knowledge is limited, so I wouldn't take the above as guaranteed - but I believe that's the gist of the problem (basically it's insoluble in a platform-independent way).

@blakfeld
Copy link
Author

Oh awesome, I had no idea that was handled that far down the stack. Thank you for taking the time to type that up, that was incredibly informative!

@ludovicriffault
Copy link

Thanks for answers! Any of you know a workaround to get this fixed? I really need to use pip with virtualenv in a directory with whitespace.

@pfmoore
Copy link
Member

pfmoore commented Feb 11, 2016

@ludovicriffault You can probably hand-edit the shebang line on the scripts to a form that your local system handles - it's not ideal but it should work.

@BrownTruck
Copy link

Hello!

As part of an effort to ease the contribution process and adopt a more standard workflow virtualenv has switched to doing development on the master branch. However, this Pull Request was made against the develop branch so it will need to be resubmitted against master.

If you do nothing, this Pull Request will be automatically migrated by @BrownTruck for you.

If you would like to retain control over this pull request then you should resubmit it against the master branch, closing and referencing the original Pull Request.

If you choose to migrate this Pull Request yourself, here is an example message that you can copy and paste:

Spaces in the file path causes virtualenv pip to choke. I added a bit to re-write the shebang if the system is not windows, and the path contains a space. I basically just modified the "fixup_scripts" function.

Tested locally, seems to work pretty well :)

---

*This was migrated from pypa/virtualenv#611 to reparent it to the ``master`` branch. Please see original pull request for any previous discussion.*

If this pull request is no longer needed, please feel free to close it.

@BrownTruck
Copy link

This Pull Request has been automatically migrated to #910 to reparent it to the master branch. Please see the new pull request for any new discussion.

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.

5 participants