-
Notifications
You must be signed in to change notification settings - Fork 377
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
git: Always use OpenSSL on win32 #3554
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
I updated my CLA signature. |
9359703
to
c6a5c8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Hopefully someone who uses Windows can review and test this. If we don't hear from anyone in a few days, I can add a rubberstamp to get this in.
FYI, there's also draft PR #3191 for switching from libssh2 to OpenSSH.
c6a5c8e
to
811bf5d
Compare
CHANGELOG.md
Outdated
@@ -64,6 +69,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
literals. This means that `snapshot.max-new-file-size="1"` and | |||
`snapshot.max-new-file-size=1` are now equivalent. | |||
|
|||
* ED25519 host keys are now supported correctly when connecting to Git+SSH hosts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hopeful that this will actually fix several other git ssh issues, but I guess we shouldn't get ahead of ourselves :)
@@ -60,6 +60,7 @@ indoc = "2.0.4" | |||
insta = { version = "1.38.0", features = ["filters"] } | |||
itertools = "0.12.1" | |||
libc = { version = "0.2.153" } | |||
libssh2-sys = { version = "0.3.0" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency could be made Windows-only by moving it to a [target.'cfg(windows)'.dependencies]
section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't in the dependencies key; it's in the workspace.dependencies key. I tried target.'cfg(windows)'.workspace.dependencies and it said it was not allowed.
I use windows, let me pull this down and give it a look. EDIT: Build fails for me, is there something more I need to do? |
FWIW, this can be a huge pain. I really, really would prefer not to use openssl unless I have to, and I don't need the features in this PR. I think it might be nicer to have the option to use openssl if you want these extra features for some extra pain in building, but that's just my own personal opinion :) |
Maybe this could be a feature flag? |
It is technically already one, but enabled during release builds in CI.
I hadn't actually updated the PR text yet; it now uses the vendored-openssl feature that's already turned on for release builds for Windows and macOS, so it's not disruptive and vcpkg is only needed if you specifically enable openssl-on-win32 and disable vendored-openssl. To my knowledge, OpenSSL is only used for the cryptographic primitives in libssh2 and not for TLS relative stuff. |
fb9ef1c
to
0c15b40
Compare
Clarifying question for me; would this allow me to use |
Yes. The issue goes both for your own key and the host's, I believe. |
0c15b40
to
6efb2e4
Compare
I'm on windows, tried using this but I can't get (looks like github ate my last comment. this was 2nd attempt) |
You can use the |
6efb2e4
to
c59e79d
Compare
I tried testing it with |
It is; the
|
Not sure if having the log helps, but Installing the latest version (c59e79d) with:
|
Could you try building it after checking out the commit with |
building
All the failures had what appeared to be the same error message, though I didn't bother to run them through diff. |
Oh boy, building openssl-sys with the vendored feature only seems to work under msys2 shell on Windows. Huh... |
By default, libssh2 uses Windows Cryptography Next Generation when targeting win32. The wincng backend does not support ED25519, which is a widely-used algorithm among git hosting services, and in some cases may be the only option on remotes in certain configurations. This change adds the feature `openssl-on-win32`, enabling the same one in `libssh2-sys`, and enables it in the CI release flow, ensuring that release builds are able to communicate with hosts using ED25519. Fixes jj-vcs#3322
c59e79d
to
89fc574
Compare
Aha. I was also using msys2 - the version that comes with Git for Windows as "Git Bash". |
If it helps, I've been building under |
I guess I could alter this to not run in CI release packaging, since it does work, it just requires a specific build environment? All it does is forward the feature down to the libssh-sys crate ultimately. I do find it's the only way to make jj useful in my specific use case. |
I would definitely like for |
I was able to build on Windows 11 locally without using MSYS2 using these commands (in Nushell/ # Get a copy of `vcpkg.exe`.
$ gh repo clone microsoft/vcpkg $VCPKG_SRC_DIR
<snip>
$ mkdir $VCPKG_BIN_DIR
$ cd $VCPKG_BIN_DIR
$ $VCPKG_SRC_DIR\bootstrap-vcpkg.bat # downloads `vcpkg.exe`
<snip>
# Install OpenSSL.
$ .\vcpkg.exe install openssl:x64-windows-static-md
<snip>
# Test a build!
$ VCPKG_ROOT=$VCPKG_BIN_DIR cargo run --release --features openssl-on-win32 -- --version
<snip>
jj 0.17.1-89fc5743d112c49d60d15e1c8684dfa9e3d242e4 …so this build seems reproducible, just not without some expertise. We may be able to use |
Hmm, I get this seemingly incorrect hint while testing
I say "incorrect" because this build/PR actually uses OpenSSH under the hood, right? Full output, for the curious.I had tried to push to this PR, which I expected to fail with a permissions error:
|
By default, libssh2 uses Windows Cryptography Next Generation when targeting win32. The wincng backend does not support ED25519, which is a widely-used algorithm among git hosting services, and in some cases may be the only option on remotes in certain configurations.
This change adds the feature
openssl-on-win32
, enabling the same one inlibssh2-sys
, and enables it in the CI release flow, ensuring that release builds are able to communicate with hosts using ED25519.Fixes #3322
Checklist
If applicable:
CHANGELOG.md