Bug 88614 - lesspipe.sh doesn't work with normal (non-compressed etc. ) files
Summary: lesspipe.sh doesn't work with normal (non-compressed etc. ) files
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: less
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-11 13:48 UTC by David Juran
Modified: 2007-04-18 16:52 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-29 08:50:31 UTC
Embargoed:


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

Description David Juran 2003-04-11 13:48:25 UTC
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):
less-378-7

How reproducible:
Always

Steps to Reproduce:
1.lesspipe foo

    

Additional info:

Comment 1 David Juran 2003-04-11 14:32:23 UTC
Created attachment 91073 [details]
fix

And here is the fix for the problem

Comment 2 Len Moss 2003-05-22 17:17:10 UTC
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
directly.


Comment 3 Robert K. Moniot 2003-05-28 16:01:30 UTC
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 16:25:04 UTC
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.