Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 17456

Summary: Suggested lesspipe.sh replacement
Product: [Retired] Red Hat Linux Reporter: Philip Rowlands <bugzilla>
Component: lessAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: chris
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-01-24 19:53:31 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:
Attachments:
Description Flags
Suggested replacement for lesspipe.sh
none
Version of lesspipe.sh which copes with non-troff .<n>.gz files
none
Fixed lesspipe.sh none

Description Philip Rowlands 2000-09-12 21:39:49 UTC
The lesspipe.sh supplied has several errors: firstly, filenames with
whitespace don't work (although the current rawhide release, less-358-6,
predates the #16777 fix); the wildcard matching is unnecessarily verbose;
the error redirection is unnecessarily given on every line; common file
cases are not grouped together...

So I've rewritten it, and attached it below. My (claimed) improvements are:

- No issues with any filenames; all variable substitutions are protected by
quotes and '--' end of option processing.
- Manpages are read with man, rather than calling groff directly, which
ignored everything in /etc/man.conf
- Manpages are blank-line-squeezed (they still have annoying page breaks,
but that's a different bugzilla)
- All 3 manpage cases are condensed into one
- Compressed tarfiles are grouped into one line, except .tar.bz2, which now
uses tar's 'I' option
- Zipfiles use zipinfo instead of unzip -l. This is a change in output
format, but preferable because zipinfo shows file permissions, compression
method, and uses an "ls -l" style format.

Comment 1 Philip Rowlands 2000-09-12 21:44:34 UTC
Created attachment 3400 [details]
Suggested replacement for lesspipe.sh

Comment 2 Ngo Than 2000-09-14 13:24:49 UTC
added your new lesspipe.sh in less-358-8. Thanks

Comment 3 chris 2001-01-15 17:39:03 UTC
Unfortunately, using this version of lesspipe.sh on a file whose name ends in
.1.gz which is not a manpage doesn't work (this happens to me quite often when I
try to view old logs which have been rotated and compressed by logrotate).

The attached version drops back to the default .gz or .bz2 behaviour if the
input file does not contain troff data.

Comment 4 chris 2001-01-15 17:41:18 UTC
Created attachment 7628 [details]
Version of lesspipe.sh which copes with non-troff .<n>.gz files

Comment 5 Philip Rowlands 2001-01-24 19:51:16 UTC
OK, I've reopened this bug to submit a fixed version. Some additional comments:

- RedHat added another case for *.?x.gz manpages. I don't think this is the
right way to go, as everyone seems to invent a new section for their project.
For example, on my RH6.2 install, there are *thr.gz, *t.gz, *x.gz, *m.gz,
*qt.gz. man(1) is better suited to reading these sorts of manpages, as it
invokes less.

- RedHat added a cpio handler, which I've slightly rewritten to make it safe
against files which look like options. I've never seen a cpio file with a .cpi
extension.

- Experimental support for directory listing (try "less /etc"). The display
format is personal preference, although I appreciate that not everyone will like
the -F option.

- And, of course, the submitted bug. I've added an 'else' case to the manpage
detection to handle compressed rotated logs.

Comment 6 Philip Rowlands 2001-01-24 19:53:28 UTC
Created attachment 8169 [details]
Fixed lesspipe.sh

Comment 7 Karsten Hopp 2001-02-01 12:40:48 UTC
fixed in the current rawhide version. I didn't add the support for directories.


Comment 8 chris 2001-02-01 12:49:05 UTC
Fair enough.  I actually think Philip's directory listing support is
exceptionally useful, but I guess tastes vary...