Bug 190619

Summary: lesspipe.sh can reference unassigned DECOMPRESSOR var
Product: [Fedora] Fedora Reporter: John Hein <txn2tahx3v>
Component: lessAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact: Mike McLean <mikem>
Severity: low Docs Contact:
Priority: medium    
Version: 5CC: bugzilla.redhat.com
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-04 14:20:57 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
patch to lesspipe.sh to keep from referencing undef DECOMPRESSOR none

Description John Hein 2006-05-04 00:04:46 UTC
Description of problem:

When using the redhat less rpm's /usr/bin/lesspipe.sh, you can reference
DECOMPRESSOR when it is unassigned.  This happens when viewing a normal file
that is not a .gz or .bz2 file (see the * case in lesspipe.sh).

Normally this fails silently and less takes the empty output to mean that it
should use its default behavior and open the file itself, but if using csh and
you have 'printexitvalue' set, the shell will output 'Exit 127' when it tries to
execute -- (the first thing after the reference to the undefined DECOMPRESSOR).

less sees this output from lesspipe.sh and assumes lesspipe.sh has done the
proper processing.  So all the user sees when he calls less is the 'Exit 127'
(the output from 'csh -c /usr/bin/lesspipe.sh ...') and not the file he wanted
to view (whatever it may be).

This could be fixed a number of ways...
 - don't set printexitvalue if not in an interactive shell.
 - have less only use stdout from lesspipe.sh (it may already do that) and have
csh print the exit value to stderr

But lesspipe.sh should really not try to use an unassigned variable.
The fix is easy.  See attached patch.

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

less-394 rpm (and probably earlier versions as well).

How reproducible:

Every time.

Steps to Reproduce:
1. echo set printexitvalue > /tmp/.cshrc
2. env -i SHELL=/bin/csh HOME=/tmp LESSOPEN="|/usr/bin/lesspipe.sh %s"
TERM=xterm less /tmp/.cshrc
  
Actual results:

'Exit 127' 
/tmp/.cshrc (END)

Expected results:

set printexitvalue
/tmp/.cshrc (END)

Additional info:

Comment 1 John Hein 2006-05-04 00:04:46 UTC
Created attachment 128571 [details]
patch to lesspipe.sh to keep from referencing undef DECOMPRESSOR

Comment 2 Ivana Varekova 2006-05-04 14:20:57 UTC
Thanks. This problem is fixed in less-394-4.

Comment 3 Ivana Varekova 2006-05-11 12:52:08 UTC
*** Bug 191308 has been marked as a duplicate of this bug. ***