commit:     1a1176bfb45ab7767bacf3bb38ba7289919ca021
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 30 16:47:47 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 30 16:48:21 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a1176bf

app-misc/tmux: add 3.6a

Add a warning for upgrading specifically to 3.6a but also in general
when upgrading tmux.

Bug: https://github.com/tmux/tmux/issues/4699
Bug: https://github.com/tmux/tmux/issues/4711
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-misc/tmux/Manifest                             |  1 +
 app-misc/tmux/files/tmux-3.6a-pane-color.patch     | 40 +++++++++++++
 app-misc/tmux/files/tmux-3.6a-race-fork.patch      | 69 ++++++++++++++++++++++
 app-misc/tmux/files/tmux-3.6a-sixel.patch          | 35 +++++++++++
 .../tmux/{tmux-9999.ebuild => tmux-3.6a.ebuild}    | 22 ++++++-
 app-misc/tmux/tmux-9999.ebuild                     | 19 +++++-
 6 files changed, 182 insertions(+), 4 deletions(-)

diff --git a/app-misc/tmux/Manifest b/app-misc/tmux/Manifest
index 37daebe717cd..8d3641c84510 100644
--- a/app-misc/tmux/Manifest
+++ b/app-misc/tmux/Manifest
@@ -1,2 +1,3 @@
 DIST tmux-3.4.tar.gz 707213 BLAKE2B 
2b1990b95d7439702e9287402d9828d4ecab573202c099aa482969c047b540d4b899f79d87587fc712e727d9cebf5fa7393512087e469fc355b4a30b1894e229
 SHA512 
bd3880211d99d8ee15947000abf8a1832fdfa48b29b2df81b66d5969cf3f4e64e746f984f6139bfc57e3ebee7fe8dc7cbb6bccb779307607de6c376969fecbff
 DIST tmux-3.5a.tar.gz 715619 BLAKE2B 
2314bc127f805071c9f2fe28be549b0948042a153aa68d997efc1dc0d6eba198b04aa16932d0a84b03250567100fb81c464919fcc8ba98660d3d0750ff5fe879
 SHA512 
2383e99aec2dcdb1d899793d5ecab40a68b921194f84770d3f4d19712bfc85590657a99d2a9a7bec36d4ba5ab39fa713f13937b0acad3b61cd9b2302dba61d43
+DIST tmux-3.6a.tar.gz 750698 BLAKE2B 
4b5f6b4dbdbb90af64204f300604f2d4df2c1746770d722057577b6b2d1c95014de1c8ada3f984295380ca6d6afa05292a8fb590b12b37c1699203fe4d7c469c
 SHA512 
bdc1a1dc7505b98966c5ed1303decc0cad883aae73ed9bc6d628ae060a7e9c4828a6ad64335de2a2f9b610118ce161ba456185676bb289c6f063091afa0a5b8b

diff --git a/app-misc/tmux/files/tmux-3.6a-pane-color.patch 
b/app-misc/tmux/files/tmux-3.6a-pane-color.patch
new file mode 100644
index 000000000000..0dbb349f5f94
--- /dev/null
+++ b/app-misc/tmux/files/tmux-3.6a-pane-color.patch
@@ -0,0 +1,40 @@
+https://github.com/tmux/tmux/issues/4732
+https://github.com/tmux/tmux/commit/afa05ae15ed7129690e42a6f207b6488ff86bee9
+
+From afa05ae15ed7129690e42a6f207b6488ff86bee9 Mon Sep 17 00:00:00 2001
+From: nicm <nicm>
+Date: Mon, 8 Dec 2025 21:32:50 +0000
+Subject: [PATCH] Use correct style for bottom line when pane status line is
+ on, GitHub issue 4732.
+
+---
+ screen-redraw.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/screen-redraw.c b/screen-redraw.c
+index db5187088..0dda2feae 100644
+--- a/screen-redraw.c
++++ b/screen-redraw.c
+@@ -197,9 +197,11 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, 
struct window_pane *wp,
+               } else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
+                       if ((wp->xoff == 0 || px >= wp->xoff) &&
+                           (px <= ex || (sb_w != 0 && px < ex + sb_w))) {
+-                              if (wp->yoff != 0 && py == wp->yoff - 1)
++                              if (pane_status != PANE_STATUS_BOTTOM &&
++                                  wp->yoff != 0 &&
++                                  py == wp->yoff - 1)
+                                       return (SCREEN_REDRAW_BORDER_TOP);
+-                              if (py == ey)
++                              if (pane_status != PANE_STATUS_TOP && py == ey)
+                                       return (SCREEN_REDRAW_BORDER_BOTTOM);
+                       }
+               }
+@@ -380,7 +382,6 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, 
u_int px, u_int py,
+ 
+               /* Check if CELL_SCROLLBAR */
+               if (window_pane_show_scrollbar(wp, pane_scrollbars)) {
+-
+                       if (pane_status == PANE_STATUS_TOP)
+                               line = wp->yoff - 1;
+                       else
+

diff --git a/app-misc/tmux/files/tmux-3.6a-race-fork.patch 
b/app-misc/tmux/files/tmux-3.6a-race-fork.patch
new file mode 100644
index 000000000000..bebd2b5bbc66
--- /dev/null
+++ b/app-misc/tmux/files/tmux-3.6a-race-fork.patch
@@ -0,0 +1,69 @@
+https://github.com/tmux/tmux/issues/4719
+https://github.com/tmux/tmux/commit/f58b8d0d6abb2477b584547a4e72cc362ecbbcdb
+https://github.com/tmux/tmux/issues/4719#issuecomment-3623649061 (so it 
applies to the portable version)
+--- a/spawn.c
++++ b/spawn.c
+@@ -211,7 +211,8 @@ spawn_pane(struct spawn_context *sc, char **cause)
+       struct environ           *child;
+       struct environ_entry     *ee;
+       char                    **argv, *cp, **argvp, *argv0, *cwd, *new_cwd;
+-      const char               *cmd, *tmp;
++      char                      path[PATH_MAX];
++      const char               *cmd, *tmp, *home = find_home(), *actual_cwd = 
NULL;
+       int                       argc;
+       u_int                     idx;
+       struct termios            now;
+@@ -366,6 +367,16 @@ spawn_pane(struct spawn_context *sc, char **cause)
+               goto complete;
+       }
+ 
++    /* Store current working directory and change to new one. */
++      if (getcwd(path, sizeof path) != NULL) {
++        if (chdir(new_wp->cwd) == 0)
++            actual_cwd = new_wp->cwd;
++        else if (home != NULL && chdir(home) == 0)
++            actual_cwd = home;
++        else if (chdir("/") == 0)
++            actual_cwd = "/";
++    }
++
+       /* Fork the new process. */
+       new_wp->pid = fdforkpty(ptm_fd, &new_wp->fd, new_wp->tty, NULL, &ws);
+       if (new_wp->pid == -1) {
+@@ -383,8 +394,12 @@ spawn_pane(struct spawn_context *sc, char **cause)
+ 
+       /* In the parent process, everything is done now. */
+       if (new_wp->pid != 0) {
++        if (actual_cwd != NULL &&
++            chdir(path) != 0 &&
++            (home == NULL || chdir(home) != 0))
++            chdir("/");
+               goto complete;
+-      }
++    }
+ 
+ #if defined(HAVE_SYSTEMD) && defined(ENABLE_CGROUPS)
+       /*
+@@ -396,18 +411,12 @@ spawn_pane(struct spawn_context *sc, char **cause)
+               free (*cause);
+       }
+ #endif
++
+       /*
+-       * Child process. Change to the working directory or home if that
+-       * fails.
++       * Child process. Set PWD to the working directory.
+        */
+-      if (chdir(new_wp->cwd) == 0)
+-              environ_set(child, "PWD", 0, "%s", new_wp->cwd);
+-      else if ((tmp = find_home()) != NULL && chdir(tmp) == 0)
+-              environ_set(child, "PWD", 0, "%s", tmp);
+-      else if (chdir("/") == 0)
+-              environ_set(child, "PWD", 0, "/");
+-      else
+-              fatal("chdir failed");
++      if (actual_cwd != NULL)
++              environ_set(child, "PWD", 0, "%s", actual_cwd);
+ 
+       /*
+        * Update terminal escape characters from the session if available and

diff --git a/app-misc/tmux/files/tmux-3.6a-sixel.patch 
b/app-misc/tmux/files/tmux-3.6a-sixel.patch
new file mode 100644
index 000000000000..a821ca8de470
--- /dev/null
+++ b/app-misc/tmux/files/tmux-3.6a-sixel.patch
@@ -0,0 +1,35 @@
+https://github.com/tmux/tmux/issues/4739
+https://github.com/tmux/tmux/commit/2e5e9c02982776a35a0378206966991e5dd4c723
+
+From 2e5e9c02982776a35a0378206966991e5dd4c723 Mon Sep 17 00:00:00 2001
+From: Nicholas Marriott <[email protected]>
+Date: Mon, 8 Dec 2025 21:41:30 +0000
+Subject: [PATCH] Fix calculation of scaled SIXEL size, from nincsnevem662 at
+ gmail dot com in GitHub issue 4739.
+
+---
+ image-sixel.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/image-sixel.c b/image-sixel.c
+index 1c93d7a77..5c8004619 100644
+--- a/image-sixel.c
++++ b/image-sixel.c
+@@ -455,12 +455,12 @@ sixel_scale(struct sixel_image *si, u_int xpixel, u_int 
ypixel, u_int ox,
+       new->p2 = si->p2;
+ 
+       new->set_ra = si->set_ra;
+-      /* clamp to slice end */
+-      new->ra_x = si->ra_x < psx ? si->ra_x : psx;
+-      new->ra_y = si->ra_y < psy ? si->ra_y : psy;
+-      /* subtract slice origin */
++      /* subtract offset */
+       new->ra_x = new->ra_x > pox ? new->ra_x - pox : 0;
+       new->ra_y = new->ra_y > poy ? new->ra_y - poy : 0;
++      /* clamp to size */
++      new->ra_x = si->ra_x < psx ? si->ra_x : psx;
++      new->ra_y = si->ra_y < psy ? si->ra_y : psy;
+       /* resize */
+       new->ra_x = new->ra_x * xpixel / si->xpixel;
+       new->ra_y = new->ra_y * ypixel / si->ypixel;
+

diff --git a/app-misc/tmux/tmux-9999.ebuild b/app-misc/tmux/tmux-3.6a.ebuild
similarity index 68%
copy from app-misc/tmux/tmux-9999.ebuild
copy to app-misc/tmux/tmux-3.6a.ebuild
index b3669c7d6e24..9c3194b2d9d5 100644
--- a/app-misc/tmux/tmux-9999.ebuild
+++ b/app-misc/tmux/tmux-3.6a.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit autotools flag-o-matic systemd
+inherit autotools eapi9-ver flag-o-matic systemd
 
 DESCRIPTION="Terminal multiplexer"
 HOMEPAGE="https://tmux.github.io/";
@@ -53,6 +53,9 @@ DOCS=( CHANGES README )
 
 PATCHES=(
        "${FILESDIR}"/${PN}-2.4-flags.patch
+       "${FILESDIR}"/${PN}-3.6a-race-fork.patch
+       "${FILESDIR}"/${PN}-3.6a-pane-color.patch
+       "${FILESDIR}"/${PN}-3.6a-sixel.patch
 )
 
 src_prepare() {
@@ -95,3 +98,18 @@ src_install() {
                systemd_newuserunit "${FILESDIR}"/tmux.socket [email protected]
        fi
 }
+
+pkg_postinst() {
+       # https://github.com/tmux/tmux/issues/4711
+       if ver_replacing -lt 3.6a ; then
+               ewarn "Please restart all running tmux sessions 
(client+server)."
+               ewarn "3.6a has an incompatible protocol change, so it is 
especially important:"
+               ewarn " 
https://github.com/tmux/tmux/issues/4699#issue-3666479306";
+       elif [[ ! ${REPLACING_VERSIONS} ]]; then
+               # https://github.com/tmux/tmux/issues/4699#issue-3666479306
+               # > Note that it is very important to restart tmux entirely 
after upgrading.
+               # > This is particularly important with this release because 
one of the libraries
+               # > that tmux uses changed its protocol.
+               ewarn "Please restart all running tmux clients+servers after 
upgrading tumx."
+       fi
+}

diff --git a/app-misc/tmux/tmux-9999.ebuild b/app-misc/tmux/tmux-9999.ebuild
index b3669c7d6e24..4afafecd9b2b 100644
--- a/app-misc/tmux/tmux-9999.ebuild
+++ b/app-misc/tmux/tmux-9999.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit autotools flag-o-matic systemd
+inherit autotools eapi9-ver flag-o-matic systemd
 
 DESCRIPTION="Terminal multiplexer"
 HOMEPAGE="https://tmux.github.io/";
@@ -95,3 +95,18 @@ src_install() {
                systemd_newuserunit "${FILESDIR}"/tmux.socket [email protected]
        fi
 }
+
+pkg_postinst() {
+       # https://github.com/tmux/tmux/issues/4711
+       if ver_replacing -lt 3.6a ; then
+               ewarn "Please restart all running tmux sessions 
(client+server)."
+               ewarn "3.6a has an incompatible protocol change, so it is 
especially important:"
+               ewarn " 
https://github.com/tmux/tmux/issues/4699#issue-3666479306";
+       elif [[ ! ${REPLACING_VERSIONS} ]]; then
+               # https://github.com/tmux/tmux/issues/4699#issue-3666479306
+               # > Note that it is very important to restart tmux entirely 
after upgrading.
+               # > This is particularly important with this release because 
one of the libraries
+               # > that tmux uses changed its protocol.
+               ewarn "Please restart all running tmux clients+servers after 
upgrading tumx."
+       fi
+}

Reply via email to