Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9406 - Can't view regular files with less : lesspipe.sh bug
Summary: Can't view regular files with less : lesspipe.sh bug
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal minor
Assignee: Brad Cowan (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-20 16:49 UTC by Arnaud Burlet
Modified: 2003-02-04 19:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud Burlet 2002-10-20 16:49:07 UTC
less 376 :

can't view regular files with less :

ghort@ghort666:~> less BnetLog.txt

I only see Exit 1

ghort@ghort666:~> file -L BnetLog.txt
BnetLog.txt: ASCII text

ghort@ghort666:~> setenv | grep LESSOPEN
LESSOPEN=|lesspipe.sh %s
ghort@ghort666:~> which lesspipe.sh
/usr/bin/lesspipe.sh

The bug is in lesspipe.sh

The problem is that if file has no extension, or not extension known by
lesspipe.sh, it has to be an elf executable to be viewed through less...

A quick fix would be change line 36 of lesspipe.sh from :
"$FILE1" = "ELF" -o "$FILE2" = "ELF" ] && strings $1 ;;
to :
"$FILE1" = "ELF" -o "$FILE2" = "ELF" ] && strings $1  || cat $1;;

With that fix, I've got less working fine now ...

Arnaud
Comment 1 SpanKY gentoo-dev 2002-10-20 17:59:23 UTC
did you try less 378 ?
Comment 2 Arnaud Burlet 2002-10-20 18:04:27 UTC
How ?
in emerge -s less only less 376 seems to be available ...
Comment 3 SpanKY gentoo-dev 2002-10-21 11:16:49 UTC
env ACCEPT_KEYWORDS="~x86" emerge -s less 
Comment 4 Arnaud Burlet 2002-10-21 16:24:42 UTC
it's exactly the same with less 378

Arnaud
Comment 5 Brad Cowan (RETIRED) gentoo-dev 2002-10-26 02:51:51 UTC
less seems to work perfectly fine here, maybe I don't understand your problem?
Comment 6 Arnaud Burlet 2002-10-31 17:38:28 UTC
After many tests, I've understood what happened...

I had to reinstall gentoo (many times) and couldn't reproduce that bug.

we can close this bug as it certainly was caused by a mistake I did, go on
reading for an explanation...

less /path_to_file on invocation calls lesspipe.sh /path_to_file. if lesspipe.sh
outputs nothing, less opens itself the file /path_to_file, otherwise it outputs
the output of lesspipe.sh. lesspipe.sh is run by sh, which is an alias to bash.
Bash when invoked by sh (I mean by the way of the alias), doesn't source
anything (like .bashrc, see man bash). .bashrc script shouldn't output anything
(this i a general rule, see .bashrc comments). My .bashrc was printing
something, that's why less didn't output the file, but strange messages.... Now
the question is why did bash source .bashrc as it shouldn't ? Maybe there is a
new version of bash until that ? at least now, it works perfectly.


Sorry folks !

Arnaud
Comment 7 Brad Cowan (RETIRED) gentoo-dev 2002-11-01 00:37:56 UTC
I tried and tried to reproduce with no result, glad you figured it out :)