Sync from SUSE:SLFO:Main tmux revision 2974142f383e8cf2a64558c3ac51abbe
This commit is contained in:
commit
0d711d067c
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
102
bash_completion_tmux.sh
Normal file
102
bash_completion_tmux.sh
Normal file
@ -0,0 +1,102 @@
|
||||
# START tmux completion
|
||||
# This file is in the public domain
|
||||
# See: http://www.debian-administration.org/articles/317 for how to write more.
|
||||
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
||||
_tmux()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
opts=" \
|
||||
attach-session \
|
||||
bind-key \
|
||||
break-pane \
|
||||
capture-pane \
|
||||
choose-client \
|
||||
choose-session \
|
||||
choose-window \
|
||||
clear-history \
|
||||
clock-mode \
|
||||
command-prompt \
|
||||
confirm-before \
|
||||
copy-buffer \
|
||||
copy-mode \
|
||||
delete-buffer \
|
||||
detach-client \
|
||||
display-message \
|
||||
display-panes \
|
||||
down-pane \
|
||||
find-window \
|
||||
has-session \
|
||||
if-shell \
|
||||
join-pane \
|
||||
kill-pane \
|
||||
kill-server \
|
||||
kill-session \
|
||||
kill-window \
|
||||
last-window \
|
||||
link-window \
|
||||
list-buffers \
|
||||
list-clients \
|
||||
list-commands \
|
||||
list-keys \
|
||||
list-panes \
|
||||
list-sessions \
|
||||
list-windows \
|
||||
load-buffer \
|
||||
lock-client \
|
||||
lock-server \
|
||||
lock-session \
|
||||
move-window \
|
||||
new-session \
|
||||
new-window \
|
||||
next-layout \
|
||||
next-window \
|
||||
paste-buffer \
|
||||
pipe-pane \
|
||||
previous-layout \
|
||||
previous-window \
|
||||
refresh-client \
|
||||
rename-session \
|
||||
rename-window \
|
||||
resize-pane \
|
||||
respawn-window \
|
||||
rotate-window \
|
||||
run-shell \
|
||||
save-buffer \
|
||||
select-layout \
|
||||
select-pane \
|
||||
select-prompt \
|
||||
select-window \
|
||||
send-keys \
|
||||
send-prefix \
|
||||
server-info \
|
||||
set-buffer \
|
||||
set-environment \
|
||||
set-option \
|
||||
set-window-option \
|
||||
show-buffer \
|
||||
show-environment \
|
||||
show-messages \
|
||||
show-options \
|
||||
show-window-options \
|
||||
source-file \
|
||||
split-window \
|
||||
start-server \
|
||||
suspend-client \
|
||||
swap-pane \
|
||||
swap-window \
|
||||
switch-client \
|
||||
unbind-key \
|
||||
unlink-window \
|
||||
up-pane"
|
||||
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
|
||||
}
|
||||
complete -F _tmux tmux
|
||||
|
||||
# END tmux completion
|
816
ncurses.patch
Normal file
816
ncurses.patch
Normal file
@ -0,0 +1,816 @@
|
||||
diff --git a/compat.h b/compat.h
|
||||
index cabdf3ad..7b543128 100644
|
||||
--- a/compat.h
|
||||
+++ b/compat.h
|
||||
@@ -435,6 +435,11 @@ int utf8proc_mbtowc(wchar_t *, const char *, size_t);
|
||||
int utf8proc_wctomb(char *, wchar_t);
|
||||
#endif
|
||||
|
||||
+/* tparm.c */
|
||||
+#ifndef HAVE_TIPARM
|
||||
+char *compat_tiparm(const char *, ...);
|
||||
+#endif
|
||||
+
|
||||
#ifdef NEED_FUZZING
|
||||
/* tmux.c */
|
||||
#define main __weak main
|
||||
diff --git a/compat/tiparm.c b/compat/tiparm.c
|
||||
new file mode 100644
|
||||
index 00000000..01d0adf0
|
||||
--- /dev/null
|
||||
+++ b/compat/tiparm.c
|
||||
@@ -0,0 +1,655 @@
|
||||
+/* $NetBSD: tparm.c,v 1.19 2021/08/27 18:40:28 rillig Exp $ */
|
||||
+
|
||||
+/*
|
||||
+ * Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc.
|
||||
+ *
|
||||
+ * This code is derived from software contributed to The NetBSD Foundation
|
||||
+ * by Roy Marples.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#include <sys/cdefs.h>
|
||||
+#if 0
|
||||
+__RCSID("$NetBSD: tparm.c,v 1.19 2021/08/27 18:40:28 rillig Exp $");
|
||||
+#endif
|
||||
+#include <sys/param.h>
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <ctype.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdarg.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#if 0
|
||||
+#include <term_private.h>
|
||||
+#include <term.h>
|
||||
+#endif
|
||||
+
|
||||
+#define TPARM_MAX 9 /* not likely to change */
|
||||
+
|
||||
+typedef struct {
|
||||
+ /* Output buffer for tparm */
|
||||
+ char *_buf;
|
||||
+ size_t _buflen;
|
||||
+ size_t _bufpos;
|
||||
+ /* A-Z static variables for tparm */
|
||||
+ long _snums[26];
|
||||
+} TERMINAL;
|
||||
+
|
||||
+#define _DIAGASSERT(x)
|
||||
+
|
||||
+#define LONG_STR_MAX ((CHAR_BIT * sizeof(long)) / 3)
|
||||
+#define BUFINC 128 /* Size to increment the terminal buffer by */
|
||||
+
|
||||
+#define VA_LONG_LONG 1
|
||||
+#define VA_CHAR_INT 2
|
||||
+//#define VA_CHAR_LONG 3 /* No need for this yet */
|
||||
+
|
||||
+static TERMINAL *dumbterm; /* For non thread safe functions */
|
||||
+
|
||||
+typedef struct {
|
||||
+ long nums[20];
|
||||
+ char *strings[20];
|
||||
+ size_t offset;
|
||||
+} TPSTACK;
|
||||
+
|
||||
+typedef struct {
|
||||
+ long num;
|
||||
+ char *string;
|
||||
+} TPVAR;
|
||||
+
|
||||
+static int
|
||||
+push(long num, char *string, TPSTACK *stack)
|
||||
+{
|
||||
+ if (stack->offset >= sizeof(stack->nums)) {
|
||||
+ errno = E2BIG;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ stack->nums[stack->offset] = num;
|
||||
+ stack->strings[stack->offset] = string;
|
||||
+ stack->offset++;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+pop(long *num, char **string, TPSTACK *stack)
|
||||
+{
|
||||
+ if (stack->offset == 0) {
|
||||
+ if (num)
|
||||
+ *num = 0;
|
||||
+ if (string)
|
||||
+ *string = NULL;
|
||||
+ errno = E2BIG;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ stack->offset--;
|
||||
+ if (num)
|
||||
+ *num = stack->nums[stack->offset];
|
||||
+ if (string)
|
||||
+ *string = stack->strings[stack->offset];
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+checkbuf(TERMINAL *term, size_t len)
|
||||
+{
|
||||
+ char *buf;
|
||||
+
|
||||
+ if (term->_bufpos + len >= term->_buflen) {
|
||||
+ len = term->_buflen + MAX(len, BUFINC);
|
||||
+ buf = realloc(term->_buf, len);
|
||||
+ if (buf == NULL)
|
||||
+ return NULL;
|
||||
+ term->_buf = buf;
|
||||
+ term->_buflen = len;
|
||||
+ }
|
||||
+ return term->_buf;
|
||||
+}
|
||||
+
|
||||
+static size_t
|
||||
+ochar(TERMINAL *term, int c)
|
||||
+{
|
||||
+ if (c == 0)
|
||||
+ c = 0200;
|
||||
+ /* Check we have space and a terminator */
|
||||
+ if (checkbuf(term, 2) == NULL)
|
||||
+ return 0;
|
||||
+ term->_buf[term->_bufpos++] = (char)c;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static size_t
|
||||
+onum(TERMINAL *term, const char *fmt, int num, size_t len)
|
||||
+{
|
||||
+ int l;
|
||||
+ size_t r;
|
||||
+
|
||||
+ if (len < LONG_STR_MAX)
|
||||
+ len = LONG_STR_MAX;
|
||||
+ if (checkbuf(term, len + 2) == NULL)
|
||||
+ return 0;
|
||||
+ l = snprintf(term->_buf + term->_bufpos, len + 2, fmt, num);
|
||||
+ if (l == -1)
|
||||
+ return 0;
|
||||
+ r = (size_t)l;
|
||||
+ term->_bufpos += r;
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ Make a pass through the string so we can work out
|
||||
+ which parameters are ints and which are char *.
|
||||
+ Basically we only use char * if %p[1-9] is followed by %l or %s.
|
||||
+*/
|
||||
+static int
|
||||
+_ti_parm_analyse(const char *str, int *piss, int piss_len)
|
||||
+{
|
||||
+ int nparm, lpop;
|
||||
+ char c;
|
||||
+
|
||||
+ nparm = 0;
|
||||
+ lpop = -1;
|
||||
+ while ((c = *str++) != '\0') {
|
||||
+ if (c != '%')
|
||||
+ continue;
|
||||
+ c = *str++;
|
||||
+ switch (c) {
|
||||
+ case 'l':
|
||||
+ case 's':
|
||||
+ if (lpop > 0) {
|
||||
+ if (lpop <= piss_len)
|
||||
+ piss[lpop - 1] = 1;
|
||||
+ else if (piss)
|
||||
+ errno = E2BIG;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'p':
|
||||
+ c = *str++;
|
||||
+ if (c < '1' || c > '9') {
|
||||
+ errno = EINVAL;
|
||||
+ continue;
|
||||
+ } else {
|
||||
+ lpop = c - '0';
|
||||
+ if (lpop > nparm)
|
||||
+ nparm = lpop;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ lpop = -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nparm;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+_ti_tiparm(TERMINAL *term, const char *str, int va_type, va_list parms)
|
||||
+{
|
||||
+ char c, fmt[64], *fp, *ostr;
|
||||
+ long val, val2;
|
||||
+ long dnums[26]; /* dynamic variables a-z, not preserved */
|
||||
+ size_t l, max, width, precision, olen;
|
||||
+ TPSTACK stack;
|
||||
+ TPVAR params[TPARM_MAX];
|
||||
+ unsigned int done, dot, minus;
|
||||
+ int piss[TPARM_MAX]; /* Parameter IS String - piss ;) */
|
||||
+
|
||||
+ if (str == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /*
|
||||
+ If not passed a terminal, malloc a dummy one.
|
||||
+ This means we can preserve buffers and variables per terminal and
|
||||
+ still work with non thread safe functions (which sadly are still the
|
||||
+ norm and standard).
|
||||
+ */
|
||||
+ if (term == NULL) {
|
||||
+ if (dumbterm == NULL) {
|
||||
+ dumbterm = malloc(sizeof(*dumbterm));
|
||||
+ if (dumbterm == NULL)
|
||||
+ return NULL;
|
||||
+ dumbterm->_buflen = 0;
|
||||
+ }
|
||||
+ term = dumbterm;
|
||||
+ }
|
||||
+
|
||||
+ term->_bufpos = 0;
|
||||
+ /* Ensure we have an initial buffer */
|
||||
+ if (term->_buflen == 0) {
|
||||
+ term->_buf = malloc(BUFINC);
|
||||
+ if (term->_buf == NULL)
|
||||
+ return NULL;
|
||||
+ term->_buflen = BUFINC;
|
||||
+ }
|
||||
+
|
||||
+ memset(&piss, 0, sizeof(piss));
|
||||
+ max = (size_t)_ti_parm_analyse(str, piss, TPARM_MAX);
|
||||
+
|
||||
+ /* Put our parameters into variables */
|
||||
+ memset(¶ms, 0, sizeof(params));
|
||||
+ for (l = 0; l < max; l++) {
|
||||
+ if (piss[l]) {
|
||||
+ if (va_type == VA_LONG_LONG) {
|
||||
+ /* This only works if char * fits into a long
|
||||
+ * on this platform. */
|
||||
+ if (sizeof(char *) <= sizeof(long))
|
||||
+ params[l].string =
|
||||
+ (char *)va_arg(parms, long);
|
||||
+ else {
|
||||
+ errno = ENOTSUP;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ } else
|
||||
+ params[l].string = va_arg(parms, char *);
|
||||
+ } else {
|
||||
+ if (va_type == VA_CHAR_INT)
|
||||
+ params[l].num = (long)va_arg(parms, int);
|
||||
+ else
|
||||
+ params[l].num = va_arg(parms, long);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ memset(&stack, 0, sizeof(stack));
|
||||
+ while ((c = *str++) != '\0') {
|
||||
+ if (c != '%' || (c = *str++) == '%') {
|
||||
+ if (c == '\0')
|
||||
+ break;
|
||||
+ if (ochar(term, c) == 0)
|
||||
+ return NULL;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Handle formatting. */
|
||||
+ fp = fmt;
|
||||
+ *fp++ = '%';
|
||||
+ done = dot = minus = 0;
|
||||
+ width = precision = 0;
|
||||
+ val = 0;
|
||||
+ while (done == 0 && (size_t)(fp - fmt) < sizeof(fmt)) {
|
||||
+ switch (c) {
|
||||
+ case 'c':
|
||||
+ case 's':
|
||||
+ *fp++ = c;
|
||||
+ done = 1;
|
||||
+ break;
|
||||
+ case 'd':
|
||||
+ case 'o':
|
||||
+ case 'x':
|
||||
+ case 'X':
|
||||
+ *fp++ = 'l';
|
||||
+ *fp++ = c;
|
||||
+ done = 1;
|
||||
+ break;
|
||||
+ case '#':
|
||||
+ case ' ':
|
||||
+ *fp++ = c;
|
||||
+ break;
|
||||
+ case '.':
|
||||
+ *fp++ = c;
|
||||
+ if (dot == 0) {
|
||||
+ dot = 1;
|
||||
+ width = (size_t)val;
|
||||
+ } else
|
||||
+ done = 2;
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ case ':':
|
||||
+ minus = 1;
|
||||
+ break;
|
||||
+ case '-':
|
||||
+ if (minus)
|
||||
+ *fp++ = c;
|
||||
+ else
|
||||
+ done = 1;
|
||||
+ break;
|
||||
+ default:
|
||||
+ if (isdigit((unsigned char)c)) {
|
||||
+ val = (val * 10) + (c - '0');
|
||||
+ if (val > 10000)
|
||||
+ done = 2;
|
||||
+ else
|
||||
+ *fp++ = c;
|
||||
+ } else
|
||||
+ done = 1;
|
||||
+ }
|
||||
+ if (done == 0)
|
||||
+ c = *str++;
|
||||
+ }
|
||||
+ if (done == 2) {
|
||||
+ /* Found an error in the format */
|
||||
+ fp = fmt + 1;
|
||||
+ *fp = *str;
|
||||
+ olen = 0;
|
||||
+ } else {
|
||||
+ if (dot == 0)
|
||||
+ width = (size_t)val;
|
||||
+ else
|
||||
+ precision = (size_t)val;
|
||||
+ olen = MAX(width, precision);
|
||||
+ }
|
||||
+ *fp++ = '\0';
|
||||
+
|
||||
+ /* Handle commands */
|
||||
+ switch (c) {
|
||||
+ case 'c':
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ if (ochar(term, (unsigned char)val) == 0)
|
||||
+ return NULL;
|
||||
+ break;
|
||||
+ case 's':
|
||||
+ pop(NULL, &ostr, &stack);
|
||||
+ if (ostr != NULL) {
|
||||
+ int r;
|
||||
+
|
||||
+ l = strlen(ostr);
|
||||
+ if (l < (size_t)olen)
|
||||
+ l = olen;
|
||||
+ if (checkbuf(term, (size_t)(l + 1)) == NULL)
|
||||
+ return NULL;
|
||||
+ r = snprintf(term->_buf + term->_bufpos, l + 1,
|
||||
+ fmt, ostr);
|
||||
+ if (r != -1)
|
||||
+ term->_bufpos += (size_t)r;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'l':
|
||||
+ pop(NULL, &ostr, &stack);
|
||||
+ if (ostr == NULL)
|
||||
+ l = 0;
|
||||
+ else
|
||||
+ l = strlen(ostr);
|
||||
+#ifdef NCURSES_COMPAT_57
|
||||
+ if (onum(term, "%ld", (long)l, 0) == 0)
|
||||
+ return NULL;
|
||||
+#else
|
||||
+ push((long)l, NULL, &stack);
|
||||
+#endif
|
||||
+ break;
|
||||
+ case 'd':
|
||||
+ case 'o':
|
||||
+ case 'x':
|
||||
+ case 'X':
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ if (onum(term, fmt, (int)val, olen) == 0)
|
||||
+ return NULL;
|
||||
+ break;
|
||||
+ case 'p':
|
||||
+ if (*str < '1' || *str > '9')
|
||||
+ break;
|
||||
+ l = (size_t)(*str++ - '1');
|
||||
+ if (push(params[l].num, params[l].string, &stack))
|
||||
+ return NULL;
|
||||
+ break;
|
||||
+ case 'P':
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ if (*str >= 'a' && *str <= 'z')
|
||||
+ dnums[*str - 'a'] = val;
|
||||
+ else if (*str >= 'A' && *str <= 'Z')
|
||||
+ term->_snums[*str - 'A'] = val;
|
||||
+ break;
|
||||
+ case 'g':
|
||||
+ if (*str >= 'a' && *str <= 'z') {
|
||||
+ if (push(dnums[*str - 'a'], NULL, &stack))
|
||||
+ return NULL;
|
||||
+ } else if (*str >= 'A' && *str <= 'Z') {
|
||||
+ if (push(term->_snums[*str - 'A'],
|
||||
+ NULL, &stack))
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'i':
|
||||
+ if (piss[0] == 0)
|
||||
+ params[0].num++;
|
||||
+ if (piss[1] == 0)
|
||||
+ params[1].num++;
|
||||
+ break;
|
||||
+ case '\'':
|
||||
+ if (push((long)(unsigned char)*str++, NULL, &stack))
|
||||
+ return NULL;
|
||||
+ while (*str != '\0' && *str != '\'')
|
||||
+ str++;
|
||||
+ if (*str == '\'')
|
||||
+ str++;
|
||||
+ break;
|
||||
+ case '{':
|
||||
+ val = 0;
|
||||
+ for (; isdigit((unsigned char)*str); str++)
|
||||
+ val = (val * 10) + (*str - '0');
|
||||
+ if (push(val, NULL, &stack))
|
||||
+ return NULL;
|
||||
+ while (*str != '\0' && *str != '}')
|
||||
+ str++;
|
||||
+ if (*str == '}')
|
||||
+ str++;
|
||||
+ break;
|
||||
+ case '+':
|
||||
+ case '-':
|
||||
+ case '*':
|
||||
+ case '/':
|
||||
+ case 'm':
|
||||
+ case 'A':
|
||||
+ case 'O':
|
||||
+ case '&':
|
||||
+ case '|':
|
||||
+ case '^':
|
||||
+ case '=':
|
||||
+ case '<':
|
||||
+ case '>':
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ pop(&val2, NULL, &stack);
|
||||
+ switch (c) {
|
||||
+ case '+':
|
||||
+ val = val + val2;
|
||||
+ break;
|
||||
+ case '-':
|
||||
+ val = val2 - val;
|
||||
+ break;
|
||||
+ case '*':
|
||||
+ val = val * val2;
|
||||
+ break;
|
||||
+ case '/':
|
||||
+ val = val ? val2 / val : 0;
|
||||
+ break;
|
||||
+ case 'm':
|
||||
+ val = val ? val2 % val : 0;
|
||||
+ break;
|
||||
+ case 'A':
|
||||
+ val = val && val2;
|
||||
+ break;
|
||||
+ case 'O':
|
||||
+ val = val || val2;
|
||||
+ break;
|
||||
+ case '&':
|
||||
+ val = val & val2;
|
||||
+ break;
|
||||
+ case '|':
|
||||
+ val = val | val2;
|
||||
+ break;
|
||||
+ case '^':
|
||||
+ val = val ^ val2;
|
||||
+ break;
|
||||
+ case '=':
|
||||
+ val = val == val2;
|
||||
+ break;
|
||||
+ case '<':
|
||||
+ val = val2 < val;
|
||||
+ break;
|
||||
+ case '>':
|
||||
+ val = val2 > val;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (push(val, NULL, &stack))
|
||||
+ return NULL;
|
||||
+ break;
|
||||
+ case '!':
|
||||
+ case '~':
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ switch (c) {
|
||||
+ case '!':
|
||||
+ val = !val;
|
||||
+ break;
|
||||
+ case '~':
|
||||
+ val = ~val;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (push(val, NULL, &stack))
|
||||
+ return NULL;
|
||||
+ break;
|
||||
+ case '?': /* if */
|
||||
+ break;
|
||||
+ case 't': /* then */
|
||||
+ pop(&val, NULL, &stack);
|
||||
+ if (val == 0) {
|
||||
+ l = 0;
|
||||
+ for (; *str != '\0'; str++) {
|
||||
+ if (*str != '%')
|
||||
+ continue;
|
||||
+ str++;
|
||||
+ if (*str == '?')
|
||||
+ l++;
|
||||
+ else if (*str == ';') {
|
||||
+ if (l > 0)
|
||||
+ l--;
|
||||
+ else {
|
||||
+ str++;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else if (*str == 'e' && l == 0) {
|
||||
+ str++;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'e': /* else */
|
||||
+ l = 0;
|
||||
+ for (; *str != '\0'; str++) {
|
||||
+ if (*str != '%')
|
||||
+ continue;
|
||||
+ str++;
|
||||
+ if (*str == '?')
|
||||
+ l++;
|
||||
+ else if (*str == ';') {
|
||||
+ if (l > 0)
|
||||
+ l--;
|
||||
+ else {
|
||||
+ str++;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ case ';': /* fi */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ term->_buf[term->_bufpos] = '\0';
|
||||
+ return term->_buf;
|
||||
+}
|
||||
+
|
||||
+#if 0
|
||||
+char *
|
||||
+ti_tiparm(TERMINAL *term, const char *str, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ char *ret;
|
||||
+
|
||||
+ _DIAGASSERT(term != NULL);
|
||||
+ _DIAGASSERT(str != NULL);
|
||||
+
|
||||
+ va_start(va, str);
|
||||
+ ret = _ti_tiparm(term, str, VA_CHAR_INT, va);
|
||||
+ va_end(va);
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+char *
|
||||
+compat_tiparm(const char *str, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ char *ret;
|
||||
+
|
||||
+ _DIAGASSERT(str != NULL);
|
||||
+
|
||||
+ va_start(va, str);
|
||||
+ ret = _ti_tiparm(NULL, str, VA_CHAR_INT, va);
|
||||
+ va_end(va);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#if 0
|
||||
+#ifdef VA_CHAR_LONG
|
||||
+char *
|
||||
+ti_tlparm(TERMINAL *term, const char *str, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ char *ret;
|
||||
+
|
||||
+ _DIAGASSERT(term != NULL);
|
||||
+ _DIAGASSERT(str != NULL);
|
||||
+
|
||||
+ va_start(va, str);
|
||||
+ ret = _ti_tiparm(term, str, VA_CHAR_LONG, va);
|
||||
+ va_end(va);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+tlparm(const char *str, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ char *ret;
|
||||
+
|
||||
+ _DIAGASSERT(str != NULL);
|
||||
+
|
||||
+ va_start(va, str);
|
||||
+ ret = _ti_tiparm(NULL, str, VA_CHAR_LONG, va);
|
||||
+ va_end(va);
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static char *
|
||||
+_tparm(const char *str, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ char *ret;
|
||||
+
|
||||
+ _DIAGASSERT(str != NULL);
|
||||
+
|
||||
+ va_start(va, str);
|
||||
+ ret = _ti_tiparm(NULL, str, VA_LONG_LONG, va);
|
||||
+ va_end(va);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+tparm(const char *str,
|
||||
+ long p1, long p2, long p3, long p4, long p5,
|
||||
+ long p6, long p7, long p8, long p9)
|
||||
+{
|
||||
+
|
||||
+ return _tparm(str, p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
+}
|
||||
+#endif
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 4b9d75b3..ccbedfee 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -351,6 +351,37 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
+# Replace tparm on newer ncurses where it has string requirements that are
|
||||
+# too strict for tmux (requires capabilities to exist).
|
||||
+AC_MSG_CHECKING(for ncurses with suitable tiparm)
|
||||
+AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||
+ [
|
||||
+ #include <stdlib.h>
|
||||
+ #if defined(HAVE_CURSES_H)
|
||||
+ #include <curses.h>
|
||||
+ #elif defined(HAVE_NCURSES_H)
|
||||
+ #include <ncurses.h>
|
||||
+ #endif
|
||||
+ int main(void) {
|
||||
+ #if defined(NCURSES_VERSION_MAJOR) && \
|
||||
+ (NCURSES_VERSION_MAJOR > 6 || \
|
||||
+ (NCURSES_VERSION_MAJOR == 6 && NCURSES_VERSION_MINOR > 3))
|
||||
+ exit(0);
|
||||
+ #else
|
||||
+ exit(1);
|
||||
+ #endif
|
||||
+ }
|
||||
+ ])],
|
||||
+ [
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ AC_LIBOBJ(tiparm)
|
||||
+ ],
|
||||
+ [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_REPLACE_FUNCS(tiparm)
|
||||
+ ]
|
||||
+)
|
||||
+
|
||||
# Look for utempter.
|
||||
AC_ARG_ENABLE(
|
||||
utempter,
|
||||
@@ -438,7 +469,7 @@ fi
|
||||
|
||||
# Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
|
||||
AC_MSG_CHECKING(for b64_ntop)
|
||||
- AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
diff --git a/tty-term.c b/tty-term.c
|
||||
index 4e9b7799..6fad619f 100644
|
||||
--- a/tty-term.c
|
||||
+++ b/tty-term.c
|
||||
@@ -768,33 +768,78 @@ tty_term_string(struct tty_term *term, enum tty_code_code code)
|
||||
const char *
|
||||
tty_term_string1(struct tty_term *term, enum tty_code_code code, int a)
|
||||
{
|
||||
- return (tparm((char *) tty_term_string(term, code), a, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||
+ const char *s;
|
||||
+
|
||||
+#ifndef HAVE_TIPARM
|
||||
+ s = compat_tiparm(tty_term_string(term, code), a);
|
||||
+#else
|
||||
+ s = tiparm(tty_term_string(term, code), a);
|
||||
+#endif
|
||||
+ if (s == NULL)
|
||||
+ fatalx("could not expand %s", tty_term_codes[code].name);
|
||||
+ return s;
|
||||
}
|
||||
|
||||
const char *
|
||||
tty_term_string2(struct tty_term *term, enum tty_code_code code, int a, int b)
|
||||
{
|
||||
- return (tparm((char *) tty_term_string(term, code), a, b, 0, 0, 0, 0, 0, 0, 0));
|
||||
+ const char *s;
|
||||
+
|
||||
+#ifndef HAVE_TIPARM
|
||||
+ s = compat_tiparm(tty_term_string(term, code), a, b);
|
||||
+#else
|
||||
+ s = tiparm(tty_term_string(term, code), a, b);
|
||||
+#endif
|
||||
+ if (s == NULL)
|
||||
+ fatalx("could not expand %s", tty_term_codes[code].name);
|
||||
+ return s;
|
||||
}
|
||||
|
||||
const char *
|
||||
tty_term_string3(struct tty_term *term, enum tty_code_code code, int a, int b,
|
||||
int c)
|
||||
{
|
||||
- return (tparm((char *) tty_term_string(term, code), a, b, c, 0, 0, 0, 0, 0, 0));
|
||||
+ const char *s;
|
||||
+
|
||||
+#ifndef HAVE_TIPARM
|
||||
+ s = compat_tiparm(tty_term_string(term, code), a, b, c);
|
||||
+#else
|
||||
+ s = tiparm(tty_term_string(term, code), a, b, c);
|
||||
+#endif
|
||||
+ if (s == NULL)
|
||||
+ fatalx("could not expand %s", tty_term_codes[code].name);
|
||||
+ return s;
|
||||
}
|
||||
|
||||
const char *
|
||||
tty_term_ptr1(struct tty_term *term, enum tty_code_code code, const void *a)
|
||||
{
|
||||
- return (tparm((char *) tty_term_string(term, code), (long)a, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||
+ const char *s;
|
||||
+
|
||||
+#ifndef HAVE_TIPARM
|
||||
+ s = compat_tiparm(tty_term_string(term, code), a);
|
||||
+#else
|
||||
+ s = tiparm(tty_term_string(term, code), a);
|
||||
+#endif
|
||||
+ if (s == NULL)
|
||||
+ fatalx("could not expand %s", tty_term_codes[code].name);
|
||||
+ return s;
|
||||
}
|
||||
|
||||
const char *
|
||||
tty_term_ptr2(struct tty_term *term, enum tty_code_code code, const void *a,
|
||||
const void *b)
|
||||
{
|
||||
- return (tparm((char *) tty_term_string(term, code), (long)a, (long)b, 0, 0, 0, 0, 0, 0, 0));
|
||||
+ const char *s;
|
||||
+
|
||||
+#ifndef HAVE_TIPARM
|
||||
+ s = compat_tiparm(tty_term_string(term, code), a, b);
|
||||
+#else
|
||||
+ s = tiparm(tty_term_string(term, code), a, b);
|
||||
+#endif
|
||||
+ if (s == NULL)
|
||||
+ fatalx("could not expand %s", tty_term_codes[code].name);
|
||||
+ return s;
|
||||
}
|
||||
|
||||
int
|
BIN
tmux-3.3a.tar.gz
(Stored with Git LFS)
Normal file
BIN
tmux-3.3a.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
58
tmux-CVE-2022-47016.patch
Normal file
58
tmux-CVE-2022-47016.patch
Normal file
@ -0,0 +1,58 @@
|
||||
Index: tmux-3.3a/control.c
|
||||
===================================================================
|
||||
--- tmux-3.3a.orig/control.c
|
||||
+++ tmux-3.3a/control.c
|
||||
@@ -775,6 +775,9 @@ control_start(struct client *c)
|
||||
|
||||
cs->read_event = bufferevent_new(c->fd, control_read_callback,
|
||||
control_write_callback, control_error_callback, c);
|
||||
+ if (cs->read_event == NULL)
|
||||
+ fatalx("out of memory");
|
||||
+
|
||||
bufferevent_enable(cs->read_event, EV_READ);
|
||||
|
||||
if (c->flags & CLIENT_CONTROLCONTROL)
|
||||
@@ -782,6 +785,8 @@ control_start(struct client *c)
|
||||
else {
|
||||
cs->write_event = bufferevent_new(c->out_fd, NULL,
|
||||
control_write_callback, control_error_callback, c);
|
||||
+ if (cs->write_event == NULL)
|
||||
+ fatalx("out of memory");
|
||||
}
|
||||
bufferevent_setwatermark(cs->write_event, EV_WRITE, CONTROL_BUFFER_LOW,
|
||||
0);
|
||||
Index: tmux-3.3a/file.c
|
||||
===================================================================
|
||||
--- tmux-3.3a.orig/file.c
|
||||
+++ tmux-3.3a/file.c
|
||||
@@ -585,6 +585,8 @@ file_write_open(struct client_files *fil
|
||||
|
||||
cf->event = bufferevent_new(cf->fd, NULL, file_write_callback,
|
||||
file_write_error_callback, cf);
|
||||
+ if (cf->event == NULL)
|
||||
+ fatalx("out of memory");
|
||||
bufferevent_enable(cf->event, EV_WRITE);
|
||||
goto reply;
|
||||
|
||||
@@ -744,6 +746,8 @@ file_read_open(struct client_files *file
|
||||
|
||||
cf->event = bufferevent_new(cf->fd, file_read_callback, NULL,
|
||||
file_read_error_callback, cf);
|
||||
+ if (cf->event == NULL)
|
||||
+ fatalx("out of memory");
|
||||
bufferevent_enable(cf->event, EV_READ);
|
||||
return;
|
||||
|
||||
Index: tmux-3.3a/window.c
|
||||
===================================================================
|
||||
--- tmux-3.3a.orig/window.c
|
||||
+++ tmux-3.3a/window.c
|
||||
@@ -1042,6 +1042,8 @@ window_pane_set_event(struct window_pane
|
||||
|
||||
wp->event = bufferevent_new(wp->fd, window_pane_read_callback,
|
||||
NULL, window_pane_error_callback, wp);
|
||||
+ if (wp->event == NULL)
|
||||
+ fatalx("out of memory");
|
||||
wp->ictx = input_init(wp, wp->event, &wp->palette);
|
||||
|
||||
bufferevent_enable(wp->event, EV_READ|EV_WRITE);
|
40
tmux-socket-path.patch
Normal file
40
tmux-socket-path.patch
Normal file
@ -0,0 +1,40 @@
|
||||
--- tmux-3.3/tmux.c 2022-05-14 21:04:35.000000000 +0200
|
||||
+++ tmux-3.3/tmux.c 2022-06-04 09:08:04.005234096 +0200
|
||||
@@ -198,16 +198,16 @@
|
||||
|
||||
expand_paths(TMUX_SOCK, &paths, &n, 1);
|
||||
if (n == 0) {
|
||||
- xasprintf(cause, "no suitable socket path");
|
||||
- return (NULL);
|
||||
+ /* SUSE specific hack - remain compatible with previously used socket path */
|
||||
+ xasprintf(&base, "/run/tmux/%ld", (long)uid);
|
||||
+ } else {
|
||||
+ path = paths[0]; /* can only have one socket! */
|
||||
+ for (i = 1; i < n; i++)
|
||||
+ free(paths[i]);
|
||||
+ free(paths);
|
||||
+ xasprintf(&base, "%s/tmux-%ld", path, (long)uid);
|
||||
+ free(path);
|
||||
}
|
||||
- path = paths[0]; /* can only have one socket! */
|
||||
- for (i = 1; i < n; i++)
|
||||
- free(paths[i]);
|
||||
- free(paths);
|
||||
-
|
||||
- xasprintf(&base, "%s/tmux-%ld", path, (long)uid);
|
||||
- free(path);
|
||||
if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) {
|
||||
xasprintf(cause, "couldn't create directory %s (%s)", base,
|
||||
strerror(errno));
|
||||
--- tmux-3.3/tmux.h 2022-05-14 21:04:35.000000000 +0200
|
||||
+++ tmux-3.3/tmux.h 2022-06-04 09:04:55.829136130 +0200
|
||||
@@ -74,7 +74,7 @@
|
||||
#define TMUX_CONF "/etc/tmux.conf:~/.tmux.conf"
|
||||
#endif
|
||||
#ifndef TMUX_SOCK
|
||||
-#define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP
|
||||
+#define TMUX_SOCK "$TMUX_TMPDIR:"
|
||||
#endif
|
||||
#ifndef TMUX_TERM
|
||||
#define TMUX_TERM "screen"
|
||||
Nur in b/tmux-3.3: tmux.h.orig.
|
1249
tmux.changes
Normal file
1249
tmux.changes
Normal file
File diff suppressed because it is too large
Load Diff
86
tmux.spec
Normal file
86
tmux.spec
Normal file
@ -0,0 +1,86 @@
|
||||
#
|
||||
# spec file for package tmux
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: tmux
|
||||
Version: 3.3a
|
||||
Release: 0
|
||||
Summary: Terminal multiplexer
|
||||
License: ISC AND BSD-3-Clause AND BSD-2-Clause
|
||||
Group: System/Console
|
||||
URL: https://tmux.github.io/
|
||||
Source0: https://github.com/tmux/tmux/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: bash_completion_tmux.sh
|
||||
# PATCH-FIX-OPENSUSE crrodriguez@opensuse.org -- Use /run/tmux instead of /tmp as the default socket path, this add some robustness against accidental deletion via systemd-tmpfiles-clean, tmpwatch, or similar
|
||||
Patch0: tmux-socket-path.patch
|
||||
# CVE-2022-47016 [bsc#1207393], Null pointer dereference in window.c
|
||||
Patch1: tmux-CVE-2022-47016.patch
|
||||
# new ncurses secure interface fix
|
||||
Patch2: ncurses.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: utempter-devel
|
||||
BuildRequires: pkgconfig(libsystemd)
|
||||
BuildRequires: pkgconfig(libevent) >= 2.0
|
||||
BuildRequires: pkgconfig(ncurses)
|
||||
%{?systemd_ordering}
|
||||
|
||||
%description
|
||||
tmux is a terminal multiplexer: it enables a number of terminals (or windows),
|
||||
each running a separate program, to be created, accessed, and controlled from a
|
||||
single screen. tmux may be detached from a screen and continue running in the
|
||||
background, then later reattached. tmux is intended to be a modern,
|
||||
BSD-licensed alternative to programs such as GNU screen.
|
||||
|
||||
tmux uses a client-server model. The server holds multiple sessions and each
|
||||
window is a independent entity which may be freely linked to multiple sessions,
|
||||
moved between sessions and otherwise manipulated. Each session may be attached
|
||||
to (display and accept keyboard input from) multiple clients.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
||||
autoreconf
|
||||
%configure --disable-utf8proc --with-TERM=screen-256color --enable-systemd
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
# bash completion
|
||||
install -d -m 0755 %{buildroot}%{_datadir}/bash-completion/completions/
|
||||
install -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/bash-completion/completions/tmux
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_tmpfilesdir}
|
||||
echo "d /run/tmux 1777 root root -" > %{buildroot}%{_tmpfilesdir}/tmux.conf
|
||||
|
||||
%post
|
||||
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc CHANGES
|
||||
%{_datadir}/bash-completion/completions/tmux
|
||||
%{_bindir}/%{name}
|
||||
%{_mandir}/man1/%{name}.1%{?ext_man}
|
||||
%{_tmpfilesdir}/%{name}.conf
|
||||
%ghost /run/tmux
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user