Source: vte2.91
Version: 0.50.2-4
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
Hi,
vte2.91 FTBFS on GNU/Hurd due to lack of support for posix_openpt, but
works fine with BSD openpty.
The attached patch
0001-Revert-pty-Remove-openpty-code-path.patch
reverts commit 0e08c0961ef6938c2b35564ce3543a02eb472e20
Revert "pty: Remove openpty code path"
The only glitch in the revert was a minor conflict in src/pty.cc, fixed
now.
This patch enables the build of mate-terminal and mate-
desktop-environment and mate-desktop-environment-core.
Thanks!
From 87cb3252ff23dbb5c9c5c545929afdeee68e7e5b Mon Sep 17 00:00:00 2001
From: Svante Signell <svante.sign...@gmail.com>
Date: Tue, 20 Feb 2018 10:21:23 +0100
Subject: [PATCH] Revert "pty: Remove openpty code path"
This reverts commit 0e08c0961ef6938c2b35564ce3543a02eb472e20.
GNU/Hurd does not yet have support for UNIX98_PTY
---
configure.ac | 15 +++++++++++++--
src/Makefile.am | 1 +
src/pty.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6014e34d..fb6372c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,8 +283,19 @@ AC_HEADER_TIOCGWINSZ
# Check for how to open a new PTY. We support posix_openpt and BSDs openpty
-AC_CHECK_FUNCS([posix_openpt grantpt unlockpt ptsname],[],
- [AC_MSG_ERROR([no support for Unix98 PTY found])])
+LIBUTIL=
+AC_CHECK_FUNCS([posix_openpt grantpt unlockpt ptsname],[],[
+ # Try BSD
+ AC_SEARCH_LIBS([openpty],[util],[have_openpty=yes],
+ [AC_MSG_ERROR([have neither UNIX98 PTY nor BSD openpty])])
+
+ if test "$ac_cv_search_openpty" != "none required"; then
+ LIBUTIL="$ac_cv_search_openpty"
+ fi
+ AC_DEFINE(HAVE_OPENPTY,1,[Define if you have the openpty function.])
+])
+
+AC_SUBST([LIBUTIL])
# Misc PTY handling functions
AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid tcgetattr tcsetattr])
diff --git a/src/Makefile.am b/src/Makefile.am
index e26d9e5e..4e1604e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,6 +130,7 @@ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_LDFLAGS = \
$(AM_LDFLAGS)
libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_LIBADD = \
+ $(LIBUTIL) \
$(VTE_LIBS)
# Generated sources
diff --git a/src/pty.cc b/src/pty.cc
index aa03c5a5..c1d78aec 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -74,6 +74,10 @@
#define NSIG (8 * sizeof(sigset_t))
#endif
+#if defined(HAVE_POSIX_OPENPT) && defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT)
+#define HAVE_UNIX98_PTY
+#endif
+
#define VTE_VERSION_NUMERIC ((VTE_MAJOR_VERSION) * 10000 + (VTE_MINOR_VERSION) * 100 + (VTE_MICRO_VERSION))
#if !GLIB_CHECK_VERSION(2, 42, 0)
@@ -146,6 +150,8 @@ vte_pty_child_setup (VtePty *pty)
if (masterfd == -1)
_exit(127);
+#ifdef HAVE_UNIX98_PTY
+ /* Read the slave number and unlock it. */
if (grantpt(masterfd) != 0) {
_vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "grantpt");
_exit(127);
@@ -155,6 +161,7 @@ vte_pty_child_setup (VtePty *pty)
_vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "unlockpt");
_exit(127);
}
+#endif
char *name = ptsname(masterfd);
if (name == nullptr) {
@@ -615,6 +622,8 @@ fd_setup(int fd)
return 0;
}
+#if defined(HAVE_UNIX98_PTY)
+
/*
* _vte_pty_open_posix:
* @pty: a #VtePty
@@ -680,6 +689,38 @@ _vte_pty_open_posix(void)
return fd.steal();
}
+#elif defined(HAVE_OPENPTY)
+
+/*
+ * _vte_pty_open_bsd:
+ * @pty: a #VtePty
+ * @error: a location to store a #GError, or %NULL
+ *
+ * Opens new file descriptors to a new PTY master and slave.
+ *
+ * Returns: the new PTY's master FD, or -1
+ */
+static int
+_vte_pty_open_bsd(void)
+{
+ vte::util::smart_fd parentfd, childfd;
+ if (openpty(parentfd, childfd, NULL, NULL, NULL) != 0) {
+ vte::util::restore_errno errsv;
+ _vte_debug_print(VTE_DEBUG_PTY,
+ "%s failed: %s", "openpty", g_strerror(errsv));
+ return -1;
+ }
+
+ if (fd_setup(parentfd) < 0)
+ return -1;
+
+ return parentfd.steal();
+}
+
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif /* HAVE_UNIX98_PTY */
+
static int
_vte_pty_open_foreign(int masterfd /* consumed */)
{
@@ -789,7 +830,13 @@ vte_pty_initable_init (GInitable *initable,
if (priv->foreign) {
priv->pty_fd = _vte_pty_open_foreign(priv->pty_fd);
} else {
+#if defined(HAVE_UNIX98_PTY)
priv->pty_fd = _vte_pty_open_posix();
+#elif defined(HAVE_OPENPTY)
+ priv->pty_fd = _vte_pty_open_bsd();
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif
}
if (priv->pty_fd == -1) {
--
2.14.0