diff --git a/less.csh b/less.csh old mode 100755 new mode 100644 index 13e4f3a..d3c1f8e --- a/less.csh +++ b/less.csh @@ -1,9 +1,15 @@ -#!/bin/csh # less initialization script (csh) -if ( -x /usr/bin/lesspipe.sh ) then - if ( $?LESSOPEN && { eval 'test ! -z "$LESSOPEN"' } ) then - : - else - setenv LESSOPEN "|/usr/bin/lesspipe.sh %s" + +# All less.*sh files should have the same semantics! + +# In case you are curious, the test for non-emptiness is not as easy as in +# Bourne shell. This "eval" construct is probably inspired by Stack +# Overflow question 13343392. +if ( $?LESSOPEN && { eval 'test ! -z "$LESSOPEN"' } ) then + : +else + if ( -x /usr/bin/lesspipe.sh ) then + # The '||' here is intentional, see rhbz#1254837. + setenv LESSOPEN "||/usr/bin/lesspipe.sh %s" endif endif diff --git a/less.sh b/less.sh old mode 100755 new mode 100644 index 9a6d64e..189bbd2 --- a/less.sh +++ b/less.sh @@ -1,4 +1,8 @@ # less initialization script (sh) -if [ -x /usr/bin/lesspipe.sh ] && [ -z "$LESSOPEN" ]; then - export LESSOPEN="|/usr/bin/lesspipe.sh %s" + +# All less.*sh files should have the same semantics! + +if [ -z "$LESSOPEN" ] && [ -x /usr/bin/lesspipe.sh ]; then + # The '||' here is intentional, see rhbz#1254837. + export LESSOPEN="||/usr/bin/lesspipe.sh %s" fi diff --git a/less.spec b/less.spec index 0408c36..d7dddf8 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 481 -Release: 1%{?dist} +Release: 5%{?dist} License: GPLv3+ or BSD Group: Applications/Text Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz @@ -18,8 +18,6 @@ Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch URL: http://www.greenwoodsoftware.com/less/ -Requires: groff-base -Requires: man-db BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool @@ -67,13 +65,30 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Mon Apr 25 2016 Pavel Raiskup - 481-5 +- again use the correct '||' syntax in LESSOPEN variable (rhbz#1254837) + +* Wed Apr 20 2016 Pavel Raiskup - 481-4 +- don't strictly require man-db or groff-base (rhbz#1278857) + +* Tue Mar 29 2016 Pavel Raiskup - 481-3 +- avoid one ubiquitous stat() call in less.sh and less.csh if possible + (rhbz#1321591) + +* Thu Feb 04 2016 Fedora Release Engineering - 481-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Fri Oct 2 2015 Viktor Jancik - 481-1 - Update to version 481, fixes #1231493 -* Wed Sep 2 2015 Viktor Jancik - 479-2 +* Wed Sep 2 2015 Viktor Jancik - 479-3 +- Added missing double quotes in profile.d scripts +- Corrected license information + +* Mon Aug 24 2015 Viktor Jancik - 479-2 - Updated spec file to comply with current Fedora Packaging Guidelines Added missing documentation files -- Fixed less profile.d scripts (#1254837) +- Fixed less profile.d scripts - Fixed preprocessing of man pages with special characters (#1241543) * Tue Jul 07 2015 Fedora Release Monitoring - 479-1 diff --git a/lesspipe.sh b/lesspipe.sh index 682f09e..d61dc4c 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -30,6 +30,24 @@ if [ -x ~/.lessfilter ]; then fi fi +manfilter () +{ + if test -x /usr/bin/man ; then + # See rhbz#1241543 for more info. Well, actually we firstly + # used 'man -l', then we switched to groff, and then we again + # switched back to 'man -l'. + /usr/bin/man -P /usr/bin/cat -l "$1" + elif test -x /usr/bin/groff; then + # This is from pre-rhbz#1241543-time. + groff -Tascii -mandoc "$1" | cat -s + else + echo "WARNING:" + echo "WARNING: to better show manual pages, install 'man-db' package" + echo "WARNING:" + cat "$1" + fi +} + export MAN_KEEP_FORMATTING=1 case "$1" in @@ -40,12 +58,12 @@ case "$1" in *.xz|*.lzma) DECOMPRESSOR="xz -dc" ;; esac if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then - $DECOMPRESSOR -- "$1" | man -P cat -l - + $DECOMPRESSOR -- "$1" | manfilter - exit $? fi ;;& *.[1-9n]|*.[1-9]x|*.man) if file "$1" | grep -q troff; then - man -P cat -l "$1" + manfilter "$1" exit $? fi ;;& *.tar) tar tvvf "$1"; exit $? ;;