diff --git a/.gitignore b/.gitignore index 351ea4e..a9c657b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ xsel-1.2.0.tar.gz -/xsel-1.2.1.tar.gz diff --git a/changelog b/changelog deleted file mode 100644 index c69d439..0000000 --- a/changelog +++ /dev/null @@ -1,122 +0,0 @@ -* Sat Jul 20 2024 Fedora Release Engineering - 1.2.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Thu Feb 01 2024 Mikolaj Izdebski - 1.2.1-1 -- Update to upstream version 1.2.1 - -* Sat Jan 27 2024 Fedora Release Engineering - 1.2.0-34 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sat Jul 22 2023 Fedora Release Engineering - 1.2.0-33 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Sat Jan 21 2023 Fedora Release Engineering - 1.2.0-32 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Sat Jul 23 2022 Fedora Release Engineering - 1.2.0-31 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sat Jan 22 2022 Fedora Release Engineering - 1.2.0-30 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Fri Jul 23 2021 Fedora Release Engineering - 1.2.0-29 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Thu Jan 28 2021 Fedora Release Engineering - 1.2.0-28 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Jul 29 2020 Fedora Release Engineering - 1.2.0-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri Jan 31 2020 Fedora Release Engineering - 1.2.0-26 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Sat Jul 27 2019 Fedora Release Engineering - 1.2.0-25 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Wed Feb 13 2019 Mikolaj Izdebski - 1.2.0-24 -- Fix buffer overflow, resolves: rhbz#1676251 -- Add missing BR on make - -* Sun Feb 03 2019 Fedora Release Engineering - 1.2.0-24 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Sat Jul 14 2018 Fedora Release Engineering - 1.2.0-23 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Fri Feb 09 2018 Fedora Release Engineering - 1.2.0-22 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Wed Jan 03 2018 Tomas Radej - 1.2.0-21 -- Fixed pasting into Chromium browser -- Resolves: rhbz#1529894 - -* Thu Aug 03 2017 Fedora Release Engineering - 1.2.0-20 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Wed Jul 26 2017 Mikolaj Izdebski - 1.2.0-19 -- Fix pasting into Java programs -- Resolves: rhbz#1473002 - -* Sat Feb 11 2017 Fedora Release Engineering - 1.2.0-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Fri Feb 05 2016 Fedora Release Engineering - 1.2.0-17 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Fri Jun 19 2015 Fedora Release Engineering - 1.2.0-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Mon Aug 18 2014 Fedora Release Engineering - 1.2.0-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Sun Jun 08 2014 Fedora Release Engineering - 1.2.0-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sun Aug 04 2013 Fedora Release Engineering - 1.2.0-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Fri Feb 15 2013 Fedora Release Engineering - 1.2.0-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Sun Jul 22 2012 Fedora Release Engineering - 1.2.0-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Thu Apr 05 2012 Hans de Goede - 1.2.0-10 -- Fix xsel not working when pasting large amounts of text - -* Sat Jan 14 2012 Fedora Release Engineering - 1.2.0-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Thu Apr 07 2011 Rakesh Pandit - 1.2.0-8 -- xsel-1.2.0-MAX_NUM_TARGETS.patch: fix xsel overflow of supported_targets array - (BZ#690214 - Thanks Hans de Goede) - -* Tue Feb 08 2011 Fedora Release Engineering - 1.2.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Jul 27 2009 Fedora Release Engineering - 1.2.0-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Thu Feb 26 2009 Fedora Release Engineering - 1.2.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Fri Aug 08 2008 Rakesh Pandit - 1.2.0-4 -- retag for F-8, missing spec file - -* Sat Jul 26 2008 Rakesh Pandit - 1.2.0-3 -- file section to catch all man compressions & no compressions - -* Sat Apr 19 2008 Henry Kroll - 1.2.0-2 -- Standardize build section, remove unnecessary CDEBUGFLAGS. -- Break up long lines, general cleanup. - -* Sat Apr 12 2008 Henry Kroll - 1.2.0-1 -- Version upgrade -- Change license to MIT Old Style -- Fix URL, Requires, BuildRequires. -- Change group to Applications/System re: xclip. Include keywords - in the description to make it easier to find. - -* Thu Mar 20 2008 Henry Kroll - 1.1.0-1 -- RPM test build diff --git a/sources b/sources index 9a20537..01a61b0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (xsel-1.2.1.tar.gz) = 549874679a2d2979fca851ce762870165f5cbe60ba3f15e0690080506a78ea0b2c52833bbf7868eb3988fc377a103c31c62367fb9c5d1eb606e0660985f82ca4 +75983f143ce83dc259796c6eaf85c8f5 xsel-1.2.0.tar.gz diff --git a/xsel-1.2.0-MAX_NUM_TARGETS.patch b/xsel-1.2.0-MAX_NUM_TARGETS.patch new file mode 100644 index 0000000..28611e1 --- /dev/null +++ b/xsel-1.2.0-MAX_NUM_TARGETS.patch @@ -0,0 +1,24 @@ +diff -ur xsel-1.2.0/xsel.c xsel-1.2.0.new/xsel.c +--- xsel-1.2.0/xsel.c 2008-02-12 05:50:18.000000000 +0100 ++++ xsel-1.2.0.new/xsel.c 2011-03-23 16:38:38.942688972 +0100 +@@ -68,7 +68,7 @@ + * NB. We do not currently serve COMPOUND_TEXT; we can retrieve it but do not + * perform charset conversion. + */ +-#define MAX_NUM_TARGETS 8 ++#define MAX_NUM_TARGETS 9 + static int NUM_TARGETS; + static Atom supported_targets[MAX_NUM_TARGETS]; + +@@ -2097,6 +2097,11 @@ + supported_targets[s++] = XA_STRING; + NUM_TARGETS++; + ++ if (NUM_TARGETS > MAX_NUM_TARGETS) { ++ exit_err ("internal error num-targets (%d) > max-num-targets (%d)\n", ++ NUM_TARGETS, MAX_NUM_TARGETS); ++ } ++ + /* Get the COMPOUND_TEXT atom. + * NB. We do not currently serve COMPOUND_TEXT; we can retrieve it but + * do not perform charset conversion. diff --git a/xsel-1.2.0-do-not-terminate-string.patch b/xsel-1.2.0-do-not-terminate-string.patch new file mode 100644 index 0000000..6d03bdb --- /dev/null +++ b/xsel-1.2.0-do-not-terminate-string.patch @@ -0,0 +1,38 @@ +From d2e8846d44789844720c967a20a0d3b044dc1bbc Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Sun, 6 Mar 2016 11:54:54 -0600 +Subject: [PATCH 1/2] Do not prematurely terminate string while receiving INCR + transfer + +This fixes a bug where xsel would only output the first 3999 characters +of the selection. +--- + xsel.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/xsel.c b/xsel.c +index 79cc68b..b131ca6 100644 +--- a/xsel.c ++++ b/xsel.c +@@ -516,14 +516,15 @@ get_append_property (XSelectionEvent * xsl, unsigned char ** buffer, + print_debug (D_TRACE, "Got zero length property; end of INCR transfer"); + return False; + } else if (format == 8) { +- if ((unsigned long)*offset + length > (unsigned long)*alloc) { +- *alloc = *offset + length; ++ if ((unsigned long)*offset + length + 1 > (unsigned long)*alloc) { ++ *alloc = *offset + length + 1; + if ((*buffer = realloc (*buffer, *alloc)) == NULL) { + exit_err ("realloc error"); + } + } + ptr = *buffer + *offset; +- xs_strncpy (ptr, value, length); ++ memcpy (ptr, value, length); ++ ptr[length] = '\0'; + *offset += length; + print_debug (D_TRACE, "Appended %d bytes to buffer\n", length); + } else { +-- +2.14.3 + diff --git a/xsel-1.2.0-fix-buffer-overflow.patch b/xsel-1.2.0-fix-buffer-overflow.patch new file mode 100644 index 0000000..028c01b --- /dev/null +++ b/xsel-1.2.0-fix-buffer-overflow.patch @@ -0,0 +1,11 @@ +--- xsel-1.2.0/xsel.c~ 2019-02-13 13:23:06.933869121 +0000 ++++ xsel-1.2.0/xsel.c 2019-02-13 13:24:28.998706282 +0000 +@@ -79,7 +79,7 @@ + static Boolean no_daemon = False; + + /* logfile: name of file to log error messages to when detached */ +-static char logfile[MAXFNAME]; ++static char logfile[MAXFNAME+1]; + + /* fstat() on stdin and stdout */ + static struct stat in_statbuf, out_statbuf; diff --git a/xsel-1.2.0-fix-java-pasting.patch b/xsel-1.2.0-fix-java-pasting.patch new file mode 100644 index 0000000..1832474 --- /dev/null +++ b/xsel-1.2.0-fix-java-pasting.patch @@ -0,0 +1,34 @@ +From 05f6172dc030bc81cda795e7f5e8cb351bc01ecc Mon Sep 17 00:00:00 2001 +From: Roman Shevchenko +Date: Mon, 13 Oct 2014 18:44:06 +0200 +Subject: [PATCH] avoid extra atom at the end of the targets list + +--- + xsel.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/xsel.c b/xsel.c +index dbcafd3..02471a0 100644 +--- a/xsel.c ++++ b/xsel.c +@@ -2138,10 +2138,6 @@ main(int argc, char *argv[]) + supported_targets[s++] = incr_atom; + NUM_TARGETS++; + +- /* Get the NULL atom */ +- null_atom = XInternAtom (display, "NULL", False); +- NUM_TARGETS++; +- + /* Get the TEXT atom */ + text_atom = XInternAtom (display, "TEXT", False); + supported_targets[s++] = text_atom; +@@ -2164,6 +2160,9 @@ main(int argc, char *argv[]) + NUM_TARGETS, MAX_NUM_TARGETS); + } + ++ /* Get the NULL atom */ ++ null_atom = XInternAtom (display, "NULL", False); ++ + /* Get the COMPOUND_TEXT atom. + * NB. We do not currently serve COMPOUND_TEXT; we can retrieve it but + * do not perform charset conversion. diff --git a/xsel-1.2.0-fix-large-pastes.patch b/xsel-1.2.0-fix-large-pastes.patch new file mode 100644 index 0000000..50c6355 --- /dev/null +++ b/xsel-1.2.0-fix-large-pastes.patch @@ -0,0 +1,13 @@ +diff -up xsel-1.2.0/xsel.c~ xsel-1.2.0/xsel.c +--- xsel-1.2.0/xsel.c~ 2012-04-05 16:18:33.000000000 +0200 ++++ xsel-1.2.0/xsel.c 2012-04-05 16:30:15.833900611 +0200 +@@ -505,7 +505,8 @@ get_append_property (XSelectionEvent * x + + debug_property (D_TRACE, xsl->requestor, xsl->property, target, length); + +- if (target != XA_STRING) { ++ if (target != utf8_atom && target != XA_STRING && ++ target != compound_text_atom) { + print_debug (D_OBSC, "target %s not XA_STRING in get_append_property()", + get_atom_name (target)); + free (*buffer); diff --git a/xsel-1.2.0-send-correct-event.patch b/xsel-1.2.0-send-correct-event.patch new file mode 100644 index 0000000..68aff52 --- /dev/null +++ b/xsel-1.2.0-send-correct-event.patch @@ -0,0 +1,43 @@ +From 43a106bba319ed33321927f2ba7f0fa62a4b6a36 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Sun, 6 Mar 2016 11:45:59 -0600 +Subject: [PATCH 2/2] Send correct SelectionNotify event when starting INCR + transfer + +The target should be copied from that given in SelectionRequest, not set +to INCR. This fixes a bug where it was impossible to paste > 4000 +characters of text from xsel to the Chromium browser. Note that some +programs, including Chromium, validate the 'target' that is passed back; +while other programs, such as those which use the GTK clipboard API, +ignore it. But based the ICCCM, it appears that xsel is incorrect, not +chromium: + + "The owner should set the specified selection, target, time, and + propety arguments to the values received in the SelectionRequest event." +--- + xsel.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xsel.c b/xsel.c +index b131ca6..44259b5 100644 +--- a/xsel.c ++++ b/xsel.c +@@ -1185,13 +1185,13 @@ change_property (Display * display, Window requestor, Atom property, + print_debug (D_TRACE, "large data transfer"); + + +- /* Send a SelectionNotify event of type INCR */ ++ /* Send a SelectionNotify event */ + ev.type = SelectionNotify; + ev.display = display; + ev.requestor = requestor; + ev.selection = selection; + ev.time = time; +- ev.target = incr_atom; /* INCR */ ++ ev.target = target; + ev.property = property; + + XSelectInput (ev.display, ev.requestor, PropertyChangeMask); +-- +2.14.3 + diff --git a/xsel.spec b/xsel.spec index 03f8aab..a2695fb 100644 --- a/xsel.spec +++ b/xsel.spec @@ -1,20 +1,28 @@ Name: xsel -Version: 1.2.1 -Release: %autorelease +Version: 1.2.0 +Release: 31%{?dist} Summary: Command line clipboard and X selection tool -License: HPND-sell-variant -URL: https://www.vergenet.net/~conrad/software/xsel/ +License: MIT +URL: http://www.vergenet.net/~conrad/software/xsel/ +Source0: http://www.vergenet.net/~conrad/software/xsel/download/xsel-%{version}.tar.gz -Source0: https://github.com/kfish/xsel/archive/refs/tags/%{version}.tar.gz#/xsel-%{version}.tar.gz +# Applied upstream (BZ#690214) +Patch0: xsel-1.2.0-MAX_NUM_TARGETS.patch +# Upstream: https://github.com/kfish/xsel/commit/ba8656dc7c7e771c802fc957ce3dd128d4b6e3ae +Patch1: xsel-1.2.0-fix-large-pastes.patch +# Patch for rhbz#1473002, taken from https://github.com/kfish/xsel/pull/6 +Patch2: xsel-1.2.0-fix-java-pasting.patch +# Patches for rhbz#1529894, taken from https://github.com/kfish/xsel/pull/16 +Patch3: xsel-1.2.0-do-not-terminate-string.patch +Patch4: xsel-1.2.0-send-correct-event.patch +# TODO: forward upstream +Patch5: xsel-1.2.0-fix-buffer-overflow.patch -BuildRequires: autoconf -BuildRequires: automake BuildRequires: gcc -BuildRequires: libSM-devel -BuildRequires: libXext-devel -BuildRequires: libXt-devel -BuildRequires: libtool BuildRequires: make +BuildRequires: libSM-devel +BuildRequires: libXt-devel +BuildRequires: libXext-devel %description XSel is a command line or script utility, similar to xclip, that can copy the @@ -23,21 +31,132 @@ stdin or stdout. It can also append to and delete the clipboard or buffer that you would paste with the middle mouse button. %prep -%autosetup -p1 -C +%setup -q +%patch0 -p1 -b .MAX_NUM_TARGETS +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build -./autogen.sh --version %configure make %{?_smp_mflags} %install -%make_install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install %files -%license COPYING -%doc AUTHORS ChangeLog README +%doc AUTHORS ChangeLog COPYING README %{_mandir}/man1/xsel.1x* %{_bindir}/xsel %changelog -%autochangelog +* Sat Jul 23 2022 Fedora Release Engineering - 1.2.0-31 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sat Jan 22 2022 Fedora Release Engineering - 1.2.0-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 1.2.0-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Thu Jan 28 2021 Fedora Release Engineering - 1.2.0-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 1.2.0-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jan 31 2020 Fedora Release Engineering - 1.2.0-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sat Jul 27 2019 Fedora Release Engineering - 1.2.0-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Feb 13 2019 Mikolaj Izdebski - 1.2.0-24 +- Fix buffer overflow, resolves: rhbz#1676251 +- Add missing BR on make + +* Sun Feb 03 2019 Fedora Release Engineering - 1.2.0-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 1.2.0-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Fedora Release Engineering - 1.2.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 03 2018 Tomas Radej - 1.2.0-21 +- Fixed pasting into Chromium browser +- Resolves: rhbz#1529894 + +* Thu Aug 03 2017 Fedora Release Engineering - 1.2.0-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Mikolaj Izdebski - 1.2.0-19 +- Fix pasting into Java programs +- Resolves: rhbz#1473002 + +* Sat Feb 11 2017 Fedora Release Engineering - 1.2.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Feb 05 2016 Fedora Release Engineering - 1.2.0-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 1.2.0-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Aug 18 2014 Fedora Release Engineering - 1.2.0-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 1.2.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 1.2.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri Feb 15 2013 Fedora Release Engineering - 1.2.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 1.2.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Apr 05 2012 Hans de Goede - 1.2.0-10 +- Fix xsel not working when pasting large amounts of text + +* Sat Jan 14 2012 Fedora Release Engineering - 1.2.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Apr 07 2011 Rakesh Pandit - 1.2.0-8 +- xsel-1.2.0-MAX_NUM_TARGETS.patch: fix xsel overflow of supported_targets array + (BZ#690214 - Thanks Hans de Goede) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.2.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jul 27 2009 Fedora Release Engineering - 1.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 1.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Aug 08 2008 Rakesh Pandit - 1.2.0-4 +- retag for F-8, missing spec file + +* Sat Jul 26 2008 Rakesh Pandit - 1.2.0-3 +- file section to catch all man compressions & no compressions + +* Sat Apr 19 2008 Henry Kroll - 1.2.0-2 +- Standardize build section, remove unnecessary CDEBUGFLAGS. +- Break up long lines, general cleanup. + +* Sat Apr 12 2008 Henry Kroll - 1.2.0-1 +- Version upgrade +- Change license to MIT Old Style +- Fix URL, Requires, BuildRequires. +- Change group to Applications/System re: xclip. Include keywords + in the description to make it easier to find. + +* Thu Mar 20 2008 Henry Kroll - 1.1.0-1 +- RPM test build