pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/x11/vte3



Module Name:    pkgsrc
Committed By:   gutteridge
Date:           Tue May 30 23:04:53 UTC 2023

Modified Files:
        pkgsrc/x11/vte3: Makefile distinfo
        pkgsrc/x11/vte3/patches: patch-src_pty.cc

Log Message:
vte3: improve patch to work around NetBSD posix_openpt(3) defect

Now that as of roughly 9.99.101 we have a posix_openpt(3) that applies
O_NONBLOCK and O_CLOEXEC, we don't need the fallback code. Now we
dynamically detect whether we need the fallback using the best
approximation we can (an assumption backed by a test case I recently
added). Tested on 9.3_STABLE, 10.0_BETA, and 10.99.4.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 pkgsrc/x11/vte3/Makefile
cvs rdiff -u -r1.22 -r1.23 pkgsrc/x11/vte3/distinfo
cvs rdiff -u -r1.9 -r1.10 pkgsrc/x11/vte3/patches/patch-src_pty.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/x11/vte3/Makefile
diff -u pkgsrc/x11/vte3/Makefile:1.62 pkgsrc/x11/vte3/Makefile:1.63
--- pkgsrc/x11/vte3/Makefile:1.62       Wed Apr 19 08:11:59 2023
+++ pkgsrc/x11/vte3/Makefile    Tue May 30 23:04:53 2023
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.62 2023/04/19 08:11:59 adam Exp $
+# $NetBSD: Makefile,v 1.63 2023/05/30 23:04:53 gutteridge Exp $
 
 DISTNAME=      vte-0.68.0
 PKGNAME=       ${DISTNAME:S/vte/vte3/}
-PKGREVISION=   12
+PKGREVISION=   13
 CATEGORIES=    x11
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=GNOME/}
 GITHUB_PROJECT=        vte

Index: pkgsrc/x11/vte3/distinfo
diff -u pkgsrc/x11/vte3/distinfo:1.22 pkgsrc/x11/vte3/distinfo:1.23
--- pkgsrc/x11/vte3/distinfo:1.22       Sun Sep  4 19:26:10 2022
+++ pkgsrc/x11/vte3/distinfo    Tue May 30 23:04:53 2023
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.22 2022/09/04 19:26:10 gutteridge Exp $
+$NetBSD: distinfo,v 1.23 2023/05/30 23:04:53 gutteridge Exp $
 
 BLAKE2s (vte-0.68.0.tar.gz) = 1583ddbed30f848687a1ce02df9d03ce89a5b905a72a9cd1d866195931acbcb1
 SHA512 (vte-0.68.0.tar.gz) = fb2260ae1363203cdccd0e0c6cafe29e5fb25947d2830a7ce1051f672fdc11c067791a8b74cb3017548e366976763fec2022e0c196ed501f46abb08876ad24d6
@@ -10,5 +10,5 @@ SHA1 (patch-src_dumpkeys.c) = 102f24d740
 SHA1 (patch-src_meson.build) = a8e159688fb36e4cfac40249e279a670c9c6cda8
 SHA1 (patch-src_mev.c) = b38dc42e02a8d5fa1e579349319f0b8c8b31dbce
 SHA1 (patch-src_missing.cc) = 807a3f6134d8dd6fd602326ce02ca6e2ed1d189d
-SHA1 (patch-src_pty.cc) = abd037769075f8ad9a7258f3bb970f3ed7e317cf
+SHA1 (patch-src_pty.cc) = a46b10e9921e6d6ea8fbf0939a73a7b4b83d3455
 SHA1 (patch-src_widget.cc) = cbc8b715b21248996bfb7c6abe355c5f4e510539

Index: pkgsrc/x11/vte3/patches/patch-src_pty.cc
diff -u pkgsrc/x11/vte3/patches/patch-src_pty.cc:1.9 pkgsrc/x11/vte3/patches/patch-src_pty.cc:1.10
--- pkgsrc/x11/vte3/patches/patch-src_pty.cc:1.9        Sun Sep  4 19:26:10 2022
+++ pkgsrc/x11/vte3/patches/patch-src_pty.cc    Tue May 30 23:04:53 2023
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_pty.cc,v 1.9 2022/09/04 19:26:10 gutteridge Exp $
+$NetBSD: patch-src_pty.cc,v 1.10 2023/05/30 23:04:53 gutteridge Exp $
 
 Use correct includes on SunOS.
 Functional fix of posix_openpt() on NetBSD.
@@ -6,7 +6,7 @@ https://gitlab.gnome.org/GNOME/vte/-/iss
 
 --- src/pty.cc.orig    2022-03-27 17:52:19.000000000 +0000
 +++ src/pty.cc
-@@ -62,7 +62,9 @@
+@@ -62,9 +62,15 @@
  #ifdef HAVE_PTY_H
  #include <pty.h>
  #endif
@@ -16,25 +16,46 @@ https://gitlab.gnome.org/GNOME/vte/-/iss
 +#include <sys/ptyvar.h>
  #include <stropts.h>
  #endif
++#ifdef __NetBSD__
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#endif
  #include <glib.h>
-@@ -426,7 +428,19 @@ _vte_pty_open_posix(void)
-         auto fd = vte::libc::FD{posix_openpt(O_RDWR | O_NOCTTY | O_NONBLOCK | O_CLOEXEC)};
+ #include <gio/gio.h>
+ #include "debug.h"
+@@ -427,6 +433,27 @@ _vte_pty_open_posix(void)
  #ifndef __linux__
          /* Other kernels may not support CLOEXEC or NONBLOCK above, so try to fall back */
--        bool need_cloexec = false, need_nonblocking = false;
+         bool need_cloexec = false, need_nonblocking = false;
++
 +#ifdef __NetBSD__
-+        /*
-+         * NetBSD's posix_openpt() will accept flags that don't actually get applied, so it
-+         * will return an FD with only O_RDWR actually set. Unlike other BSDs, it doesn't
-+         * return EINVAL when given inapplicable flags. We need to force the fallbacks below.
-+         */
-+        bool need_cloexec = true;
-+        bool need_nonblocking = true;
++         // NetBSD is a special case: prior to 9.99.101, posix_openpt() will not return
++         // EINVAL for unknown/unsupported flags but instead silently ignore these flags
++         // and just return a valid PTY but without the NONBLOCK | CLOEXEC flags set.
++         // So we need to manually apply these flags there. See issue #2575.
++        int mib[2], osrev;
++        size_t len;
++
++        mib[0] = CTL_KERN;
++        mib[1] = KERN_OSREV;
++        len = sizeof(osrev);
++        sysctl(mib, 2, &osrev, &len, NULL, 0);
++        if (osrev < 999010100) {
++                need_cloexec = need_nonblocking = true;
++                _vte_debug_print(VTE_DEBUG_PTY,
++                                 "NetBSD < 9.99.101, forcing fallback "
++                                 "for NONBLOCK and CLOEXEC.\n");
++        }
 +#else
-+        bool need_cloexec = false;
-+        bool need_nonblocking = false;
-+#endif /* __NetBSD__ */
 +
          if (!fd && errno == EINVAL) {
                  /* Try without NONBLOCK and apply the flag afterward */
                  need_nonblocking = true;
+@@ -437,6 +464,7 @@ _vte_pty_open_posix(void)
+                         fd = posix_openpt(O_RDWR | O_NOCTTY);
+                 }
+         }
++#endif /* __NetBSD__ */
+ #endif /* !linux */
+ 
+         if (!fd) {



Home | Main Index | Thread Index | Old Index