summaryrefslogtreecommitdiff
path: root/print
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2020-05-14 19:45:50 +0000
committerjoerg <joerg@pkgsrc.org>2020-05-14 19:45:50 +0000
commitfaceb5a123b33a5558e6c2c400fa113093669923 (patch)
tree021b8dd57aca9901f8e59cea703ac30cbcefcde7 /print
parente9961cf460bf36b724745c2951e7fc9716be5b29 (diff)
downloadpkgsrc-faceb5a123b33a5558e6c2c400fa113093669923.tar.gz
Fix bugs in the non-blocking connect handling so that the print dialog
in GTK can work even if the CUPS daemon is not running. Bump revision.
Diffstat (limited to 'print')
-rw-r--r--print/cups-base/Makefile3
-rw-r--r--print/cups-base/distinfo3
-rw-r--r--print/cups-base/patches/patch-cups_http-addrlist.c90
3 files changed, 94 insertions, 2 deletions
diff --git a/print/cups-base/Makefile b/print/cups-base/Makefile
index ba5d0a9ada3..bbdcc93cbdd 100644
--- a/print/cups-base/Makefile
+++ b/print/cups-base/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.32 2020/05/09 12:15:58 maya Exp $
+# $NetBSD: Makefile,v 1.33 2020/05/14 19:45:50 joerg Exp $
.include "../../print/cups/Makefile.common"
DISTNAME= cups-${CUPS_VERS}-source
PKGNAME= cups-base-${CUPS_VERS}
+PKGREVISION= 1
CATEGORIES= print
MASTER_SITES= ${MASTER_SITE_GITHUB:=apple/}
diff --git a/print/cups-base/distinfo b/print/cups-base/distinfo
index a509103af25..c0cd2a24153 100644
--- a/print/cups-base/distinfo
+++ b/print/cups-base/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.19 2020/05/02 11:47:16 leot Exp $
+$NetBSD: distinfo,v 1.20 2020/05/14 19:45:50 joerg Exp $
SHA1 (cups-2.3.3-source.tar.gz) = 7a01c9fba5d784eb61eda03fd40e513fd2a1b5b8
RMD160 (cups-2.3.3-source.tar.gz) = e08afd09666e79d0416f46e14fb8c6b0a6beebd7
@@ -19,6 +19,7 @@ SHA1 (patch-config-scripts_cups-directories.m4) = 8a6c2f962dafdde20f913fac2e172a
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) = aa2524ee1c11450cfa3a46b1aa34c12417322241
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
diff --git a/print/cups-base/patches/patch-cups_http-addrlist.c b/print/cups-base/patches/patch-cups_http-addrlist.c
new file mode 100644
index 00000000000..f7c14199ea8
--- /dev/null
+++ b/print/cups-base/patches/patch-cups_http-addrlist.c
@@ -0,0 +1,90 @@
+$NetBSD: patch-cups_http-addrlist.c,v 1.1 2020/05/14 19:45:50 joerg Exp $
+
+Checkout for non-blocking connect is difficult as systems can't agree on
+whether it is a write condition or an error. Check for both with
+poll/select and if either flag is set, use getpeername to determine if
+the socket was really connected. If it wasn't, drop it correctly from the
+poll event list as well as to not check stale event masks.
+
+--- cups/http-addrlist.c.orig 2020-05-09 14:07:20.638266583 +0000
++++ cups/http-addrlist.c
+@@ -73,8 +73,7 @@ httpAddrConnect2(
+ # ifdef HAVE_POLL
+ struct pollfd pfds[100]; /* Polled file descriptors */
+ # else
+- fd_set input_set, /* select() input set */
+- output_set, /* select() output set */
++ fd_set output_set, /* select() output set */
+ error_set; /* select() error set */
+ struct timeval timeout; /* Timeout */
+ # endif /* HAVE_POLL */
+@@ -280,16 +279,15 @@ httpAddrConnect2(
+ DEBUG_printf(("1httpAddrConnect2: poll() returned %d (%d)", result, errno));
+
+ # else
+- FD_ZERO(&input_set);
++ FD_ZERO(&output_set);
+ for (i = 0; i < nfds; i ++)
+- FD_SET(fds[i], &input_set);
+- output_set = input_set;
+- error_set = input_set;
++ FD_SET(fds[i], &output_set);
++ error_set = output_set;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = (addrlist ? 100 : remaining > 250 ? 250 : remaining) * 1000;
+
+- result = select(max_fd + 1, &input_set, &output_set, &error_set, &timeout);
++ result = select(max_fd + 1, NULL, &output_set, &error_set, &timeout);
+
+ DEBUG_printf(("1httpAddrConnect2: select() returned %d (%d)", result, errno));
+ # endif /* HAVE_POLL */
+@@ -308,38 +306,25 @@ httpAddrConnect2(
+ {
+ # ifdef HAVE_POLL
+ DEBUG_printf(("pfds[%d].revents=%x\n", i, pfds[i].revents));
+- if (pfds[i].revents && !(pfds[i].revents & (POLLERR | POLLHUP)))
++ if (pfds[i].revents)
+ # else
+- if (FD_ISSET(fds[i], &input_set) && !FD_ISSET(fds[i], &error_set))
++ if (FD_ISSET(fds[i], &output_set) || FD_ISSET(fds[i], &error_set))
+ # endif /* HAVE_POLL */
+ {
+- *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 */
+-
+- break;
+- }
+-# ifdef HAVE_POLL
+- else if (pfds[i].revents & (POLLERR | POLLHUP))
+-# else
+- else if (FD_ISSET(fds[i], &error_set))
+-# endif /* HAVE_POLL */
+- {
+- /*
+- * Error on socket, remove from the "pool"...
+- */
+-
++ if (getpeername(fds[i], NULL, 0) == 0) {
++ *sock = fds[i];
++ connaddr = addrs[i];
++ break;
++ }
+ httpAddrClose(NULL, fds[i]);
+ nfds --;
+ if (i < nfds)
+ {
+ memmove(fds + i, fds + i + 1, (size_t)(nfds - i) * (sizeof(fds[0])));
+ memmove(addrs + i, addrs + i + 1, (size_t)(nfds - i) * (sizeof(addrs[0])));
++# ifdef HAVE_POLL
++ memmove(pfds + i, pfds + i + 1, (size_t)(nfds - i) * (sizeof(pfds[0])));
++# endif /* HAVE_POLL */
+ }
+ i --;
+ }