From b25af0a08ca7077fab88ec814cc8fcb57016a648 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 07:35:06 +0000 Subject: [PATCH 1/7] Reset layout manually instead of calling window_unzoom which can go down the notification path and end up double freeing the pane (this was previously removed in 2015 but added back to fix a problem with late destroy - this is a better fix). GitHub issue 5591 from Romain Francoise. --- window.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/window.c b/window.c index cbe65c615..be2048321 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.374 2026/09/08 08:37:56 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.375 2026/09/20 07:35:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -451,9 +451,17 @@ window_create(u_int sx, u_int sy, u_int xpixel, u_int ypixel) static void window_destroy(struct window *w) { + struct window_pane *wp; + log_debug("window @%u destroyed (%d references)", w->id, w->references); - window_unzoom(w, 0); + if (w->flags & WINDOW_ZOOMED) { + w->flags &= ~WINDOW_ZOOMED; + TAILQ_FOREACH(wp, &w->panes, entry) { + wp->flags &= ~PANE_ZOOMED; + wp->saved_layout_cell = NULL; + } + } RB_REMOVE(windows, &windows, w); layout_free_cell(w->layout_root, 0); From d1d07f97900801917bf4dda70775ac3bc5adb983 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 07:59:55 +0000 Subject: [PATCH 2/7] =?UTF-8?q?Expand=20-c=20for=20run-shell=20like=20the?= =?UTF-8?q?=20other=20-c=20flags,=20reported=20by=20Sa=C3=BAl=20Nogueras.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd-run-shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 7e0c62e56..4834cd9f7 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.94 2026/08/25 06:04:33 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.95 2026/09/20 07:59:55 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -164,7 +164,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item) if (cdata->client != NULL) cdata->client->references++; if (args_has(args, 'c')) - cdata->cwd = xstrdup(args_get(args, 'c')); + cdata->cwd = format_single_from_target(item, args_get(args, 'c')); else cdata->cwd = xstrdup(server_client_get_cwd(c, s)); From d4dc0325997224dedd1b7d3a39bfda20b8de3944 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 08:11:00 +0000 Subject: [PATCH 3/7] Do not loop forever if someone tries to give WCHAR_MAX a width, GitHub issue 5602. --- utf8.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utf8.c b/utf8.c index 076b1ff56..c36b4e4b2 100644 --- a/utf8.c +++ b/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.72 2026/09/01 12:49:49 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.73 2026/09/20 08:11:00 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -373,8 +373,13 @@ utf8_add_to_width_cache(const char *s) wc_end = wc_start; } - for (wc = wc_start; wc <= wc_end; wc++) + wc = wc_start; + for (;;) { utf8_insert_width_cache(wc, width); + if (wc == wc_end) + break; + wc++; + } } else { utf8_no_width = 1; ud = utf8_fromcstr(copy); From 2e9189c01da83f67c323770720044f724b74e92f Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 08:19:31 +0000 Subject: [PATCH 4/7] Fix session_*_flag format variables which loop over the windows (they should only be false if all windows do not have the flag, not the first one). GitHub issue 5599. --- format.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/format.c b/format.c index 86f7adb36..6ce9f0a53 100644 --- a/format.c +++ b/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.417 2026/09/08 15:42:26 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.418 2026/09/20 08:19:31 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -2862,10 +2862,10 @@ format_cb_session_activity_flag(struct format_tree *ft) if (ft->s != NULL) { RB_FOREACH(wl, winlinks, &ft->s->windows) { - if (ft->wl->flags & WINLINK_ACTIVITY) + if (wl->flags & WINLINK_ACTIVITY) return (xstrdup("1")); - return (xstrdup("0")); } + return (xstrdup("0")); } return (NULL); } @@ -2880,8 +2880,8 @@ format_cb_session_bell_flag(struct format_tree *ft) RB_FOREACH(wl, winlinks, &ft->s->windows) { if (wl->flags & WINLINK_BELL) return (xstrdup("1")); - return (xstrdup("0")); } + return (xstrdup("0")); } return (NULL); } @@ -2894,10 +2894,10 @@ format_cb_session_silence_flag(struct format_tree *ft) if (ft->s != NULL) { RB_FOREACH(wl, winlinks, &ft->s->windows) { - if (ft->wl->flags & WINLINK_SILENCE) + if (wl->flags & WINLINK_SILENCE) return (xstrdup("1")); - return (xstrdup("0")); } + return (xstrdup("0")); } return (NULL); } From bbd00148de188ac794b7d2ee4e01bc811e2511cd Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 08:37:47 +0000 Subject: [PATCH 5/7] Empty string for invalid old-style formats causes old iTerm2 versions to crash, so emit "0000," instead. --- layout-custom.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/layout-custom.c b/layout-custom.c index 48b12a967..59bfeb075 100644 --- a/layout-custom.c +++ b/layout-custom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-custom.c,v 1.41 2026/09/09 09:01:19 nicm Exp $ */ +/* $OpenBSD: layout-custom.c,v 1.42 2026/09/20 08:37:47 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -283,26 +283,28 @@ layout_checksum(const char *layout) char * layout_dump(__unused struct window *w, struct layout_cell *lcroot, int flags) { - struct layout_string layout_string; - char *out = NULL; + struct layout_string layout_string = { 0 }; + char *out; if (lcroot == NULL) - return NULL; - + goto bad; layout_string_init(&layout_string); - - if (layout_append(lcroot, &layout_string, flags) == 0) { - if (flags & LAYOUT_CUSTOM_OLD_FORMAT) - xasprintf(&out, "%04hx,%s", - layout_checksum(layout_string.dat), - layout_string.dat); - else - xasprintf(&out, "{\"V\":2,\"L\":%s}", - layout_string.dat); + if (layout_append(lcroot, &layout_string, flags) != 0) + goto bad; + if (~flags & LAYOUT_CUSTOM_OLD_FORMAT) + xasprintf(&out, "{\"V\":2,\"L\":%s}", layout_string.dat); + else { + xasprintf(&out, "%04hx,%s", layout_checksum(layout_string.dat), + layout_string.dat); } layout_string_free(&layout_string); - return (out); + +bad: + layout_string_free(&layout_string); + if (~flags & LAYOUT_CUSTOM_OLD_FORMAT) + return (NULL); + return (xstrdup("0000,")); } /* Append information for a single cell in a JSON (v2) format. */ From eee95e647958b2167c6cec333f099d4e6c13dff9 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 20 Sep 2026 08:42:46 +0000 Subject: [PATCH 6/7] If no floating panes, reset default starting position, and reset if any part of the pane goes outside the window. --- layout.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/layout.c b/layout.c index 377fdea33..74c3c29bb 100644 --- a/layout.c +++ b/layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout.c,v 1.100 2026/09/11 08:16:14 nicm Exp $ */ +/* $OpenBSD: layout.c,v 1.101 2026/09/20 08:42:46 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1728,7 +1728,7 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args, enum pane_lines lines, struct window *w, struct layout_geometry *lg, char **cause) { - int sx, sy, ox, oy; + int sx, sy, ox, oy, pad; char *error = NULL; sx = lg->sx == UINT_MAX ? w->sx / 2 : lg->sx; @@ -1777,12 +1777,20 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args, } } + if (!window_has_floating_panes(w)) { + w->last_new_pane_x = 0; + w->last_new_pane_y = 0; + } if (ox == INT_MAX) { if (w->last_new_pane_x == 0) ox = 4; else { + if (lines != PANE_LINES_NONE) + pad = 1; + else + pad = 0; ox = w->last_new_pane_x + 4; - if (w->last_new_pane_x > w->sx) + if (ox + sx + pad > (int)w->sx) ox = 4; } w->last_new_pane_x = ox; @@ -1793,8 +1801,12 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args, if (w->last_new_pane_y == 0) oy = 2; else { + if (lines != PANE_LINES_NONE) + pad = 1; + else + pad = 0; oy = w->last_new_pane_y + 2; - if (w->last_new_pane_y > w->sy) + if (oy + sy + pad > (int)w->sy) oy = 2; } w->last_new_pane_y = oy; From 56b36d671ee8aa48d84ee0bc25b72012eae4781e Mon Sep 17 00:00:00 2001 From: sthen Date: Sun, 20 Sep 2026 09:21:47 +0000 Subject: [PATCH 7/7] build tmux with debug symbols, ok claudio nicm --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fdaee5a6f..d7584aa04 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.123 2026/09/08 08:33:10 nicm Exp $ +# $OpenBSD: Makefile,v 1.124 2026/09/20 09:21:47 sthen Exp $ PROG= tmux SRCS= alerts.c \ @@ -154,6 +154,8 @@ CFLAGS += -I${.CURDIR} LDADD= -lutil -lcurses -levent -lm DPADD= ${LIBUTIL} ${LIBCURSES} ${LIBEVENT} ${LIBM} +DEBUG= -g + .if "${MACHINE_ARCH}" == "sh" screen-redraw.o: ${CC} ${CFLAGS} -fno-stack-protector ${CPPFLAGS} -c ${.IMPSRC}