Attaching a patch that follows these suggestions.
My ports tree is a checkout of the https://github.com/openbsd/ports
mirror, so I've used git format-patch to create the patch. I'm a porting
beginner so please let me know if there's a better way to send patches.
On 3/21/21 8:00 AM, Klemens Nanni wrote:
On Sat, Mar 20, 2021 at 09:13:24PM -0700, Greg Steuck wrote:
A bigger question is if something else should be done. Memory safety is
an obvious problem to worry about especially in the context where the
selection may not be fully trusted. So, should we pick up a few more
patches from upstream: https://github.com/kfish/xsel/commits/master ?
Trouble is they have a multiple-year old issue pending to roll a release
with no activity beyond people asking for status:
https://github.com/kfish/xsel/issues/28
You could package a specific commit and use xsel-1.2.0.20210321 as date
or so, that'll give you the latest and greatest fixes outside a release
and will play nicely with the next proper update to 1.3.x or so, i.e.
the upgrade will just work.
That also avoids having local patches, which is nice.
Generally, tracking upstream releases makes sense, but if they can't be
arsed to roll another tarball due to whatever reasons, I do tend to just
track HEAD and ship important bug fixes to our users nonetheless.
>From 7ca665a9872e0dc6bd97673f0c71ac098ef034fe Mon Sep 17 00:00:00 2001
From: Brennan Vincent <bren...@umanwizard.com>
Date: Sun, 21 Mar 2021 10:57:51 -0400
Subject: [PATCH] Update to latest commit from Github to fix various bugs.
Remove patches which are no longer necessary.
---
x11/xsel/Makefile | 14 ++++++---
x11/xsel/distinfo | 4 +--
x11/xsel/patches/patch-configure | 15 ---------
x11/xsel/patches/patch-xsel_c | 52 --------------------------------
4 files changed, 12 insertions(+), 73 deletions(-)
delete mode 100644 x11/xsel/patches/patch-configure
delete mode 100644 x11/xsel/patches/patch-xsel_c
diff --git a/x11/xsel/Makefile b/x11/xsel/Makefile
index f68ff697609..d4337c7f3a5 100644
--- a/x11/xsel/Makefile
+++ b/x11/xsel/Makefile
@@ -2,20 +2,26 @@
COMMENT= command-line program for managing X selection contents
-DISTNAME= xsel-1.2.0
-REVISION= 2
+V= 1.2.0.20210321
+DISTNAME= xsel-${V}
CATEGORIES= x11
HOMEPAGE= http://www.vergenet.net/~conrad/software/xsel/
+GH_ACCOUNT= kfish
+GH_PROJECT= xsel
+GH_COMMIT= 062e6d373537c60829fa9b5dcddbcd942986b3c3
+
# BSD-style
PERMIT_PACKAGE= Yes
WANTLIB= X11 c
-MASTER_SITES= http://www.vergenet.net/~conrad/software/xsel/download/
SEPARATE_BUILD= Yes
-CONFIGURE_STYLE=gnu
+CONFIGURE_STYLE=autoreconf
CONFIGURE_ENV= LDFLAGS="-L${X11BASE}/lib"
+AUTOCONF_VERSION = 2.69
+AUTOMAKE_VERSION = 1.16
+
.include <bsd.port.mk>
diff --git a/x11/xsel/distinfo b/x11/xsel/distinfo
index 9001d2654cc..f1a64622615 100644
--- a/x11/xsel/distinfo
+++ b/x11/xsel/distinfo
@@ -1,2 +1,2 @@
-SHA256 (xsel-1.2.0.tar.gz) = uSfOCNyC9MMBQCI5WbkM9l4QdvAAzpXlIEGewy9bFBw=
-SIZE (xsel-1.2.0.tar.gz) = 169155
+SHA256 (xsel-1.2.0.20210321-062e6d37.tar.gz) = /bbOutWP4waggDGs54epLE9Oi3W4Nt0zlY0UCmZrH5E=
+SIZE (xsel-1.2.0.20210321-062e6d37.tar.gz) = 51364
diff --git a/x11/xsel/patches/patch-configure b/x11/xsel/patches/patch-configure
deleted file mode 100644
index 7ee76777a43..00000000000
--- a/x11/xsel/patches/patch-configure
+++ /dev/null
@@ -1,15 +0,0 @@
-$OpenBSD: patch-configure,v 1.2 2014/07/07 08:22:52 sthen Exp $
-
--Wdeclaration-after-statement is gcc 4-only.
-
---- configure.orig Mon Mar 24 15:27:33 2008
-+++ configure Mon Jul 7 09:22:18 2014
-@@ -5880,7 +5880,7 @@ fi
-
- # Error out on compile warnings
- if test "x$ac_cv_c_compiler_gnu" = xyes ; then
-- CFLAGS="$CFLAGS -fno-strict-aliasing -Wall -Werror -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused"
-+ CFLAGS="$CFLAGS -fno-strict-aliasing -Wall -Werror -g -std=gnu99 -Wno-unused"
- fi
-
- # Checks for header files.
diff --git a/x11/xsel/patches/patch-xsel_c b/x11/xsel/patches/patch-xsel_c
deleted file mode 100644
index 0a6b2018bc6..00000000000
--- a/x11/xsel/patches/patch-xsel_c
+++ /dev/null
@@ -1,52 +0,0 @@
-$OpenBSD: patch-xsel_c,v 1.2 2014/07/07 08:25:16 sthen Exp $
-
-- Format "32" properties use "long", not "int", even on LP64 platforms.
-- ensure NUM_TARGETS does not exceed MAX_NUM_TARGETS.
-- plug a memory leak in handle_targets()
-
---- xsel.c.orig Mon Jun 30 00:10:19 2014
-+++ xsel.c Mon Jun 30 00:20:50 2014
-@@ -15,6 +15,7 @@
- #include "config.h"
- #endif
-
-+#include <assert.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
-@@ -1300,14 +1301,16 @@ handle_targets (Display * display, Window requestor, A
- Atom selection, Time time, MultTrack * mparent)
- {
- Atom * targets_cpy;
-+ HandleResult r;
-
- targets_cpy = malloc (sizeof (supported_targets));
- memcpy (targets_cpy, supported_targets, sizeof (supported_targets));
-
-- return
-- change_property (display, requestor, property, XA_ATOM, 32,
-+ r = change_property (display, requestor, property, XA_ATOM, 32,
- PropModeReplace, (unsigned char *)targets_cpy,
- NUM_TARGETS, selection, time, mparent);
-+ free(targets_cpy);
-+ return r;
- }
-
- /*
-@@ -2078,7 +2081,6 @@ main(int argc, char *argv[])
-
- /* Get the NULL atom */
- null_atom = XInternAtom (display, "NULL", False);
-- NUM_TARGETS++;
-
- /* Get the TEXT atom */
- text_atom = XInternAtom (display, "TEXT", False);
-@@ -2096,6 +2098,8 @@ main(int argc, char *argv[])
-
- supported_targets[s++] = XA_STRING;
- NUM_TARGETS++;
-+
-+ assert(NUM_TARGETS <= MAX_NUM_TARGETS);
-
- /* Get the COMPOUND_TEXT atom.
- * NB. We do not currently serve COMPOUND_TEXT; we can retrieve it but
--
2.31.0