-
Notifications
You must be signed in to change notification settings - Fork 2.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
Avoid hidden interactive ssh prompts at low verbosity levels. #9638
base: main
Are you sure you want to change the base?
Conversation
I don't like having this depend on verbosity, the different behaviour is bound to be confusing one day. Eg imagine someone trying to debug their CI pipeline by turning up verbosity. Does the error message make sense when this fails? I'd think we might need to catch an exception somewhere and make sure the log says which repository / host it is that we are failing to clone. |
i agree having it tied to verbosity isn't ideal but I think having an escape hatch to access interactive git prompts is practically helpful perhaps a better solution would be to disable the output of the i'm looking at the dulwich source and it's actually more prone to cause unexpected behavior than it initially seems. it appears that passing ssh_command as a kwarg makes dulwich ignore the GIT_SSH_COMMAND and GIT_SSH environment variables so it could easily change other ssh behavior unintentionally based on verbosity settings looking into the CI failures it seems that dulwich just blindly passes kwargs to whatever underlying class it decides to use based on the url so it fails with non ssh urls... |
The only behaviour that should change when a user configures verbosity, is verbosity. Not sure I follow dulwich issue, but I guess report it there? These things are never so straightforward as you'd hope, are they? |
so i've confirmed stopping the console progress indicator gets the output working, currently i just hacked it together with a global. I'm working on something a bit more robust it looks like the dulwich was fixed in upstream for this specific case (after the most recent pypi release) https://github.com/jelmer/dulwich/blob/06405c8e29e0d3716384e582c1b83a8e05fa3563/dulwich/client.py#L699 before, passing ssh_command in kwargs would fail if it wasn't a git+ssh url since it would eventually get passed to GitClient which didn't accept that argument. it looks like the issue still exists for the it looks like it's been reported previously |
not sure what you have in mind with progress indicator but if it is even slightly complicated or controversial I would instead continue in the direction this pull request was going
|
the new solution I just pushed has the downside that the timer will pause during git operations even if there is no interactive input but I think fixing that would be significantly more complicated. beyond causing the timer to pause when it maybe shouldn't I think this change should be pretty safe demo with time.sleep Without the interactive prompt the error is just "Host key verification failed.", verbose or not git errors don't seem to indicate what dependency they failed on. other git errors such as authentication failures are largely the same, e.g. just "[email protected]: Permission denied (publickey)." I think breaking the GIT_SSH_COMMAND environment variable should absolutely be avoided. It covers a lot of use cases that poetry presumably doesn't want to try to create bespoke solutions for. I frequently use it to specify which private key should be used but it covers many more esoteric cases as well. |
I still prefer to head in the direction of never waiting for input: eg for CI use, and also for consistency - cf #5880 (when poetry uses the system git). But possibly others will feel differently it should be easy for poetry to add a better log, just add broader exception handling here that logs the url and re-raises. Not sure about |
how about
|
Progress in this direction is blocked on a dulwich release, though. |
notably in this case, with the proposed changes, cloning the repo manually can work while poetry doesn't. the extra output is specifically to try to make sure the user can get from working git clone to working poetry, ideally without making them read the poetry source code I think between interactive authentication and ssh key passphrases just telling people to simply not ™️ isn't reasonable, even if we prioritize CI/CD behavior by default
|
You want to write a log aimed at exactly this issue because that is what you have hit and are now thinking about. But unless we have a highly specific exception telling us what has gone wrong, a highly specific error message is likely to be counterproductive for all the other possible errors. That is why I suggest just reporting whatever error we get, only adding a little more detail eg exactly which url it was that poetry could not clone. |
Pull Request Check List
Resolves: #9618