From 905ebc855c32c1186df9a26a0abac6a500d1203d Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sun, 22 Jan 2023 15:24:33 +0100 Subject: x11/xterm: update to 375 --- x11/xterm/Makefile | 2 +- x11/xterm/distinfo | 4 +- x11/xterm/patches/patch-charproc_c | 27 +++-- x11/xterm/patches/patch-main_c | 213 +++++++++++++++++++++++-------------- x11/xterm/patches/patch-menu_c | 36 ++----- x11/xterm/patches/patch-misc_c | 7 +- x11/xterm/patches/patch-trace_c | 8 +- x11/xterm/patches/patch-util_c | 2 +- x11/xterm/patches/patch-version_h | 2 +- x11/xterm/patches/patch-xterm_man | 19 +++- 10 files changed, 188 insertions(+), 132 deletions(-) (limited to 'x11') diff --git a/x11/xterm/Makefile b/x11/xterm/Makefile index f0ded03..a0afed1 100644 --- a/x11/xterm/Makefile +++ b/x11/xterm/Makefile @@ -1,5 +1,5 @@ COMMENT = terminal emulator for the X Window System. -DISTNAME = xterm-372 +DISTNAME = xterm-375 CATEGORIES = x11 diff --git a/x11/xterm/distinfo b/x11/xterm/distinfo index 230a8fd..4d7630f 100644 --- a/x11/xterm/distinfo +++ b/x11/xterm/distinfo @@ -1,2 +1,2 @@ -SHA256 (xterm-372.tgz) = xtCBJ8skCcOgS8rlWbcCUZbtdwu3vyZjCry0XZX2CrE= -SIZE (xterm-372.tgz) = 1507107 +SHA256 (xterm-375.tgz) = MCxZor+B55xqcBUl13gWGiGNEjnyFWjYnivdMcAVIX8= +SIZE (xterm-375.tgz) = 1518304 diff --git a/x11/xterm/patches/patch-charproc_c b/x11/xterm/patches/patch-charproc_c index d1bd3be..d948210 100644 --- a/x11/xterm/patches/patch-charproc_c +++ b/x11/xterm/patches/patch-charproc_c @@ -1,16 +1,12 @@ +$OpenBSD$ + +Disable fontops completely +BlinkCuror fix + Index: charproc.c --- charproc.c.orig +++ charproc.c -@@ -363,7 +363,7 @@ static XtActionsRec actionsList[] = { - { "meta-sends-escape", HandleMetaEsc }, - { "set-num-lock", HandleNumLock }, - #endif --#ifdef OPT_PRINT_ON_EXIT -+#if OPT_PRINT_ON_EXIT - { "print-immediate", HandlePrintImmediate }, - { "print-on-error", HandlePrintOnError }, - #endif -@@ -578,7 +578,7 @@ static XtResource xterm_resources[] = +@@ -580,7 +580,7 @@ static XtResource xterm_resources[] = #if OPT_BLINK_CURS Bres(XtNcursorBlinkXOR, XtCCursorBlinkXOR, screen.cursor_blink_xor, True), @@ -19,7 +15,16 @@ Index: charproc.c #endif Bres(XtNcursorUnderLine, XtCCursorUnderLine, screen.cursor_underline, False), -@@ -13158,7 +13158,7 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved) +@@ -10151,7 +10151,7 @@ VTInitialize(Widget wrequest, + screen->allowPasteControls = screen->allowPasteControl0; + screen->allowSendEvents = screen->allowSendEvent0; + screen->allowColorOps = screen->allowColorOp0; +- screen->allowFontOps = screen->allowFontOp0; ++ screen->allowFontOps = False; + screen->allowMouseOps = screen->allowMouseOp0; + screen->allowTcapOps = screen->allowTcapOp0; + screen->allowTitleOps = screen->allowTitleOp0; +@@ -13213,7 +13213,7 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved) InitCursorShape(screen, screen); xtermSetCursorBox(screen); #if OPT_BLINK_CURS diff --git a/x11/xterm/patches/patch-main_c b/x11/xterm/patches/patch-main_c index 5e900ae..dbbcee3 100644 --- a/x11/xterm/patches/patch-main_c +++ b/x11/xterm/patches/patch-main_c @@ -3,98 +3,153 @@ Add pledge() and unveil() Index: main.c --- main.c.orig +++ main.c -@@ -2901,6 +2901,94 @@ main(int argc, char *argv[]ENVP_ARG) +@@ -306,7 +306,7 @@ ttyslot(void) + #include /* for NOFILE */ + #endif + +-#if defined(BSD) && (BSD >= 199103) ++#if defined(BSD) && (BSD >= 199103) && !defined(__OpenBSD__) + #define WTMP + #endif + +@@ -397,6 +397,7 @@ extern struct utmp *getutid __((struct utmp * _Id)); + #define UTMP_FILENAME UTMP_FILE + #elif defined(_PATH_UTMP) + #define UTMP_FILENAME _PATH_UTMP ++int utmp_fd = -1; + #else + #define UTMP_FILENAME "/etc/utmp" + #endif +@@ -2784,6 +2785,13 @@ main(int argc, char *argv[]ENVP_ARG) + + spawnXTerm(term, line_speed); + ++ /* xterm (parent) grabs a fd for the utmp file now, while it ++ * has egid = "utmp". Then discard the egid. */ ++ setEffectiveGroup(save_egid); ++ utmp_fd = open(etc_utmp, O_WRONLY | O_CLOEXEC); ++ setresgid(save_rgid, save_rgid, save_rgid); ++ save_egid = -1; ++ + #ifndef VMS + /* Child process is out there, let's catch its termination */ + +@@ -2901,6 +2909,89 @@ main(int argc, char *argv[]ENVP_ARG) if (resource.maximized) RequestMaximize(term, True); #endif + + { -+ String data = NULL; -+ getKeymapResources(SHELL_OF(term), "vt100", "VT100", XtRString, &data, sizeof(data)); -+ if (data && -+ (strstr(data, "exec-formatted") || strstr(data, "exec-selectable"))) { ++#if OPT_EXEC_SELECTION ++ String data = NULL; ++ getKeymapResources(SHELL_OF(term), "vt100", "VT100", XtRString, &data, sizeof(data)); ++ if (data && ++ (strstr(data, "exec-formatted") || strstr(data, "exec-selectable"))) { + -+ if (pledge("stdio rpath wpath id proc exec tty", NULL) == -1) { -+ xtermWarning("pledge\n"); -+ exit(1); -+ } -+ } else { -+ char *env; -+ if ((env = getenv("HOME"))) { -+ char homefile[PATH_MAX]; ++ if (pledge("stdio rpath wpath id proc exec tty", NULL) == -1) { ++ xtermWarning("pledge\n"); ++ exit(1); ++ } ++ } else ++#endif /* OPT_EXEC_SELECTION */ ++ { ++ char *env; + -+ snprintf(homefile, sizeof homefile, "%s/.fonts", env); -+ if (unveil(homefile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ snprintf(homefile, sizeof homefile, "%s/.cache/fontconfig", -+ env); -+ if (unveil(homefile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ snprintf(homefile, sizeof homefile, "%s/.icons", env); -+ if (unveil(homefile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ } -+ if ((env = getenv("XDG_CONFIG_HOME"))) { -+ char xdgfile[PATH_MAX]; ++ if ((env = getenv("HOME"))) { ++ char homefile[PATH_MAX]; ++ if (snprintf(homefile, sizeof homefile, "%s/.fonts", ++ env) <= sizeof(homefile)) ++ if (unveil(homefile, "r") == -1) ++ xtermPerror("unveil %s", homefile); ++ if (snprintf(homefile, sizeof homefile, "%s/.cache/fontconfig", ++ env) <= sizeof(homefile)) ++ if (unveil(homefile, "r") == 1) ++ xtermPerror("unveil %s", homefile); ++ if (snprintf(homefile, sizeof homefile, "%s/.icons", ++ env) <= sizeof(homefile)) ++ if (unveil(homefile, "r") == -1) ++ xtermPerror("unveil %s", homefile); ++ } ++ if ((env = getenv("XDG_CONFIG_HOME"))) { ++ char xdgfile[PATH_MAX]; + -+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env); -+ if (unveil(xdgfile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ snprintf(xdgfile, sizeof xdgfile, "%s/icons", env); -+ if (unveil(xdgfile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ } -+ if ((env = getenv("XDG_DATA_HOME"))) { -+ char xdgfile[PATH_MAX]; ++ if (snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", ++ env) <= sizeof(xdgfile)) ++ if (unveil(xdgfile, "r") == -1) ++ xtermPerror("unveil %s", xdgfile); ++ if (snprintf(xdgfile, sizeof xdgfile, "%s/icons", ++ env) <= sizeof(xdgfile)) ++ if (unveil(xdgfile, "r") == -1) ++ xtermPerror("unveil %s", xdgfile); ++ } ++ if ((env = getenv("XDG_DATA_HOME"))) { ++ char xdgfile[PATH_MAX]; + -+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env); -+ if (unveil(xdgfile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ snprintf(xdgfile, sizeof xdgfile, "%s/icons", env); -+ if (unveil(xdgfile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ } -+ if ((env = getenv("XDG_CACHE_HOME"))) { -+ char xdgfile[PATH_MAX]; ++ if (snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", ++ env) <= sizeof(xdgfile)) ++ if (unveil(xdgfile, "r") == -1) ++ xtermPerror("unveil %s", xdgfile); ++ if (snprintf(xdgfile, sizeof xdgfile, "%s/icons", ++ env) <= sizeof(xdgfile)) ++ if (unveil(xdgfile, "r") == -1) ++ xtermPerror("unveil %s", xdgfile); ++ } ++ if ((env = getenv("XDG_CACHE_HOME"))) { ++ char xdgfile[PATH_MAX]; + -+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env); -+ if (unveil(xdgfile, "r") == -1) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } -+ } -+ if ((unveil("/usr/X11R6", "r") == -1) || -+ (unveil("/usr/local/share/fonts", "r") == -1) || -+ (unveil("/var/cache/fontconfig", "r") == -1) || -+ (unveil("/usr/local/share/icons", "r") == -1) || -+ (unveil("/usr/local/lib/X11/icons", "r") == -1) || -+ (unveil(etc_utmp, "w") == -1) || -+ (unveil(etc_wtmp, "w") == -1)) { -+ xtermWarning("unveil\n"); -+ exit(1); -+ } ++ if (snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", ++ env) <= sizeof(xdgfile)) ++ if (unveil(xdgfile, "r") == -1) ++ xtermPerror("unveil %s", xdgfile); ++ } + -+ if (pledge("stdio rpath wpath id proc tty", NULL) == -1) { -+ xtermWarning("pledge\n"); -+ exit(1); -+ } -+ } ++ if (unveil("/usr/X11R6", "r") == -1) ++ xtermPerror("unveil /usr/X11R6"); ++ if (unveil("/usr/local/share/fonts", "r") == -1) ++ xtermPerror("unveil /usr/local/share/fonts"); ++ if (unveil("/var/cache/fontconfig", "r") == -1) ++ xtermPerror("unveil /var/cache/fontconfig"); ++ if (unveil("/usr/local/share/icons", "r") == -1) ++ xtermPerror("unveil /usr/local/share/icons"); ++ if (unveil("/usr/local/lib/X11/icons", "r") == -1) ++ xtermPerror("unveil /usr/local/lib/X11/icons"); ++ ++ if (pledge("stdio rpath proc tty", NULL) == -1) { ++ xtermWarning("pledge\n"); ++ exit(1); ++ } ++ } + } + for (;;) { #if OPT_TEK4014 if (TEK4014_ACTIVE(term)) +@@ -5447,10 +5538,12 @@ Exit(int n) + if (!resource.utmpInhibit && added_utmp_entry && + (am_slave < 0 && tslot > 0)) { + #if defined(USE_UTMP_SETGID) +- setEffectiveGroup(save_egid); +- TRACE_IDS; ++ if (save_egid != -1) { ++ setEffectiveGroup(save_egid); ++ TRACE_IDS; ++ } + #endif +- if ((wfd = open(etc_utmp, O_WRONLY)) >= 0) { ++ if ((wfd = utmp_fd) != -1 || (wfd = open(etc_utmp, O_WRONLY)) >= 0) { + memset(&utmp, 0, sizeof(utmp)); + lseek(wfd, (long) (tslot * sizeof(utmp)), 0); + IGNORE_RC(write(wfd, (char *) &utmp, sizeof(utmp))); +@@ -5468,8 +5561,10 @@ Exit(int n) + } + #endif /* WTMP */ + #ifdef USE_UTMP_SETGID +- disableSetGid(); +- TRACE_IDS; ++ if (save_egid != -1) { ++ disableSetGid(); ++ TRACE_IDS; ++ } + #endif + } + #endif /* USE_SYSV_UTMP */ diff --git a/x11/xterm/patches/patch-menu_c b/x11/xterm/patches/patch-menu_c index db80333..58fdfa5 100644 --- a/x11/xterm/patches/patch-menu_c +++ b/x11/xterm/patches/patch-menu_c @@ -4,33 +4,6 @@ Index: menu.c --- menu.c.orig +++ menu.c -@@ -312,7 +312,7 @@ MenuEntry mainMenuEntries[] = { - #ifdef ALLOWLOGGING - { "logging", do_logging, NULL }, - #endif --#ifdef OPT_PRINT_ON_EXIT -+#if OPT_PRINT_ON_EXIT - { "print-immediate", do_write_now, NULL }, - { "print-on-error", do_write_error, NULL }, - #endif -@@ -811,7 +811,7 @@ domenu(Widget w, - update_meta_esc(); - update_delete_del(); - update_keyboard_type(); --#ifdef OPT_PRINT_ON_EXIT -+#if OPT_PRINT_ON_EXIT - screen->write_error = !IsEmpty(resource.printFileOnXError); - SetItemSensitivity(mainMenuEntries[mainMenu_write_now].widget, True); - SetItemSensitivity(mainMenuEntries[mainMenu_write_error].widget, screen->write_error); -@@ -1144,7 +1144,7 @@ do_logging(Widget gw GCC_UNUSED, - } - #endif - --#ifdef OPT_PRINT_ON_EXIT -+#if OPT_PRINT_ON_EXIT - static void - do_write_now(Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, @@ -3722,11 +3722,13 @@ update_cursorblink(void) check == cbNever) { SetItemSensitivity(vtMenuEntries[vtMenu_cursorblink].widget, False); @@ -45,3 +18,12 @@ Index: menu.c } #endif +@@ -3900,7 +3902,7 @@ update_menu_allowBoldFonts(void) + static void + enable_allow_xxx_ops(Bool enable) + { +- SetItemSensitivity(fontMenuEntries[fontMenu_allowFontOps].widget, enable); ++ SetItemSensitivity(fontMenuEntries[fontMenu_allowFontOps].widget, False); + SetItemSensitivity(fontMenuEntries[fontMenu_allowMouseOps].widget, enable); + SetItemSensitivity(fontMenuEntries[fontMenu_allowTcapOps].widget, enable); + SetItemSensitivity(fontMenuEntries[fontMenu_allowTitleOps].widget, enable); diff --git a/x11/xterm/patches/patch-misc_c b/x11/xterm/patches/patch-misc_c index 0671d64..93309e8 100644 --- a/x11/xterm/patches/patch-misc_c +++ b/x11/xterm/patches/patch-misc_c @@ -1,15 +1,14 @@ - ten Xs for mkstemp template Index: misc.c --- misc.c.orig +++ misc.c -@@ -743,7 +743,7 @@ void +@@ -749,7 +749,7 @@ void init_colored_cursor(Display *dpy) { static const char theme[] = "index.theme"; -- static const char pattern[] = "xtermXXXXXX"; -+ static const char pattern[] = "xtermXXXXXXXX"; +- static const char pattern[] = "xtermXXXXXXXX"; ++ static const char pattern[] = "xtermXXXXXXXXXX"; char *env = getenv("XCURSOR_THEME"); xterm_cursor_theme = 0; diff --git a/x11/xterm/patches/patch-trace_c b/x11/xterm/patches/patch-trace_c index 06a4eb5..a5a3fa1 100644 --- a/x11/xterm/patches/patch-trace_c +++ b/x11/xterm/patches/patch-trace_c @@ -3,19 +3,19 @@ Fix build of TRACE option when TEK4014 mode is disabled Index: trace.c --- trace.c.orig +++ trace.c -@@ -504,6 +504,7 @@ visibleSelectionTarget(Display *d, Atom a) +@@ -484,6 +484,7 @@ visibleNotifyDetail(int code) return result; } +#if OPT_TEK4014 const char * - visibleTekparse(int code) + visibleSelectionTarget(Display *d, Atom a) { -@@ -523,6 +524,7 @@ visibleTekparse(int code) +@@ -545,6 +546,7 @@ visibleVTparse(int code) } return result; } +#endif const char * - visibleVTparse(int code) + visibleXError(int code) diff --git a/x11/xterm/patches/patch-util_c b/x11/xterm/patches/patch-util_c index 7c12810..0a87e1f 100644 --- a/x11/xterm/patches/patch-util_c +++ b/x11/xterm/patches/patch-util_c @@ -6,7 +6,7 @@ The final form of the diff follows a suggestion from tedu@. Index: util.c --- util.c.orig +++ util.c -@@ -5340,6 +5340,10 @@ systemWcwidthOk(int samplesize, int samplepass) +@@ -5447,6 +5447,10 @@ systemWcwidthOk(int samplesize, int samplepass) wchar_t n; int oops = 0; diff --git a/x11/xterm/patches/patch-version_h b/x11/xterm/patches/patch-version_h index 9113fa4..3eabacf 100644 --- a/x11/xterm/patches/patch-version_h +++ b/x11/xterm/patches/patch-version_h @@ -4,7 +4,7 @@ Index: version.h --- version.h.orig +++ version.h @@ -42,7 +42,7 @@ - #define XTERM_DATE 2022-03-09 + #define XTERM_DATE 2022-10-23 #ifndef __vendorversion__ -#define __vendorversion__ "XTerm" diff --git a/x11/xterm/patches/patch-xterm_man b/x11/xterm/patches/patch-xterm_man index 6f2e6c0..c0649ae 100644 --- a/x11/xterm/patches/patch-xterm_man +++ b/x11/xterm/patches/patch-xterm_man @@ -3,7 +3,16 @@ Document OpenBSD specifics Index: xterm.man --- xterm.man.orig +++ xterm.man -@@ -4509,11 +4509,11 @@ or clicks one of its buttons. +@@ -2256,7 +2256,7 @@ The default is \*(``true\*(''. + .B "allowMouseOps\fP (class\fB AllowMouseOps\fP)" + Specifies whether control sequences that enable \fI\*n\fP to send + escape sequences to the host on mouse-clicks and movement. +-The default is \*(``true\*(''. ++The default is \*(``false\*(''. + .TP 8 + .B "allowPasteControls\fP (class\fB AllowPasteControls\fP)" + If true, allow control characters such as BEL and CAN to be pasted. +@@ -4524,11 +4524,11 @@ or clicks one of its buttons. .RS .TP 3 0 @@ -17,7 +26,7 @@ Index: xterm.man .TP 3 2 always. -@@ -8926,3 +8926,52 @@ Ross Combs, +@@ -8976,3 +8976,58 @@ Ross Combs, Stephen P.\& Wall, David Wexelblat, and Thomas Dickey (invisible\-island.net). @@ -27,6 +36,8 @@ Index: xterm.man +.TP 8 +.B allowFontOps: false +.TP 8 ++.B allowMouseOps: false ++.TP 8 +.B allowWindowOps: false +Various, potentially dangerous, extended window control sequences are disabled. +.TP 8 @@ -70,3 +81,7 @@ Index: xterm.man +capability as \fB^?\fP. +.PP +The u\*n and koi8r\*n shell scripts are not provided by OpenBSD. ++.PP ++The following functions are disabled on OpenBSD: ++\fBexec\-formatted()\fP, \fBexec\-selectable()\fP and ++\fBspawn\-new\-terminal()\fP. -- cgit v1.2.3