tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re-enabling cups option in gtk3
Hi all,
As far as I can tell, there were two reasons not to enable cups in gtk3.
- Darwin mysteriously has problems with our cups package (weird, because
cups is an apple thing)
- if CUPS is not running, trying to reach firefox's print dialog
(ctrl+P) would wedge.
I feel as though this patch addresses both concerns.
I haven't tested actual printing with the resulting setup, if someone
could check that it actually works it'd be nice.
----------
So, what CUPS is trying to do:
- use a non-blocking connect
- poll and check for POLL_ERR to see if the connect succeeded
This doesn't work right on NetBSD since it doesn't return POLL_ERR in
this case. It always looks like success (and later on, like the
connection dropped, so cups will attempt to reconnect on an infinite
loop).
As one of the options suggested in https://cr.yp.to/docs/connect.html
I've added a second check, to see if getpeername succeeds.
A check of both scenarios (cupsd running, cupsd not running) suggests it
behaves correctly, but it would be nice to have a check that CUPS
actually does the printing behaviour :-)
Index: x11/gtk3/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/x11/gtk3/Makefile,v
retrieving revision 1.146
diff -u -r1.146 Makefile
--- x11/gtk3/Makefile 12 Apr 2020 20:41:57 -0000 1.146
+++ x11/gtk3/Makefile 9 May 2020 09:16:59 -0000
@@ -2,6 +2,7 @@
DISTNAME= gtk+-3.24.18
PKGNAME= ${DISTNAME:S/gtk/gtk3/}
+PKGREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/gtk+/${PKGVERSION_NOREV:R}/}
EXTRACT_SUFX= .tar.xz
Index: x11/gtk3/options.mk
===================================================================
RCS file: /cvsroot/pkgsrc/x11/gtk3/options.mk,v
retrieving revision 1.19
diff -u -r1.19 options.mk
--- x11/gtk3/options.mk 5 Mar 2020 09:37:30 -0000 1.19
+++ x11/gtk3/options.mk 9 May 2020 09:16:59 -0000
@@ -10,6 +10,9 @@
.if ${PLATFORM_SUPPORTS_WAYLAND} == "yes"
PKG_SUGGESTED_OPTIONS+= wayland
.endif
+.if ${OPSYS} != "Darwin"
+PKG_SUGGESTED_OPTIONS+= cups
+.endif
PKG_SUGGESTED_OPTIONS+= gtk3-atk-bridge x11
.include "../../mk/bsd.options.mk"
Index: print/cups-base/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/print/cups-base/distinfo,v
retrieving revision 1.19
diff -u -r1.19 distinfo
--- print/cups-base/distinfo 2 May 2020 11:47:16 -0000 1.19
+++ print/cups-base/distinfo 9 May 2020 09:16:59 -0000
@@ -19,6 +19,7 @@
SHA1 (patch-config-scripts_cups-gssapi.m4) = ac2df3e82bc844630af8462a461c7efe1da4b354
SHA1 (patch-config-scripts_cups-libtool.m4) = a6139fbbbee7038d11654c0a2387af21f48b7412
SHA1 (patch-cups-tls.c) = f89c25f8089d9e11a983a270adbb2cbde3c22511
+SHA1 (patch-cups_http-addrlist.c) = 333ad16ef1a2ce60a19593dcb3de3f0a69184cfa
SHA1 (patch-cups_thread.c) = e625a2b81f3d831d2a0c02bc0fa9a9d31c1097a7
SHA1 (patch-doc-help-man-cups-files.conf.html) = c26754104788eb619e69e49d6d51bf84ab047876
SHA1 (patch-man-cups-files.conf.man.in) = 08c0322fd233c724b7df238df01988500130d1c6
Index: print/cups-base/patches/patch-cups_http-addrlist.c
===================================================================
RCS file: print/cups-base/patches/patch-cups_http-addrlist.c
diff -N print/cups-base/patches/patch-cups_http-addrlist.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ print/cups-base/patches/patch-cups_http-addrlist.c 9 May 2020 09:16:59 -0000
@@ -0,0 +1,50 @@
+$NetBSD$
+
+Double check that we're actually connected with getpeername.
+
+This code attempts to check if our non-blocking socket is connected
+by poll()ing it. NetBSD's implementation doesn't return POLL_ERR
+in this case, and we end up appearing as if we are connected.
+
+Reproduce:
+- Build gtk3 with cups support.
+- cupsd not running
+- start firefox, press ctrl+P to enter print dialog => wedge
+
+--- cups/http-addrlist.c.orig 2020-04-27 18:04:29.000000000 +0000
++++ cups/http-addrlist.c
+@@ -79,11 +79,11 @@ httpAddrConnect2(
+ struct timeval timeout; /* Timeout */
+ # endif /* HAVE_POLL */
+ #endif /* O_NONBLOCK */
+-#ifdef DEBUG
+-# ifndef _WIN32
++#ifndef _WIN32
+ socklen_t len; /* Length of value */
+ http_addr_t peer; /* Peer address */
+-# endif /* !_WIN32 */
++#endif /* !_WIN32 */
++#ifdef DEBUG
+ char temp[256]; /* Temporary address string */
+ #endif /* DEBUG */
+
+@@ -313,14 +313,14 @@ httpAddrConnect2(
+ if (FD_ISSET(fds[i], &input_set) && !FD_ISSET(fds[i], &error_set))
+ # endif /* HAVE_POLL */
+ {
++ len = sizeof(peer);
++ if (getpeername(fds[i], (struct sockaddr *)&peer, &len) != 0)
++ continue;
++
+ *sock = fds[i];
+ connaddr = addrs[i];
+
+-# ifdef DEBUG
+- len = sizeof(peer);
+- if (!getpeername(fds[i], (struct sockaddr *)&peer, &len))
+- DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
+-# endif /* DEBUG */
++ DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
+
+ break;
+ }
Home |
Main Index |
Thread Index |
Old Index