From 72ffdf0491ebd5f64fc30551c705a7177a3f99f8 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Mon, 22 Jan 2024 10:10:16 -0800 Subject: [PATCH] Backport upstream fix for "lesspipe may contain ".sh" extension" Also use commit date for "Oct 15 2022 - 3.1.9-17" commit to quash rpmlint error. Resolves: BZ 2256374 --- source-highlight-bz2256374-lesspipe_sh.patch | 39 ++++++++++++++++++++ source-highlight.spec | 8 +++- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 source-highlight-bz2256374-lesspipe_sh.patch diff --git a/source-highlight-bz2256374-lesspipe_sh.patch b/source-highlight-bz2256374-lesspipe_sh.patch new file mode 100644 index 0000000..b490cb2 --- /dev/null +++ b/source-highlight-bz2256374-lesspipe_sh.patch @@ -0,0 +1,39 @@ +commit 8be2bee7f6861fd27d5c181b15d3126fc7dbf73b +Author: Keith Seitz +Date: Sat Jan 20 09:25:05 2024 -0700 + + lesspipe may contain ".sh" extension + + On Fedora, the "lesspipe" script is actually called + "lesspipe.sh". This patch proposes to use "$(which NAME)" + to figure out the actual name of the script to use. + + If neither "lesspipe" nor "lesspipe.sh" exists in $PATH, + the patch simply uses "lesspipe", preserving the current behavior. + + It was based on the 3.1.9 release tarball, but should + apply cleanly to current git. + + This was reported as Fedora bugzilla 2256374. + +diff --git a/src/src-hilite-lesspipe.sh.in b/src/src-hilite-lesspipe.sh.in +index eb5c3ee..76231c7 100644 +--- a/src/src-hilite-lesspipe.sh.in ++++ b/src/src-hilite-lesspipe.sh.in +@@ -7,7 +7,15 @@ for source in "$@"; do + *Makefile|*makefile) + source-highlight --failsafe -f esc --lang-def=makefile.lang --style-file=esc.style -i "$source" ;; + *.tar|*.tgz|*.gz|*.bz2|*.xz) +- lesspipe "$source" ;; ++ # The "lesspipe" script may or may not have ".sh" extension. ++ lesspipe=$(which lesspipe 2>/dev/null) ++ if [ -z "$lesspipe" ]; then ++ lesspipe=$(which lesspipe.sh 2>/dev/null) ++ if [ -z "$lesspipe" ]; then ++ lesspipe="lesspipe" ++ fi ++ fi ++ $lesspipe "$source" ;; + *) source-highlight --failsafe --infer-lang -f esc --style-file=esc.style -i "$source" ;; + esac + done diff --git a/source-highlight.spec b/source-highlight.spec index 79e3a0c..42f1b22 100644 --- a/source-highlight.spec +++ b/source-highlight.spec @@ -1,7 +1,7 @@ Summary: Produces a document with syntax highlighting Name: source-highlight Version: 3.1.9 -Release: 20%{?dist} +Release: 21%{?dist} License: GPL-3.0-or-later AND GFDL-1.1-or-later AND LicenseRef-Fedora-Public-Domain AND GPL-2.0-only AND GPL-3.0-only AND GPL-3.0-or-later WITH Bison-exception-2.2 Source0: ftp://ftp.gnu.org/gnu/src-highlite/%{name}-%{version}.tar.gz Source1: ftp://ftp.gnu.org/gnu/src-highlite/%{name}-%{version}.tar.gz.sig @@ -9,6 +9,7 @@ URL: http://www.gnu.org/software/src-highlite/ # Taken from https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=904949c9026cb772dc93fbe0947a252ef47127f4 # and slightly adapted Patch0: 904949c9026cb772dc93fbe0947a252ef47127f4.patch +Patch1: source-highlight-bz2256374-lesspipe_sh.patch BuildRequires: make BuildRequires: bison, flex, boost-devel BuildRequires: help2man, chrpath, pkgconfig(bash-completion) @@ -94,6 +95,9 @@ rmdir $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d %{_includedir}/srchilite/*.h %changelog +* Mon Jan 22 2024 Keith Seitz - 3.1.9-21 +- Added upstream patch to fix BZ 2256374. + * Wed Jan 17 2024 Jonathan Wakely - 3.1.9-20 - Rebuilt for Boost 1.83 @@ -106,7 +110,7 @@ rmdir $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d * Mon Feb 20 2023 Jonathan Wakely - 3.1.9-18 - Rebuilt for Boost 1.81 -* Sat Oct 15 2022 FeRD (Frank Dana) - 3.1.9-17 +* Sun Jan 29 2023 FeRD (Frank Dana) - 3.1.9-17 - Stop adding 'cxx' language mapping (fixed upstream) - Add 'rpm-spec' (used in asciidoc) mapping