-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Cannot pip install
SVN dependency with authentication using SVN 1.8+
#6386
Comments
pip install
SVN dependency using SVN 1.8+
pip install
SVN dependency using SVN 1.8+pip install
SVN dependency with authentication using SVN 1.8+
It seems like the most "proper" way would be to make |
There does seem to be precedent for special casing based on Subversion version: pip/src/pip/_internal/vcs/subversion.py Line 157 in e5353f2
pip/src/pip/_internal/vcs/subversion.py Line 44 in e5353f2
pip/src/pip/_internal/vcs/subversion.py Lines 174 to 175 in e5353f2
|
My initial thought on this is that passing Also, it seems like this shouldn't be done by default, but perhaps only if we can be sure pip is being used interactively (e.g. if |
It's worth pointing out that ptys aren't an option on Windows. |
@cjerdonek Yeah, I agree that a pseudo-terminal would be a more complex solution. The only issue with trying to pass We could work around this with I think this could be a proposed solution (in pseudocode): svn_version = get_version() # `svn --version`
if svn_version >= 1.8 and sys.stdout.isatty():
svn_options.append('--force-interactive')
else:
# Do nothing
pass Thoughts? |
While this might look easy, I think this might take a bit more work in certain ways to fully get right. Some thoughts:
|
Okay, so just so I'm clear, you mean not supporting Subversion 1.6 and 1.7 (RHEL 6/7 and CentOS 6/7)? So we would push the # CentOS 7
$ svn --version
svn, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
$ svn --force-interactive
svn: invalid option: --force-interactive I don't really disagree in principle (it's a burden to support old tools), but just wanted to be clear that
If we can agree on a way forward I'm willing to try to put together a PR. But if it involves refactoring the |
I meant passing the flag only for SVN 1.8+ (which is why I also suggested caching the value of getting the version). But sorry, I had missed or forgotten that older versions were interactive by default in the absence of any option. So you can disregard that last bullet. :)
Okay, great. But yeah, I'd prefer if you waited a bit, if that's okay. I actually have a VCS-related PR queued up (as a follow-up to PR #6356) that I'm now planning to modify in response to this issue. (The PR should become simpler in fact, and should help for this.) I'd also like to think about how If you want I can describe some of the VCS changes I'd like to see. They aren't super hard but may involve touching a few things. I'll also think to see what, if any, of this PR can be done in advance of the refactorings. |
One thing you could do now in preparation is add a |
Btw, is there a way to prevent interactivity on older versions of SVN (e.g. to prevent hangs)? |
# CentOS 7.6.
$ svn --version
svn, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
$ svn checkout --help
...
Global options:
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
|
@cjerdonek I submitted #6390, let me know if that is what you were looking for. |
Thanks. A related positive change IMO would be to pass that flag to SVN when SVN is 1.7 and |
@cjerdonek I think we need to be very cautious about this. For example, it's currently very useful that when
This allows us to use It's not a difficult configuration to make sure |
Okay, good to know. This is also why I said the following above:
By the way, your point would also apply to the SVN 1.8+ case, with the approach for this PR of checking |
Actually, can you confirm whether you can really do this with recent versions of pip? It appears as if this isn't possible as of pip 10.0 (since |
Yeah, I'm wondering if we should avoid suppressing interactive in either case based on
I can confirm the following configurations all work with stock installed tools on CentOS 7.
Configuration
Test 1:
|
@cjerdonek After some digging into the Subversion source code (always a fun activity), I found where https://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_subr/prompt.c As I understand it, So I believe this explains why |
After some more testing, perhaps the I wrote a small Python script that checked if # tox.ini
[testenv]
commands = python tty_test.py $ tox -e py36 All three returned |
Thanks for all your research and digging! 👍 |
@johnthagen Let me know if you want my thoughts on the next steps, or if you want to propose something and I can react to that. I think it might be helpful to do at least one more incremental PR before landing the functionality. |
For reference,
Just so we're on the same page, our current pseudocode proposal is: svn_version = get_vcs_version() # `svn --version`
if not sys.stdin.isatty():
# TODO: Test that `tox` `deps` install step runs `pip` in a TTY.
svn_options.append('--non-interactive')
elif svn_version >= 1.8:
svn_options.append('--force-interactive') Or a more conservative proposal is to just address needing to get the password prompt on 1.8+. svn_version = get_vcs_version() # `svn --version`
if svn_version >= 1.8 and sys.stdin.isatty():
svn_options.append('--force-interactive') The second has less risk of breaking situations were you want to be prompted on 1.7, but has the risk that 1.7 and 1.8 could behave differently from What are your thoughts? |
Do you know for sure that I was thinking the next PR could define and test a method on the I think the I also think the class should grow a private |
I agree with your summary, by the way. Thanks! |
According to: https://svn.apache.org/repos/asf/subversion/trunk/CHANGES
|
I believe this is where the options would need to be applied: pip/src/pip/_internal/vcs/subversion.py Lines 84 to 93 in c8e9caa
|
Regarding the various SVN invocations to consider, there are also invocations of commands like "export", "update", etc. When editable mode is being used, a different directory is used, and in-place updates can occur. I'm guessing at least "update" would also need the options passed. Re: tox, I did a quick check of the tox code base, and it looks like |
Can confirm the following commands are using in
|
@cjerdonek With #6439 merged, I think the last thing that needs to be completed is for us to actually add the pip/src/pip/_internal/vcs/subversion.py Lines 271 to 278 in 07ce2ab
Since this is when we actually change functionality, I plan to additionally test out the proposed How would you like to proceed? |
@johnthagen That sounds good (and glad to hear you can test out on private repos). I don't think there will be much code. But if you have any questions in advance, feel free to let me know. |
@cjerdonek. Do you know which |
The next one (19.2). |
Also, the next release will probably happen sometime in July (every 3 months). |
Wanted to report that I tested the master branch at 83d813c on a private SVN repository in the following configurations:
Everything worked correctly, so I'd say everything is good to go for 19.2. I'll test one final time when 19.2 is released to give a final smoke test as it goes into the wild. |
Great! Thank you! 👍 |
Environment
Description
Starting with SVN 1.8, SVN is non-interactive by default. Before that, it will prompt for a password when the user performs a
svn checkout
.The problem is that when
pip
calls out tosvn checkout
it is not interactive, and will not allow the user to enter their password. One solution is to store SVN passwords, but that may not be allowed by company rules or that may simply not be desirable for security reasons.For some more context see
--force-interactive
arg to prompt password gedex/wp-tools#33The solution seems to be:
<1.8
, work as it does now (no extra arguments needed).>=1.8
, add the--force-interactive
command line flag.Some context from
svn checkout --help
Perhaps another solution would be to make
svn
think it's being called from a terminal device when called frompip
?Using environment variables is another potential option, but it runs into the same fundamental issue: users have to store their password (and in this case in plaintext). This doesn't seem to be appropriate for user workstations that could be shared.
Subversion versions on popular supported Linux distros:
Expected behavior
On SVN 1.7, 1.8, and 1.9, when
pip
installs an SVN dependency, it prompts the user for their password if they have not saved it locally.How to Reproduce
sudo apt install subversion
.svn --version
will return1.9.7
.venv
:$ python3 -m venv venv $ source venv/bin/activate (venv) $ pip install pip==19.0.3
pip install
an SVN URL from a URL that requires authentication.pip
's invocation ofsvn
will not prompt for a password, so it will always fail to install.References
pip/src/pip/_internal/vcs/subversion.py
Line 58 in e5353f2
pip/src/pip/_internal/vcs/__init__.py
Line 546 in e5353f2
pip/src/pip/_internal/utils/misc.py
Line 722 in e5353f2
The text was updated successfully, but these errors were encountered: