summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-05 06:36:59 +0000
committerMike Frysinger <vapier@gentoo.org>2010-02-05 06:36:59 +0000
commitfa13aca481c37bb2167407c2abb8eb8c70fd341b (patch)
treef90becf53d5e67d8c8c18454b9d0dc103a92226a /sys-apps/less
parentVersion bump. (diff)
downloadgentoo-2-fa13aca481c37bb2167407c2abb8eb8c70fd341b.tar.gz
gentoo-2-fa13aca481c37bb2167407c2abb8eb8c70fd341b.tar.bz2
gentoo-2-fa13aca481c37bb2167407c2abb8eb8c70fd341b.zip
Fix handling of short tarball names #303433 by Mike Williams, and add a LESSDEBUG helper.
(Portage version: 2.2_rc61/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/less')
-rw-r--r--sys-apps/less/ChangeLog6
-rw-r--r--sys-apps/less/files/lesspipe.sh25
2 files changed, 20 insertions, 11 deletions
diff --git a/sys-apps/less/ChangeLog b/sys-apps/less/ChangeLog
index 6ec336c9c129..bfdd552c5079 100644
--- a/sys-apps/less/ChangeLog
+++ b/sys-apps/less/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-apps/less
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.114 2010/01/10 17:47:11 ulm Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.115 2010/02/05 06:36:58 vapier Exp $
+
+ 05 Feb 2010; Mike Frysinger <vapier@gentoo.org> files/lesspipe.sh:
+ Fix handling of short tarball names #303433 by Mike Williams, and add a
+ LESSDEBUG helper.
10 Jan 2010; Ulrich Mueller <ulm@gentoo.org> less-436.ebuild:
Fix LICENSE, less is the same as BSD-2.
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index e7daac462b22..0a0f6556a8a5 100644
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -5,16 +5,18 @@
# TODO: handle compressed files better
+[[ -n ${LESSDEBUG} ]] && set -x
+
trap 'exit 0' PIPE
guesscompress() {
case "$1" in
- *.gz|*.z) echo "gunzip -c" ;;
- *.bz2) echo "bunzip2 -c" ;;
- *.lz) echo "lzip -c" ;;
- *.lzma) echo "unlzma -c" ;;
- *.xz) echo "xzdec" ;;
- *) echo "cat" ;;
+ *.gz|*.z) echo "gunzip -c" ;;
+ *.bz2|*.bz) echo "bunzip2 -c" ;;
+ *.lz) echo "lzip -c" ;;
+ *.lzma) echo "unlzma -c" ;;
+ *.xz) echo "xzdec" ;;
+ *) echo "cat" ;;
esac
}
@@ -101,11 +103,12 @@ lesspipe() {
### Tar files ###
*.tar|\
- *.tar.bz2|*.tbz2|*.tbz|\
- *.tar.gz|*.tgz|*.tar.z|\
+ *.tar.bz2|*.tar.gz|*.tar.z|\
*.tar.lz|*.tar.tlz|\
*.tar.lzma|*.tar.xz)
${DECOMPRESSOR} -- "$1" | tar tvvf -;;
+ *.tbz2|*.tbz|*.tgz|*.tlz)
+ lesspipe "$1" "$1".tar.${1##*.t} ;;
### Misc archives ###
*.bz2|\
@@ -232,7 +235,7 @@ if [[ -z $1 ]] ; then
echo "Usage: lesspipe.sh <file>"
elif [[ $1 == "-V" || $1 == "--version" ]] ; then
Id="cvsid"
- cvsid="$Id: lesspipe.sh,v 1.36 2009/10/22 07:53:42 vapier Exp $"
+ cvsid="$Id: lesspipe.sh,v 1.37 2010/02/05 06:36:59 vapier Exp $"
cat <<-EOF
$cvsid
Copyright 2001-2009 Gentoo Foundation
@@ -266,5 +269,7 @@ elif [[ -d $1 ]] ; then
ls -alF -- "$1"
else
recur=0
- lesspipe "$1" 2> /dev/null
+ [[ -n ${LESSDEBUG} ]] \
+ && lesspipe "$1" \
+ || lesspipe "$1" 2> /dev/null
fi