Conversation
|
I'm getting a segfault trying to use it: I forked/modified the following repos (Cargo.toml/submodule links only) to use this patch: I'm getting the segfault on both macOS and Linux |
|
Neat, thanks for trying this out. Can you get a core or stack trace? |
|
Valgrind: |
|
Commenting out the |
|
Oops, that's definitely a mistake. It looks like I haven't built that branch without any SSH support in a while. Thanks for catching that. You'll need to configure libgit2 with |
|
I had to do this to get it working: bergkvist/git2-rs@9a4d232 (git2-rs doesn't use cmake) I would love for this to get merged into libgit2. |
It'll happen - I think that I just want to give plenty of time for feedback. Doing an |
We may want to support SSH but with a different provider that is not libssh2. Add GIT_SSH to indicate that we have some inbuilt SSH support and GIT_SSH_LIBSSH2 to indicate that support is via libssh2. This is similar to how we support GIT_HTTPS and GIT_OPENSSL, for example.
We can now use the `git_process` class to invoke OpenSSH and use it as an SSH transport. This may be preferred over libssh2 for a variety of callers.
We can't reliably detect SIGPIPE on close because of platform differences. Track `pid` and send `SIGTERM` to a function and ensure that we can detect it.
There are no custom callbacks for OpenSSH; don't test them.
Now that we (may) exec a child process to do ssh, we don't want valgrind reporting on that. Suppress children in valgrind runs.
A transport may want to validate that it's in a sane state; when flushing on close, don't assume that we're doing an upload-pack; send the correct direction.
Instead of "early EOF", provide information on _when_ we're seeing the EOF for debugging.
Suppress SIGPIPEs during writes to our piped process. On single-threaded applications, this is as simple as ignoring the signal. But since this is process-wide, on multi-threaded applications, we need to use some cumbersome `pthread_sigmask` manipulation. Thanks to https://www.doof.me.uk/2020/09/23/sigpipe-and-how-to-ignore-it/ and http://www.microhowto.info:80/howto/ignore_sigpipe_without_affecting_other_threads_in_a_process.html
Provide a mechanism for callers to read from stderr.
Provide more user-friendly error messages in smart protocol negotiation failures.
Don't capture stderr, optimize for the CLI case.
Provide both cmdline-style handling (passing it to the shell on POSIX, or directly to CreateProcess on win32) and execv style (passing it directly to execv on POSIX, and mangling it into a single command-line on win32).
Callers can specify the ssh command to invoke using `core.sshcommand` or the `GIT_SSH` environment variable. This is useful for specifying alternate configuration, and is particularly useful for our testing environment.
This helped when troubleshooting issues running the `ci/test.sh` script locally.
Handle custom paths for OpenSSH.
This commit changes the original `ssh` feature into two new ones:
`ssh-libssh2` and `ssh-openssh`. By default, the `ssh-libssh2` feature
is enabled for backwards compatibility.
To use OpenSSH instead, the following listing in `Cargo.toml` can be
used:
git2-rs = { version = "...", default-features = false, features = ["https", "ssh-openssh"] }
Note that libgit2/libgit2#6617 has not actually
been released in an official libgit2 version, so the prior commit pulled
in the latest commit from `main`.
Closes rust-lang#1028.
This commit changes the original `ssh` feature into two new ones:
`ssh-libssh2` and `ssh-openssh`. By default, the `ssh-libssh2` feature
is enabled for backwards compatibility.
To use OpenSSH instead, the following listing in `Cargo.toml` can be
used:
git2-rs = { version = "...", default-features = false, features = ["https", "ssh-openssh"] }
Note that libgit2/libgit2#6617 has not actually
been released in an official libgit2 version, so the prior commit pulled
in the latest commit from `main`.
Closes rust-lang#1028.
Provide a smart transport that executes
ssh ...- this adds a mechanism for executing processes from libgit2, and uses it to invokesshand deal with the output.