Bug 190619 - lesspipe.sh can reference unassigned DECOMPRESSOR var
Summary: lesspipe.sh can reference unassigned DECOMPRESSOR var
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: less
Version: 5
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Mike McLean
URL:
Whiteboard:
: 191308 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-04 00:04 UTC by John Hein
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-05-04 14:20:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch to lesspipe.sh to keep from referencing undef DECOMPRESSOR (340 bytes, patch)
2006-05-04 00:04 UTC, John Hein
no flags Details | Diff

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. ***


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