Bug 17456 - Suggested lesspipe.sh replacement
Suggested lesspipe.sh replacement
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: less (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-09-12 17:39 EDT by Philip Rowlands
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-24 14:53:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Suggested replacement for lesspipe.sh (772 bytes, text/plain)
2000-09-12 17:44 EDT, Philip Rowlands
no flags Details
Version of lesspipe.sh which copes with non-troff .<n>.gz files (855 bytes, text/plain)
2001-01-15 12:41 EST, chris
no flags Details
Fixed lesspipe.sh (890 bytes, text/plain)
2001-01-24 14:53 EST, Philip Rowlands
no flags Details

  None (edit)
Description Philip Rowlands 2000-09-12 17:39:49 EDT
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 17:44:34 EDT
Created attachment 3400 [details]
Suggested replacement for lesspipe.sh
Comment 2 Ngo Than 2000-09-14 09:24:49 EDT
added your new lesspipe.sh in less-358-8. Thanks
Comment 3 chris 2001-01-15 12:39:03 EST
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 12:41:18 EST
Created attachment 7628 [details]
Version of lesspipe.sh which copes with non-troff .<n>.gz files
Comment 5 Philip Rowlands 2001-01-24 14:51:16 EST
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 14:53:28 EST
Created attachment 8169 [details]
Fixed lesspipe.sh
Comment 7 Karsten Hopp 2001-02-01 07:40:48 EST
fixed in the current rawhide version. I didn't add the support for directories.
Comment 8 chris 2001-02-01 07:49:05 EST
Fair enough.  I actually think Philip's directory listing support is
exceptionally useful, but I guess tastes vary...

Note You need to log in before you can comment on or make changes to this bug.