From 32b553bce3ffdd22fff5acbb151939c3e5a45113 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 29 Mar 2016 09:39:48 +0200 Subject: [PATCH] less.csh: avoid unnecessary stat() call Resolves: #1321591 Version: 481-3 --- less.csh | 14 ++++++++++---- less.sh | 3 +++ less.spec | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/less.csh b/less.csh index 838fbe8..1e6a485 100644 --- a/less.csh +++ b/less.csh @@ -1,8 +1,14 @@ # less initialization script (csh) -if ( -x /usr/bin/lesspipe.sh ) then - if ( $?LESSOPEN && { eval 'test ! -z "$LESSOPEN"' } ) then - : - else + +# 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 setenv LESSOPEN "|/usr/bin/lesspipe.sh %s" endif endif diff --git a/less.sh b/less.sh index 663489a..cdba043 100644 --- a/less.sh +++ b/less.sh @@ -1,4 +1,7 @@ # less initialization script (sh) + +# All less.*sh files should have the same semantics! + if [ -z "$LESSOPEN" ] && [ -x /usr/bin/lesspipe.sh ]; then export LESSOPEN="|/usr/bin/lesspipe.sh %s" fi diff --git a/less.spec b/less.spec index cccb445..3b6aeea 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: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ or BSD Group: Applications/Text Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz @@ -67,6 +67,10 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* 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