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:
Created attachment 91073 [details] fix And here is the fix for the problem
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.
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.
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.