Bug 88614 - lesspipe.sh doesn't work with normal (non-compressed etc. ) files
lesspipe.sh doesn't work with normal (non-compressed etc. ) files
Product: Red Hat Linux
Classification: Retired
Component: less (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-04-11 09:48 EDT by David Juran
Modified: 2007-04-18 12:52 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-03-29 03:50:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fix (292 bytes, patch)
2003-04-11 10:32 EDT, David Juran
no flags Details | Diff
Alternative fix (454 bytes, patch)
2003-05-28 12:25 EDT, Robert K. Moniot
no flags Details | Diff

  None (edit)
Description David Juran 2003-04-11 09:48:25 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314

Description of problem:
/usr/bin/lesspipe.sh is broken.
Running lesspipe on a normal file (that isn't compressed, or an manfile  etc)
fails e.i. 
lesspipe foo
fails since then, on line 43, the variable DECOMPRESSOR is empty and there will
be a syntax error.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.lesspipe foo


Additional info:
Comment 1 David Juran 2003-04-11 10:32:23 EDT
Created attachment 91073 [details]

And here is the fix for the problem
Comment 2 Len Moss 2003-05-22 13:17:10 EDT
I experienced this problem, too, and spotted the bug in
lesspipe.sh, but I was puzzled because some of my colleagues
did not experience the problem -- less worked fine for them
on normal files.  I eventually figured out what was different
in my case.  My default shell is tcsh and I had a bug in
my .cshrc file that caused the printexitvalue shell variable
to be set even for non-interactive shells.  This produced some
output ("Exit 127") even when lesspipe.sh failed, and less
just displayed this one line.  Once I fixed my .cshrc bug,
lesspipe.sh still failed on normal files, but no longer
wrote any output, and so less just opened the normal file
Comment 3 Robert K. Moniot 2003-05-28 12:01:30 EDT
I also discovered the bug, but it affected me only on one of two systems I use
(both RH 9).  I use bash as my shell (bash-2.05b-2).  In my case the difference
was due to a combination of two factors: one factor was that on one system, my
.bash_profile  exported BASH_ENV=$HOME/.bashrc (it is probably an antique
version: /etc/skel/.bash_profile doesn't have this).  This causes /bin/sh to
source my .bashrc.  (Is this a bug? shouldn't /bin/sh ignore all things
bash-specific, including BASH_ENV?)  The second factor was that on the same
system, like Len Moss's case, my .bashrc had an error in it, printing out a
fortune even for non-interactive shells.  So less displayed the fortune instead
of the file.
Comment 4 Robert K. Moniot 2003-05-28 12:25:04 EDT
Created attachment 92028 [details]
Alternative fix

This fix causes lesspipe.sh to produce no output on ordinary files.  I think
that's better than passing the file thru cat, since lesspipe.sh gets out of the
way and less opens the file directly.

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