1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-26 08:25:50 +03:00
Commit Graph

147 Commits

Author SHA1 Message Date
Wez Furlong
5feadb347e ssh: libssh: improve diagnostic in case connect fails
show the host/port combo being attempted

refs: https://github.com/wez/wezterm/issues/2617
2022-10-11 08:19:40 -07:00
Wez Furlong
a050849695 deps: update to clap 4
Deal with some breaking changes
2022-10-04 08:55:31 -07:00
Wez Furlong
c91d6c396c termwiz: prepare for a 0.18.0 release 2022-09-21 19:20:26 -07:00
Wez Furlong
699d720a71 ssh: add trace logging when we send a signal 2022-08-31 20:40:06 -07:00
Wez Furlong
9721900b16 ssh: reduce some redundant logging around AcceptEnv
just show it once at warn level and drop it to debug after that.
2022-08-31 20:40:06 -07:00
Wez Furlong
fdb7c557e9 ssh: close stdout, stderr bridges if child is done and there is no data
Inspecting the wezterm process with `lsof -p`, before and after closing
a pane with `CloseCurrentPane`, the same number of unix domain sockets
are open, which is bad.

This commit tries a bit harder to clean things up: if we got a process
exit condition we now remember that we had it, and, while processing
the IO for that channel, if we have no data for stdout or stderr
(respectively) and the channel exited, we close our end of the
socketpair to encourage EOF to be detected on the other end.

This is sufficient to restore the number of open files to the same
number wezterm had opened prior to opening that pane.

@chipsenkbeil: this might possibly be a factor in the issue you
reported, but I haven't had time to really dig into that yet!

refs: https://github.com/wez/wezterm/issues/2466
refs: https://github.com/wez/wezterm/issues/2456
2022-08-30 08:00:49 -07:00
Wez Furlong
53bc871147 ssh: correctly expand %h tokens in ssh config
refs: https://github.com/wez/wezterm/issues/2448
2022-08-23 10:32:07 -07:00
Davide Cavalca
0048209bcf Add missing license files 2022-08-17 07:19:12 -07:00
Wez Furlong
517cdc9c1b fixup build for pty api change 2022-08-12 08:45:02 -07:00
Wez Furlong
e6421d1b72 pty: try_clone_writer -> take_writer
This breaking API change allows us to explicitly generate EOF when the
taken writer is dropped.

The examples have been updated to show how to manage read, write
and waiting without deadlock for both linux and windows.
Need to confirm that this is still good on macOS, but my
confidence is high.

I've also removed ssh2 support from this crate as part of this
change. We haven't used it directly in wezterm in a long while
and removing it from here means that there is slightly less code
to keep compiling over and over.

refs: https://github.com/wez/wezterm/discussions/2392
refs: https://github.com/wez/wezterm/issues/1396
2022-08-12 07:56:46 -07:00
Wez Furlong
edeae72b5f termwiz: bump version to 0.17 2022-08-01 18:31:43 -07:00
dependabot[bot]
e2eb2b444b build(deps): bump rstest from 0.14.0 to 0.15.0
Bumps [rstest](https://github.com/la10736/rstest) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/0.14.0...0.15.0)

---
updated-dependencies:
- dependency-name: rstest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 06:24:17 -07:00
dependabot[bot]
43a541a485 build(deps): bump rstest from 0.13.0 to 0.14.0
Bumps [rstest](https://github.com/la10736/rstest) from 0.13.0 to 0.14.0.
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/0.13.0...0.14.0)

---
updated-dependencies:
- dependency-name: rstest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-20 05:23:14 -07:00
kumattau
c591217cb7 Use clap::derive::Parser::parse() to fix deprecated warning 2022-05-29 09:54:38 -07:00
Wez Furlong
f857ec6a5a deps: structopt -> clap 3 2022-05-28 07:07:52 -07:00
Wez Furlong
c8c3b8378a ssh: avoid busy loop when all channels are closed on the session
We need to notice when all of the streams associated with a channel are
closed and remove the channel from the set that we're polling in the
main loop, to avoid continually polling the closed descriptors.

Additionally, if the Session has been dropped, we know that we cannot
be asked to create any new channels, so if there are no more channels
then we can and should exit that dispatch loop and allow the resources
to be cleaned up.

refs: https://github.com/wez/wezterm/issues/1993#issuecomment-1130539934
2022-05-19 21:02:06 -07:00
Wez Furlong
0e0bac2576 deps: prune some unused deps 2022-05-19 06:48:09 -07:00
Wez Furlong
3800710ead cargo update 2022-05-15 19:44:27 -07:00
Gregory Anders
68bd4f3a6b ssh: improve error message contexts 2022-04-15 20:53:07 -07:00
Gregory Anders
c636a4d7a0 ssh: support BindAddress for libssh2 2022-04-15 20:53:07 -07:00
Gregory Anders
8560dbd2bb ssh: support BindAddress
This is already supported by libssh_rs.
2022-04-15 20:53:07 -07:00
Wez Furlong
0f6ee20b28 pty: ExitStatus now understands signals and impl Display
Improves the fidelity of the information in ExitStatus and shows it
in the wezterm exit_behavior output to clarify the status.
2022-04-09 06:15:54 -07:00
Wez Furlong
b35e3b2aad deps: remove pretty_env_loggger
Go directly to the underlying env_logger crate, as pretty_env_logger
hasn't been updated in some time, and I'd like to be able to redirect
the log output to a file more directly, and that feature is in a newer
version of the env logger than pretty_env_logger was pulling in.
2022-04-07 08:24:07 -07:00
Wez Furlong
d0d23d6c46 termwiz: prep for crates.io 2022-04-07 07:27:54 -07:00
Wez Furlong
29995c7cb3 add wezterm.enumerate_ssh_hosts() helper
This helper extracts the concrete set of hosts and their configurations
from the ssh config, and arranges to reload the wezterm config if they
are changed.

This is useful when constructing ssh domain configs.

refs: https://github.com/wez/wezterm/discussions/1731
2022-03-18 07:48:12 -07:00
Wez Furlong
c4009d8e1d deps: shell-words -> 1.1.0 2022-02-06 18:32:10 -07:00
Wez Furlong
705d518242 ssh: restore async_oss dep 2022-01-30 18:45:12 -07:00
Wez Furlong
c4c0b5a569 ssh: prep for crate release 2022-01-30 18:43:55 -07:00
Chip Senkbeil
caf504ee81
Re-export portable_pty::{PtySize, MasterPty, ChildKiller} as it is available in public API (#1603)
* Re-export portable_pty::PtySize as it is available in public API

* Re-export portable_pty::{MasterPty, ChildKiller} as those are both implemented by public structs from wezterm-ssh
2022-01-30 18:27:29 -07:00
Wez Furlong
e4ed2c93e2 encoding my preferred import grouping in the rustfmt config
This uses an unstable option in rustfmt, you `cargo +nightly fmt`
needs to be used to format the code correctly.
2022-01-17 13:50:51 -07:00
Chip Senkbeil
5042addb06 Add features to enable vendored-openssl for ssh2 and libssh-rs individually 2022-01-09 19:36:56 -08:00
Chip Senkbeil
1f17416e60 Support gating libssh-rs and ssh2 behind features of same name 2022-01-09 19:36:56 -08:00
Wez Furlong
b40f65c25e termwiz: s/Fuschia/Fuchsia/g
closes: #1407
2021-12-21 20:38:59 -07:00
Wez Furlong
6367e55117 ssh: tidy up sshd logging in tests 2021-12-15 23:19:27 -07:00
Wez Furlong
de13e17723 ssh: explicitly allow ssh-rsa keys in tests
It looks like the debian 9 test failures with libssh are the
same underlying issue as https://github.com/wez/wezterm/issues/1262

Poking around in the debug output, and then spelunking through the code,
we can use the `pubkeyacceptedtypes` ssh config option to add the key
type to the list of keys.  This doesn't appear to be a documented
option in the current versions of openssh.

I'm not 100% sure that this is right, but it's worth a shot.
2021-12-15 22:05:24 -07:00
Wez Furlong
9db09f5e98 ssh: enable logging in tests 2021-12-15 20:40:15 -07:00
Wez Furlong
5c0a2dab26 ssh: log diagnostics to stderr in tests 2021-12-15 20:13:18 -07:00
Wez Furlong
a745c2edc8 ssh: fixup test for centos8
```
thread 'e2e::sftp::canonicalize_should_either_return_resolved_path_or_error_if_missing' panicked at 'Unexpected result from canonicalize: Err(LibSsh(Sftp(SftpError(2))))', wezterm-ssh/tests/e2e/sftp.rs:615:14
```

We can't currently match that error because the LibSsh SftError(x) error
code is private.
2021-12-15 11:48:13 -07:00
Wez Furlong
d6ef3c67c5 ssh: improve diagnostics to debug failing integration test 2021-12-15 11:39:00 -07:00
Wez Furlong
8b58f28125 wezterm-ssh: default to libssh2. mux: revise bootstrap_via_ssh
This commit revises the tls domain bootstrap via ssh code and
makes it work again from a windows client.
2021-12-15 11:10:16 -07:00
Wez Furlong
f398f333cd ssh: make -v option work on Windows, adjust config overlaying
Route logging via the `log` crate because on Windows there is
no stderr visible to libssh.

libssh will override any explicitly set options when it parses
the config file, so we need to apply those after we've loaded it.
2021-12-15 09:18:00 -07:00
Wez Furlong
421bcd25c1 ssh: allow partial auth
Some systems employ multi-stage authentication, so allow for that
to work.
2021-12-15 08:58:21 -07:00
Wez Furlong
36a16cb70d fix windows build
A recent cargo update caused openssl-sys to do a minor semver update
from 0.9.71 -> 0.9.72, but that release downgraded from openssl 3
to openssl 1 to resolve a performance regression:
<https://github.com/sfackler/rust-openssl/pull/1578>

That in turn caused libssh to fail to build because the ENGINE
feature required by libssh isn't compiled in in openssl-src 1
crate when vendoring on windows.

For now, my libssh git repo is constrained to openssl-sys 0.9.71,
and we're pointing to that from the wezterm repo.
2021-12-13 09:02:24 -07:00
Wez Furlong
137bdacd3f cargo update
and bump rstest to make dependabot happier
2021-12-12 20:21:55 -07:00
Wez Furlong
7926c31209 pty: introduce ChildKiller trait
In the mux layer, we have some code that takes a `Child` and then
does a bit of naughty reaching through the abstraction to get at
the pid/handle of the child so that we can send it signals even
if the child is itself mutably (and thus exclusively) borrowed
for the purposes of waiting.

That worked fine for local processes spawned in the mux, but we also
use LocalPane to wrap around arbitrary `Child`ren, such as Ssh,
that are not local and that don't have a local process id, which
meant that this hack wouldn't work for them.

To make things a bit worse, those ssh ptys were used to ssh2 days
where we didn't have a way to signal the remote process and just
did nothing, leading to confusing situations such as
https://github.com/wez/wezterm/issues/1197

This commit graduates the hack mentioned in the first paragraph
to its own ChildKiller trait.  This makes the concept of waiting
for the Child distinct from signalling it and explicitly allows
getting a separate object that can be used for signalling.

With that in place, we're forced to implement something appropriate
for the ssh pty implementations; one in the pty crate itself,
one in wezterm-ssh and the wrapper that we use in the mux crate.

The upshot of this is that the `CloseCurrentPane` action now operates
correctly on panes that were the result of split operations.
2021-12-11 08:40:26 -07:00
Wez Furlong
ebc6e6f8b9 Pick up updated ssh crate + windows fixes 2021-12-10 15:25:48 -07:00
Wez Furlong
225e7a1243 introduce unicode_version config
This is a fairly far-reaching commit. The idea is:

* Introduce a unicode_version config that specifies the default level
  of unicode conformance for each newly created Terminal (each Pane)
* The unicode_version is passed down to the `grapheme_column_width`
  function which interprets the width based on the version
* `Cell` records the width so that later calculations don't need to
  know the unicode version

In a subsequent diff, I will introduce an escape sequence that allows
setting/pushing/popping the unicode version so that it can be overridden
via eg: a shell alias prior to launching an application that uses a
different version of unicode from the default.

This approach allows output from multiple applications with differing
understanding of unicode to coexist on the same screen a little more
sanely.

Note that the default `unicode_version` is set to 9, which means that
emoji presentation selectors are now by-default ignored.  This was
selected to better match the level of support in widely deployed
applications.

I expect to raise that default version in the future.

Also worth noting: there are a number of callers of
`unicode_column_width` in things like overlays and lua helper functions
that pass `None` for the unicode version: these will assume the latest
known-to-wezterm/termwiz version of unicode to be desired. If those
overlays do things with emoji presentation selectors, then there may be
some alignment artifacts. That can be tackled in a follow up commit.

refs: #1231
refs: #997
2021-11-25 09:00:45 -07:00
Wez Furlong
9822e80adb wezterm-ssh: ask kernel to allocate port number for tests
The ssh tests are the main flakey failure in CI, so let's see if
we can make them less flakey.
2021-11-23 06:16:31 -07:00
Wez Furlong
d1e0562631 restore async_ossl dep after wezterm-ssh crates.io release 2021-11-23 05:36:52 -07:00
Wez Furlong
3f63f4a2e2 prep for wezterm-ssh release 2021-11-23 05:35:51 -07:00