Hi,
Before I go digging into the sources, does anyone know the logic behind "less"
being impacted by the contents of .bashrc...?
If I add 'echo "foobar"' to my .bashrc, any attempt to "less <file>" gives only
"foobar" as output instead of the expected contents of <file>.
The env. vars are:
$ for e in ${!LESS*}; do echo $e ${!e};done
LESS -MM
LESSKEY /etc/.less #doesn't exist
LESSOPEN |/usr/bin/lesspipe.sh %s #nothing weird here
I've strace'd it and see this line:
pipe([5, 6]) = 0
(the numbers are not always 5 & 6) which is probably from the LESSOPEN pipe...
I don't see less opening .bashrc or invoking it; but less somehow gets output
from .bashrc... What I can't determine yet is whether this "output" is from
.bashrc executing anew when less is run (most likely -- see below), or from a
stale buffer somewhere... I just can't imagine a scenario where less needs to
either access .bashrc or get data from a non-user-specified pipe... could this
be a potential security hole...?
The problem is even more confusing if I add some code to .bashrc; it gets
executed when I invoke less, instead of displaying the requested file... this
would seem to indicate .bashrc is executed when less is invoked...
This happens on both my LM7.2 machines; but not on the 8.0 one, though the
latter has the same env. vars and the same pipe in strace output... but, the
default .bashrc is different...
Puzzling.
Pierre