Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/tmux/, app-misc/tmux/files/
Date: Thu, 28 Nov 2019 09:09:39
Message-Id: 1574932168.e53d3b04c12ae039d5b74bf755635020c61743a7.polynomial-c@gentoo
1 commit: e53d3b04c12ae039d5b74bf755635020c61743a7
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 28 08:09:00 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 28 09:09:28 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e53d3b04
7
8 app-misc/tmux: Fixed musl build
9
10 Package-Manager: Portage-2.3.80, Repoman-2.3.19
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 app-misc/tmux/files/tmux-3.0-musl.patch | 60 +++++++++++++++++++++++++++++++++
14 app-misc/tmux/tmux-3.0.ebuild | 1 +
15 2 files changed, 61 insertions(+)
16
17 diff --git a/app-misc/tmux/files/tmux-3.0-musl.patch b/app-misc/tmux/files/tmux-3.0-musl.patch
18 new file mode 100644
19 index 00000000000..5369fdd78b0
20 --- /dev/null
21 +++ b/app-misc/tmux/files/tmux-3.0-musl.patch
22 @@ -0,0 +1,60 @@
23 +From eb4d60b1ce0e2dc917bd47b10a3ce89de840448a Mon Sep 17 00:00:00 2001
24 +From: nicm <nicm>
25 +Date: Wed, 27 Nov 2019 20:54:30 +0000
26 +Subject: [PATCH] REG_STARTEND is not portable, but it turns out we don't
27 + actually need it. From Evan Green, GitHub issue 1982.
28 +
29 +---
30 + regsub.c | 24 ++++++++++++------------
31 + 1 file changed, 12 insertions(+), 12 deletions(-)
32 +
33 +diff --git a/regsub.c b/regsub.c
34 +index 199b21714..22e236dc7 100644
35 +--- a/regsub.c
36 ++++ b/regsub.c
37 +@@ -77,10 +77,7 @@ regsub(const char *pattern, const char *with, const char *text, int flags)
38 + end = strlen(text);
39 +
40 + while (start <= end) {
41 +- m[0].rm_so = start;
42 +- m[0].rm_eo = end;
43 +-
44 +- if (regexec(&r, text, nitems(m), m, REG_STARTEND) != 0) {
45 ++ if (regexec(&r, text + start, nitems(m), m, 0) != 0) {
46 + regsub_copy(&buf, &len, text, start, end);
47 + break;
48 + }
49 +@@ -89,22 +86,25 @@ regsub(const char *pattern, const char *with, const char *text, int flags)
50 + * Append any text not part of this match (from the end of the
51 + * last match).
52 + */
53 +- regsub_copy(&buf, &len, text, last, m[0].rm_so);
54 ++ regsub_copy(&buf, &len, text, last, m[0].rm_so + start);
55 +
56 + /*
57 + * If the last match was empty and this one isn't (it is either
58 + * later or has matched text), expand this match. If it is
59 + * empty, move on one character and try again from there.
60 + */
61 +- if (empty || m[0].rm_so != last || m[0].rm_so != m[0].rm_eo) {
62 +- regsub_expand(&buf, &len, with, text, m, nitems(m));
63 +-
64 +- last = m[0].rm_eo;
65 +- start = m[0].rm_eo;
66 ++ if (empty ||
67 ++ start + m[0].rm_so != last ||
68 ++ m[0].rm_so != m[0].rm_eo) {
69 ++ regsub_expand(&buf, &len, with, text + start, m,
70 ++ nitems(m));
71 ++
72 ++ last = start + m[0].rm_eo;
73 ++ start += m[0].rm_eo;
74 + empty = 0;
75 + } else {
76 +- last = m[0].rm_eo;
77 +- start = m[0].rm_eo + 1;
78 ++ last = start + m[0].rm_eo;
79 ++ start += m[0].rm_eo + 1;
80 + empty = 1;
81 + }
82 +
83
84 diff --git a/app-misc/tmux/tmux-3.0.ebuild b/app-misc/tmux/tmux-3.0.ebuild
85 index 350d8121d21..b0b4fb817a7 100644
86 --- a/app-misc/tmux/tmux-3.0.ebuild
87 +++ b/app-misc/tmux/tmux-3.0.ebuild
88 @@ -46,6 +46,7 @@ PATCHES=(
89 "${FILESDIR}/${PN}-2.4-flags.patch"
90
91 # upstream fixes (can be removed with next version bump)
92 + "${FILESDIR}/${P}-musl.patch"
93 )
94
95 src_prepare() {