Bug 556602

Summary: RFE: lesspipe.sh could use a support for *.xz files
Product: [Fedora] Fedora Reporter: Michal Jaegermann <michal>
Component: lessAssignee: Nikola Pajkovsky <npajkovs>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dhoward, npajkovs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: less-436-6.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 718498 (view as bug list) Environment:
Last Closed: 2010-02-20 00:06:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 718498    
Attachments:
Description Flags
lesspipe.sh
none
proposed patch to the lesspipe.sh from koji
none
lesspipe.sh none

Description Michal Jaegermann 2010-01-18 20:31:57 UTC
Description of problem:

With xz as as "standard utility" in Fedora and tar recognizing -J option it would be nice if lesspipe.sh would know what to do with files/archives compressed that way.  xz is similar in use to gzip and bz2.

Comment 1 Nikola Pajkovsky 2010-01-20 09:42:48 UTC
Created attachment 385635 [details]
lesspipe.sh

I have added new *.xz into lesspipe.sh. Please install build http://koji.fedoraproject.org/koji/taskinfo?taskID=1933411 or you can download attachment and copy it into /usr/bin(there is lesspipe.sh)

Comment 2 Michal Jaegermann 2010-01-21 02:08:55 UTC
(In reply to comment #1)

> I have added new *.xz into lesspipe.sh.

Not quite, I guess.  Instead of
  *.xz) tar Jtvvf "$1" ;;
like now it should be, IMO:
  *.tar.xz) tar Jtvvf "$1" ;;
  *.xz) xz -dc  -- "$1" ;;
similar to other compress programs.  Also it looks like that you forgot
the following change:
--- ./lesspipe.sh.orig  2010-01-20 02:30:01.000000000 -0700
+++ ./lesspipe.sh       2010-01-20 18:32:16.000000000 -0700
@@ -43,6 +43,7 @@
        case "$1" in
                *.gz)   DECOMPRESSOR="gunzip -c" ;;
                *.bz2)  DECOMPRESSOR="bunzip2 -c" ;;
+               *.xz)   DECOMPRESSOR="unxz -c" ;;
        esac
        if [ ! -z $DECOMPRESSOR ] ; then
                $DECOMPRESSOR -- "$1" ;


It is true that currently manpages are not compressed with xz but, once at this, I think that I would add on line 8 of lesspipe.sh all patterns which would be needed to handle such cases.  Just the same as all ".gz" patterns repeated with ".xz" instead.  It may come handy in the future and does not mess anything for now.

BTW - "*.tar.bz2" is processed with a pipe to tar instead of '-j' tar flag.  It really does not matter that much but maybe some consistency across different cases would be good?

Comment 3 Michal Jaegermann 2010-01-21 02:10:17 UTC
Created attachment 385829 [details]
proposed patch to the lesspipe.sh from koji

Comment 4 Michal Jaegermann 2010-01-21 02:36:35 UTC
Looking at patterns for manpage handling I only now noticed that one may have
.n suffix, and .n.bz2 but not .n.gz and I repeated that for .xz in my patch.
OTOH files from /usr/share/man/man?x directories are handled if they are gzip
compressed (and with xz with my patch) but not if bzip2 was used.  Still manpages from /usr/share/man[013]p/ directories are not covered by any pattern.  Weird.
I guess that this should be fixed too.

Comment 5 Nikola Pajkovsky 2010-01-21 13:57:24 UTC
aaaahaaaa we are talking about manpages. I thought that you want to see file list with less not what is inside files. Yep that make sense.

Comment 6 Michal Jaegermann 2010-01-21 16:06:46 UTC
(In reply to comment #5)
> aaaahaaaa we are talking about manpages.  

Not really.  Look closer.  manpages came up as an aside when I started checking what really happens in lesspipe.sh.  In attachment (id=385829) only the first chunk is for that, and as I wrote later not really complete, and the remaining chunks are "general".  I thought that comment #2 should be clear enough.  Just omit there a paragraph starting with "It is true ..." if you will.

Comment 7 Nikola Pajkovsky 2010-01-21 17:02:50 UTC
Ok I'm fully in the picture. I will apply patch soon and put there new build and lesspipe.sh(or patch)

Comment 8 Nikola Pajkovsky 2010-01-21 19:45:35 UTC
Created attachment 385994 [details]
lesspipe.sh

new lesspipe.sh and build http://koji.fedoraproject.org/koji/taskinfo?taskID=1936796

Comment 9 Fedora Update System 2010-02-01 11:16:43 UTC
less-436-6.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/less-436-6.fc12

Comment 10 Fedora Update System 2010-02-02 01:16:55 UTC
less-436-6.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update less'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-1342

Comment 11 Fedora Update System 2010-02-20 00:06:50 UTC
less-436-6.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.