Bug 279276 - sysutils/tmux: Fix crash when text selection using mouse
Summary: sysutils/tmux: Fix crash when text selection using mouse
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Mathieu Arnold
URL: https://github.com/microsoft/azurelin...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-24 18:33 UTC by Koichiro Iwao
Modified: 2025-01-31 22:28 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (mat)


Attachments
0001-sysutils-tmux-Fix-crash-when-text-selection-using-mo.patch (3.93 KB, patch)
2024-05-24 18:33 UTC, Koichiro Iwao
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Koichiro Iwao freebsd_committer freebsd_triage 2024-05-24 18:33:44 UTC
Created attachment 250928 [details]
0001-sysutils-tmux-Fix-crash-when-text-selection-using-mo.patch

Since tmux 3.4 is hold off at bug 277041, please consider to apply this patch to fix crash.
Comment 1 Koichiro Iwao freebsd_committer freebsd_triage 2024-05-24 18:41:30 UTC
It doesn't crash on 14.0-RELEASE but crashes on 14.1-STABLE FreeBSD 14.1-STABLE stable/14-n267784-e85f2ed0950 GENERIC amd64 for me.
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-06-14 08:33:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5a77b3ff4c0e9fed2b3dab55023735008cff1e73

commit 5a77b3ff4c0e9fed2b3dab55023735008cff1e73
Author:     Koichiro Iwao <meta@FreeBSD.org>
AuthorDate: 2024-05-24 18:15:51 +0000
Commit:     Koichiro Iwao <meta@FreeBSD.org>
CommitDate: 2024-06-14 08:31:54 +0000

    sysutils/tmux: Fix crash when text selection using mouse

    I re-ported a patch originally ported to 3.2a by Tobias Brick, a
    Microsoft employee to 3.3a. The patch depends on ncurses 6.4-20230423 or
    later so I bind this port to ncurses:port.

    See commit message of the patch for detail [1]

    [1] https://github.com/microsoft/azurelinux/blob/a1f78f2/SPECS/tmux/manual-patch-to-fix-crash-due-to-change-to-ncurses.patch

    PR:             279276
    Approved by:    maintainer timeout
    Obtained from:  https://github.com/microsoft/azurelinux/issues/6598
    Obtained from:  https://github.com/microsoft/azurelinux/pull/6766

 sysutils/tmux/Makefile                             |  4 +-
 ...-fix-crash-due-to-change-to-ncurses.patch (new) | 63 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 2 deletions(-)
Comment 3 Koichiro Iwao freebsd_committer freebsd_triage 2024-06-14 08:35:55 UTC
Committed due to maintainer timeout.
Comment 4 cynix 2024-07-14 23:43:36 UTC
tmux is now crashing for me on 14.1-RELEASE after this patch. It was fine on the previous version.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-02 13:24:40 UTC
stable/14 after 1401502 (14.2) and main after 1500020 have ncurces 6.5 - USES=ncurses:port not required anymore, but stable/13 (all 13.x), 14.1- and old 15-CURRENT have 6.2 and still need USES=ncurses:port:
diff --git a/sysutils/tmux/Makefile b/sysutils/tmux/Makefile
index 9592aef810b5..df99bfd471b2 100644
--- a/sysutils/tmux/Makefile
+++ b/sysutils/tmux/Makefile
@@ -15,7 +15,7 @@ LICENSE_FILE_GPLv2=   ${WRKSRC_bash}/COPYING
 LICENSE_DISTFILES_ISCL=        ${DISTNAME}${EXTRACT_SUFX}
 LICENSE_DISTFILES_GPLv2=       ${DISTFILE_bash}

-USES=          cpe ncurses:port pkgconfig
+USES=          cpe pkgconfig

 CPE_VENDOR=    tmux_project

@@ -23,7 +23,6 @@ USE_GITHUB=   nodefault
 GH_TUPLE=      imomaliev:tmux-bash-completion:8da7f79:bash

 GNU_CONFIGURE= yes
-GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
 CONFIGURE_ARGS=        --enable-utempter \
                --sysconfdir=${PREFIX}/etc

@@ -49,6 +48,14 @@ LIBEVENT_STATIC_VARS=                        LESTATIC=${LOCALBASE}/lib/libevent.a
 UTF8PROC_LIB_DEPENDS=          libutf8proc.so:textproc/utf8proc
 UTF8PROC_CONFIGURE_ENABLE=     utf8proc

+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} == FreeBSD && (${OSVERSION} < 1401502 || ${OSVERSION} >= 1500000 && ${OSVERSION} < 1500020)
+USES+= ncurses:port
+.else
+USES+= ncurses
+.endif
+
 post-patch:
        @${REINPLACE_CMD} -e 's|/etc/tmux.conf|${PREFIX}/etc/tmux.conf|g' ${WRKSRC}/CHANGES \
                ${WRKSRC}/tmux.h
@@ -69,4 +76,4 @@ post-install-EXAMPLES-on:
        @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
        ${INSTALL_DATA} ${WRKSRC}/example* ${STAGEDIR}${EXAMPLESDIR}

-.include <bsd.port.mk>
+.include <bsd.port.post.mk>

Tested in poudriere 14.1 amd64 and live system 14.2 amd64.

P.S. While here remove GNU_CONFIGURE_MANPREFIX.