Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

fix(install): let the server variant onto glibc 2.34

RoversX84794ee29825
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 67401321..cc2b5236 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -616,6 +616,13 @@ jobs:
-p thinkterm-tailnet-node \
-p strip-ansi-escapes
+ # install.sh, and the clients that install over ssh, let a host in by
+ # the glibc each variant needs; the tarballs they install come from
+ # the Ubuntu leg, so its binaries are held to those numbers.
+ - name: Check glibc floors
+ if: startsWith(matrix.name, 'ubuntu')
+ run: bash ci/check-glibc.sh "target/$CARGO_PROFILE"
+
- name: Fetch the browser bundle
uses: actions/download-artifact@v8
with:
diff --git a/ci/check-glibc.sh b/ci/check-glibc.sh
new file mode 100755
index 00000000..5c1f7402
--- /dev/null
+++ b/ci/check-glibc.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# Fail when a Linux release binary needs a newer glibc than install.sh
+# promises for its variant -- and thinkterm-update, which a test keeps in step
+# with it. A binary loads on a glibc that has every GLIBC_x.y symbol version
+# it references, so the newest of those is the oldest glibc it runs on.
+# Without this check, one call into a newer libc function (the GUI's hypot is
+# why the desktop needs 2.35) would leave hosts that install.sh lets through
+# with binaries that fail to load.
+#
+# ci/check-glibc.sh target/release
+
+set -eu
+
+dir=${1:?usage: ci/check-glibc.sh <directory of the built binaries>}
+script="$(dirname "$0")/../install.sh"
+
+floor() {
+ sed -n "s/^$1=\"\([0-9.]*\)\".*/\1/p" "$script"
+}
+server=$(floor min_glibc_server)
+desktop=$(floor min_glibc_desktop)
+if [ -z "$server" ] || [ -z "$desktop" ]; then
+ echo "install.sh sets no min_glibc_server or min_glibc_desktop" >&2
+ exit 1
+fi
+
+status=0
+
+check() {
+ local bin=$1 floor=$2 need
+ need=$(objdump -T "$dir/$bin" | grep -oE 'GLIBC_[0-9]+\.[0-9]+' \
+ | sed 's/^GLIBC_//' | sort -V | tail -n1)
+ if [ -z "$need" ]; then
+ echo "$bin: no glibc symbol versions found" >&2
+ status=1
+ elif [ "$(printf '%s\n%s\n' "$need" "$floor" | sort -V | tail -n1)" != "$floor" ]; then
+ echo "$bin needs glibc $need, but install.sh lets hosts with $floor install it" >&2
+ status=1
+ else
+ echo "$bin: glibc $need (install.sh: $floor)"
+ fi
+}
+
+# The server tarball's binaries; the desktop's are the same and the GUI.
+for bin in thinkterm wezterm thinkterm-mux-server thinkterm-plugin-server \
+ thinkterm-tailnet strip-ansi-escapes; do
+ check "$bin" "$server"
+done
+check thinkterm-gui "$desktop"
+
+exit $status
diff --git a/install.sh b/install.sh
index bab8c772..76089c9d 100755
--- a/install.sh
+++ b/install.sh
@@ -41,7 +41,11 @@
set -eu
repo="RoversX/thinkterm"
-min_glibc="2.35" # the Ubuntu 22.04 build base; see .github/workflows/release.yml
+# The oldest glibc each variant's Linux binaries load on: the newest glibc
+# symbol version any of them needs. ci/check-glibc.sh holds every release to
+# these, and thinkterm-update carries the same two numbers.
+min_glibc_server="2.34"
+min_glibc_desktop="2.35" # the GUI's alone; the rest need no more than the server
variant=""
tag=""
@@ -208,15 +212,27 @@ if [ "$os" = linux ]; then
# The binaries link against glibc; musl (Alpine) cannot run them at all,
# and an older glibc fails at load time with a message that blames a
# symbol version rather than the real cause. Check here, in words.
+ if [ "$variant" = server ]; then
+ min_glibc=$min_glibc_server
+ newer="Ubuntu 22.04, Debian 12, RHEL 9"
+ else
+ min_glibc=$min_glibc_desktop
+ newer="Ubuntu 22.04, Debian 12, RHEL 10"
+ fi
glibc=$(getconf GNU_LIBC_VERSION 2>/dev/null | awk '{print $2}') || glibc=""
if [ -z "$glibc" ]; then
if ldd --version 2>&1 | grep -qi musl; then
die "this host uses musl libc; the release tarballs are built against glibc. Build from source instead."
fi
- warn "could not determine the glibc version; continuing, but the binaries need glibc >= $min_glibc"
+ warn "could not determine the glibc version; continuing, but the $variant binaries need glibc >= $min_glibc"
elif lowest=$(printf '%s\n%s\n' "$min_glibc" "$glibc" | sort -V 2>/dev/null | head -n1) \
&& [ -n "$lowest" ] && [ "$lowest" != "$min_glibc" ]; then
- die "glibc $glibc is too old: the release binaries need >= $min_glibc (Ubuntu 22.04, Debian 12, RHEL 10 or newer). Build from source instead."
+ also=""
+ if [ "$variant" = desktop ] && [ "$(printf '%s\n%s\n' "$min_glibc_server" "$glibc" \
+ | sort -V 2>/dev/null | head -n1)" = "$min_glibc_server" ]; then
+ also=" The server variant (--server) runs on it."
+ fi
+ die "glibc $glibc is too old: the $variant binaries need >= $min_glibc ($newer or newer). Build from source instead.$also"
fi
have tar || die "tar is required"
else
diff --git a/thinkterm-update/src/lib.rs b/thinkterm-update/src/lib.rs
index d5161102..c57ddf5d 100644
--- a/thinkterm-update/src/lib.rs
+++ b/thinkterm-update/src/lib.rs
@@ -35,10 +35,17 @@ pub const INSTALL_SCRIPT_URL: &str =
const API_RELEASES: &str = "https://api.github.com/repos/RoversX/thinkterm/releases";
const API_COMMITS: &str = "https://api.github.com/repos/RoversX/thinkterm/commits";
-/// The oldest glibc the Linux release binaries run on: the Ubuntu 22.04 base
-/// they are built in. `install.sh` carries the same number and refuses
-/// older hosts; this copy lets a client refuse before it even offers.
-pub const MIN_GLIBC: (u32, u32) = (2, 35);
+/// The oldest glibc the Linux release binaries of `variant` ("server" or
+/// "desktop", as `install.sh` takes it) load on: the newest glibc symbol
+/// version any of them needs, which `ci/check-glibc.sh` holds every release
+/// to. Only the GUI needs 2.35. `install.sh` carries the same numbers and
+/// refuses older hosts; this copy lets a client refuse before it even offers.
+pub fn min_glibc(variant: &str) -> (u32, u32) {
+ match variant {
+ "server" => (2, 34),
+ _ => (2, 35),
+ }
+}
/// Parse `getconf GNU_LIBC_VERSION` output ("glibc 2.31") or a bare
/// "2.31" into (major, minor).
@@ -1161,8 +1168,30 @@ mod tests {
assert_eq!(parse_glibc_version("glibc 2.31\n"), Some((2, 31)));
assert_eq!(parse_glibc_version("2.35"), Some((2, 35)));
assert_eq!(parse_glibc_version(""), None);
- assert!(parse_glibc_version("glibc 2.31").unwrap() < MIN_GLIBC);
- assert!(parse_glibc_version("glibc 2.39").unwrap() >= MIN_GLIBC);
+ assert!(parse_glibc_version("glibc 2.31").unwrap() < min_glibc("server"));
+ assert!(parse_glibc_version("glibc 2.39").unwrap() >= min_glibc("desktop"));
+ }
+
+ #[test]
+ fn a_server_takes_a_glibc_the_desktop_does_not() {
+ // RHEL 9 and its kin, Amazon Linux 2023.
+ let glibc = parse_glibc_version("glibc 2.34").unwrap();
+ assert!(glibc >= min_glibc("server"));
+ assert!(glibc < min_glibc("desktop"));
+ }
+
+ #[test]
+ fn the_glibc_floors_are_install_sh_s() {
+ let script = include_str!("../../install.sh");
+ let floor = |name: &str| {
+ let line = script
+ .lines()
+ .find(|line| line.starts_with(&format!("{name}=\"")))
+ .unwrap_or_else(|| panic!("install.sh sets no {name}"));
+ parse_glibc_version(line.split('"').nth(1).unwrap()).unwrap()
+ };
+ assert_eq!(floor("min_glibc_server"), min_glibc("server"));
+ assert_eq!(floor("min_glibc_desktop"), min_glibc("desktop"));
}
#[test]
diff --git a/wezterm-client/src/remote_update.rs b/wezterm-client/src/remote_update.rs
index 959c532a..80a3112d 100644
--- a/wezterm-client/src/remote_update.rs
+++ b/wezterm-client/src/remote_update.rs
@@ -137,9 +137,10 @@ pub fn offer_remote_update(
ssh_dom.stored_password.clone(),
)
.with_context(|| format!("opening an ssh session to {host} for the update"))?;
+ let variant = remote_variant(&session);
// A host the release binaries cannot run on gets the answer straight
// away, rather than an installer run that fails at its first check.
- if let Some(reason) = host_cannot_take_a_release(&session) {
+ if let Some(reason) = host_cannot_take_a_release(&session, variant) {
ui.output_str(&format!(
"{reason}, so the release build of {local} cannot be installed on {host}.\n{}\n",
thinkterm_update::build_from_source_instructions(&local)
@@ -147,7 +148,6 @@ pub fn offer_remote_update(
return Ok(RemoteUpdateOutcome::Declined);
}
- let variant = remote_variant(&session);
let command = thinkterm_update::install_command(variant, &local);
// Uncommitted changes can include a newer protocol than the release
// that carries this version label.
@@ -292,7 +292,8 @@ pub fn offer_remote_install(
) -> anyhow::Result<RemoteInstallOutcome> {
let local = thinkterm_update::running_release_version();
let host = ssh_dom.remote_address.clone();
- let command = thinkterm_update::install_command("server", &local);
+ let variant = "server";
+ let command = thinkterm_update::install_command(variant, &local);
ui.output_str(&format!(
"\nThinkTerm is not installed on {host}. ThinkTerm Connect runs there, so \
@@ -359,7 +360,7 @@ pub fn offer_remote_install(
ssh_dom.stored_password.clone(),
)
.with_context(|| format!("opening an ssh session to {host} for the install"))?;
- if let Some(reason) = host_cannot_take_a_release(&session) {
+ if let Some(reason) = host_cannot_take_a_release(&session, variant) {
ui.output_str(&format!(
"{reason}, so the release build of {local} cannot be installed on {host}.\n{}\n",
thinkterm_update::build_from_source_instructions(&local)
@@ -398,13 +399,18 @@ const HOST_PROBE: &str =
const VARIANT_READ: &str =
"sed -n 's/^variant=//p' \"$HOME/.local/share/thinkterm/install-manifest\" 2>/dev/null";
-/// Why the host cannot run a release binary, if it cannot: the same two
-/// checks `install.sh` makes first, made here so the answer comes before
-/// the question. An unreadable answer is not a refusal; the script will
-/// check again.
-fn host_cannot_take_a_release(session: &Session) -> Option<String> {
+/// Why the host cannot run a release binary of `variant`, if it cannot: the
+/// same two checks `install.sh` makes first, made here so the answer comes
+/// before the question. An unreadable answer is not a refusal; the script
+/// will check again.
+fn host_cannot_take_a_release(session: &Session, variant: &str) -> Option<String> {
let out = run_capture(session, HOST_PROBE).ok()?;
- let mut lines = out.lines().map(str::trim);
+ release_refusal(&out, variant)
+}
+
+/// `host_cannot_take_a_release`, given what `HOST_PROBE` printed there.
+fn release_refusal(probe: &str, variant: &str) -> Option<String> {
+ let mut lines = probe.lines().map(str::trim);
let os = lines.next()?;
let arch = lines.next()?;
let libc = lines.next().unwrap_or("");
@@ -416,13 +422,11 @@ fn host_cannot_take_a_release(session: &Session) -> Option<String> {
}
if os == "Linux" {
if let Some(version) = thinkterm_update::parse_glibc_version(libc) {
- if version < thinkterm_update::MIN_GLIBC {
+ let need = thinkterm_update::min_glibc(variant);
+ if version < need {
return Some(format!(
- "The host has glibc {}.{} and the release binaries need {}.{}",
- version.0,
- version.1,
- thinkterm_update::MIN_GLIBC.0,
- thinkterm_update::MIN_GLIBC.1
+ "The host has glibc {}.{} and the {variant} release binaries need {}.{}",
+ version.0, version.1, need.0, need.1
));
}
}
@@ -522,7 +526,7 @@ fn run_and_relay_status(
#[cfg(test)]
mod tests {
- use super::{is_not_published, is_yes, without_input};
+ use super::{is_not_published, is_yes, release_refusal, without_input};
#[test]
fn only_an_explicit_yes_counts() {
@@ -533,6 +537,22 @@ mod tests {
assert!(!is_yes("maybe"));
}
+ #[test]
+ fn a_host_is_refused_by_the_glibc_of_the_variant_it_would_get() {
+ // RHEL 9 and its kin: the server runs there, the GUI does not.
+ let rhel9 = "Linux\naarch64\nglibc 2.34\n";
+ assert_eq!(release_refusal(rhel9, "server"), None);
+ let refused = release_refusal(rhel9, "desktop").expect("the GUI needs 2.35");
+ assert!(refused.contains("glibc 2.34"), "{refused}");
+ assert!(release_refusal("Linux\nx86_64\nglibc 2.31\n", "server").is_some());
+ assert_eq!(
+ release_refusal("Linux\nx86_64\nglibc 2.39\n", "desktop"),
+ None
+ );
+ assert!(release_refusal("Linux\nx86_64\nmusl libc (x86_64)\n", "server").is_some());
+ assert_eq!(release_refusal("Darwin\narm64\n\n", "desktop"), None);
+ }
+
#[cfg(unix)]
#[test]
fn every_remote_command_still_parses_once_its_input_is_cut() {
diff --git a/wezterm-mux-server-impl/src/web_relay.rs b/wezterm-mux-server-impl/src/web_relay.rs
index 12b12281..1aaddb54 100644
--- a/wezterm-mux-server-impl/src/web_relay.rs
+++ b/wezterm-mux-server-impl/src/web_relay.rs
@@ -1323,13 +1323,12 @@ impl Probe {
return Some("the host uses musl libc".to_string());
}
let glibc = thinkterm_update::parse_glibc_version(&self.libc)?;
- (glibc < thinkterm_update::MIN_GLIBC).then(|| {
+ // The variant `install` puts there.
+ let need = thinkterm_update::min_glibc("server");
+ (glibc < need).then(|| {
format!(
"the host has glibc {}.{} and the release binaries need {}.{}",
- glibc.0,
- glibc.1,
- thinkterm_update::MIN_GLIBC.0,
- thinkterm_update::MIN_GLIBC.1
+ glibc.0, glibc.1, need.0, need.1
)
})
}
@@ -3355,6 +3354,8 @@ mod tests {
assert!(linux("armv7l", "glibc 2.39").cannot_take_a_release().is_some());
assert!(linux("x86_64", "musl libc (x86_64)").cannot_take_a_release().is_some());
assert!(linux("aarch64", "glibc 2.31").cannot_take_a_release().is_some());
+ // RHEL 9 and its kin: what is installed there is the server.
+ assert_eq!(linux("aarch64", "glibc 2.34").cannot_take_a_release(), None);
let mac = Probe {
os: "Darwin".into(),
arch: "arm64".into(),