@devries-cameron20 / t3code-1 / commits / a5bd0ba526
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(ssh): SSH setup on a host without gzip says gzip is missing (#35389)

Julius Marminge committed Nov 12, 2026 at 09:11 UTC a5bd0ba5265fdfbfadc9149a54300b5048f853cb
2 files changed +66 -1
packages/ssh/src/tunnel.test.ts
+59
@@ -230,6 +230,65 @@ describe("ssh tunnel scripts", () => {
230 },
231 );
232
233 + it("names gzip when a host with tar but no gzip cannot unpack the release archive", () => {
234 + const root = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-ssh-runner-"));
235 + try {
236 + const bin = NodePath.join(root, "bin");
237 + const release = NodePath.join(root, "release");
238 + const archive = `t3-${ARCHIVE.archiveVersion}-linux-x64.tar.gz`;
239 + NodeFS.mkdirSync(bin);
240 + NodeFS.mkdirSync(NodePath.join(root, "home"));
241 + NodeFS.mkdirSync(NodePath.join(release, "t3"), { recursive: true });
242 + NodeFS.writeFileSync(NodePath.join(release, "t3", "t3"), "#!/bin/sh\necho ok\n", {
243 + mode: 0o755,
244 + });
245 + NodeChildProcess.execFileSync("tar", ["-czf", archive, "t3"], { cwd: release });
246 + NodeChildProcess.execFileSync("sh", ["-c", `sha256sum ${archive} > SHA256SUMS`], {
247 + cwd: release,
248 + });
249 + for (const tool of [
250 + "sh",
251 + "mkdir",
252 + "mktemp",
253 + "cat",
254 + "rm",
255 + "grep",
256 + "cut",
257 + "sha256sum",
258 + "tar",
259 + "mv",
260 + ]) {
261 + NodeFS.symlinkSync(
262 + NodeChildProcess.execFileSync("sh", ["-c", `command -v ${tool}`], {
263 + encoding: "utf8",
264 + }).trim(),
265 + NodePath.join(bin, tool),
266 + );
267 + }
268 + NodeFS.writeFileSync(
269 + NodePath.join(bin, "uname"),
270 + '#!/bin/sh\ncase "$1" in -s) echo Linux ;; -m) echo x86_64 ;; esac\n',
271 + { mode: 0o755 },
272 + );
273 + NodeFS.writeFileSync(
274 + NodePath.join(bin, "curl"),
275 + `#!/bin/sh\nfor last; do :; done\nfor a; do case "$a" in http*) src="${release}/\${a##*/}" ;; esac; done\nexec cat "$src" > "$last"\n`,
276 + { mode: 0o755 },
277 + );
278 + const runner = NodePath.join(root, "run-t3.sh");
279 + NodeFS.writeFileSync(runner, SshTunnel.buildRemoteT3RunnerScript(ARCHIVE));
280 + const result = NodeChildProcess.spawnSync(NodePath.join(bin, "sh"), [runner, "--version"], {
281 + encoding: "utf8",
282 + env: { HOME: NodePath.join(root, "home"), PATH: bin },
283 + });
284 + assert.notEqual(result.status, 0);
285 + assert.match(result.stderr, /(missing|needs) gzip/);
286 + assert.notInclude(result.stderr, "Cannot exec");
287 + } finally {
288 + NodeFS.rmSync(root, { recursive: true, force: true });
289 + }
290 + });
291 +
292 it.effect("accepts launch JSON after remote shell startup noise", () => {
293 const target = {
294 alias: "devbox",
packages/ssh/src/tunnel.ts
+7 -1
@@ -526,7 +526,13 @@ if ! t3_runtime_ready; then
526 if [ -z "$T3_EXPECTED" ] || [ "$T3_ACTUAL" != "$T3_EXPECTED" ]; then
527 printf 'Checksum mismatch for %s.\\n' "$T3_ARCHIVE" >&2; exit 1
528 fi
529 - tar -xzf "$T3_STAGING/$T3_ARCHIVE" -C "$T3_STAGING" --strip-components=1
529 + if ! T3_TAR_ERROR="$(tar -xzf "$T3_STAGING/$T3_ARCHIVE" -C "$T3_STAGING" --strip-components=1 2>&1)"; then
530 + # Some tars (BusyBox) gunzip internally, so gzip is only blamed once extraction fails.
531 + if command -v gzip >/dev/null 2>&1; then printf '%s\\n' "$T3_TAR_ERROR" >&2
532 + else printf 'Remote host needs gzip to unpack %s. Install gzip on it and try again.\\n' "$T3_ARCHIVE" >&2
533 + fi
534 + exit 1
535 + fi
536 rm -f "$T3_STAGING/$T3_ARCHIVE" "$T3_STAGING/SHA256SUMS"
537 # Prove the binary runs here (libc, arch) before marking it ready, or every
538 # later launch would exec a broken install instead of retrying.