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
ssh: allow multiple -l options and user@host to override one another (fixes regression)
#91
Conversation
|
Please note that I also sent an accompanying mail to openssh-unix-dev@mindrot.org, as https://www.openssh.com/report.html says:
However, this appears to be a blatant lie, as I received a reply:
Thanks for the fish. In any case, I will reproduce my mail here: -- snipsnap -- Hi team, We noticed a regression in OpenSSH v7.7p1 that was not listed in the Now, it is clear that there is contradicting information here: is In OpenSSH v7.6p1, the user name specified in the URL won: it would However, in OpenSSH v7.7p1, At least it caught us by surprise. The commit in question is this: 887669e (upstream commit, 2017-10-21). It While looking for the culprit, I also could not fail to notice another Clearly, the intent of this is to set a default user name for logging into However, this use case was also broken by OpenSSH v7.7p1, by this change -- snip -- -- snap -- This regression was found during the analysis of a bug reported on the Git Looking forward to hearing back from you, P.S.: For good measure, I opened a PR at |
|
@MarkEWaite was kind enough to open a bug here: http://bugzilla.mindrot.org/show_bug.cgi?id=2849 (he apparently knew better than to follow the instructions at https://www.openssh.com/report.html, which did not work for me) |
887669e (upstream commit, 2017-10-21) introduced a regression: while OpenSSH v7.6p1's SSH client would happily let the last command-line argument specifying a user name override previous ones, this is no longer true in OpenSSH v7.7p1: ssh -l narf -l egads pinkie@brain would try to connect as `pinkie` in v7.6p1, but as `narf` in v7.7p1. Since this change was not covered in the release notes of v7.7p1, it can be considered an unwanted regression, and this patch fixes that regression. This fixes git-for-windows/git#1616. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
7fbcfa1
to
4c7afee
Compare
|
... and now I even tested this and realized that the |
|
@MarkEWaite BTW if there is no reaction from the OpenSSH folks to this here PR nor to the ticket you opened, I am willing to take this patch and release a Git for Windows v2.17.0(2) with an appropriately-patched |
|
That would be really great for me. I'm not confident that I can safely make the change in the Jenkins git client plugin code to determine the correct username to pass as the value of the If you are willing to release a new Git for Windows with a patched ssh.exe, that makes my life much easier. I'm willing to find and make that change in the Jenkins git client plugin code if the OpenSSH team declares that the new behavior is the "correct" behavior, but I think your description of the side effects of the OpenSSH 7.7 change persuade me that the old behavior was the correct behavior. |
|
@dscho I'd appreciate your review and involvement in the discussion on OpenSSH 2849. I believe that I've correctly described the broader case that you found. If I've missed something, please add further details to that bug report. |
|
@MarkEWaite will do. TBH I am a bit shocked how nonchalantly your case was dismissed as "this is not a bug", when the change in behavior was clearly unintended, and clearly has adverse real-world consequences. That's no way to run a successful software project. |
|
@MarkEWaite seems that you have to jump through hoops. Sorry. |
CliGitAPIImpl.fetch_() takes an argument which includes a URIish that
generally represents the URL to the remote git repository. However,
there are places in the git plugin (like GitSCMFileSystem) where the
caller uses the simplification of calling with the remote name ("origin")
instead of the remote URL. That simplification avoids extracting or
remembering the remote URL for a repository which is already established.
Unfortunately, that simplification bypasses the code in CliGitAPIImpl
which inspects the URL being used and decides if authentication needs
to be adjusted to accomodate the incompatible change made in OpenSSH 7.7.
OpenSSH 7.7 has made a sensible choice. The Jenkins git plugin relied
on an undocumented and unexpected behavior of OpenSSH versions prior to
OpenSSH 7.7.
Passing the remoteURL allows the CliGitAPIImpl code to adapt to the
OpenSSH 7.7 change.
Refer to the closed OpenSSH 7.7 bug report at
http://bugzilla.mindrot.org/show_bug.cgi?id=2849
Refer to the rejected OpenSSH pull request at
openssh/openssh-portable#91
Refer to the closed Git for Windows issue at
git-for-windows/git#1616
|
I stumbled across this incompatible change few months ago as I'm using a small shell script Yes, when using my admin key I often want to become root on that system. Usually I notice the problem, temporarily load the key into my ssh-agent and just use ssh instead. But sometimes I use this rssh script (or an equivalent call) in Makefiles or .hg/hgrc configurations, which some days ago resulted in a small disaster: On a different system publishing the web pages happened without a chroot-locked account, so here the change just caused new files to be owned by root instead of the user, which in turn caused further updates to fail when using the intended user account. So it seems I need an ssh wrapper which does much more parsing to solve this? |
|
@ThomasAH you've described the exact conditions that caused concern for @dscho and for me. However, I agree with the decision by @dscho that it is more important that Git for Windows use as much of upstream as possible. It would be a maintenance and reliability challenge to maintain an OpenSSH fork in the Git for Windows code base because we disagree with how upstream handles command line arguments. The OpenSSH team has decided that they will handle command line arguments in this way. Your best hope is to attempt to persuade them that they should handle command line arguments differently. @dscho and I tried to persuade them but were unsuccessful. The OpenSSH team decision is described in the bug report on their issue tracker. |
887669e (upstream commit, 2017-10-21) introduced a regression: while
OpenSSH v7.6p1's SSH client would happily let the last command-line
argument specifying a user name override previous ones, this is no longer
true in OpenSSH v7.7p1:
would try to connect as
pinkiein v7.6p1, but asnarfin v7.7p1.Since this change was not covered in the release notes of v7.7p1, it can
be considered an unwanted regression, and this patch fixes that
regression.
This fixes git-for-windows/git#1616.
Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de