[illumos-Developer] Requesting code review for opensource /usr/xpg4/bin/more replacement with "less" ...

I. Szczesniak iszczesniak at gmail.com
Tue Jan 18 12:07:18 PST 2011


On Tue, Jan 18, 2011 at 4:07 PM, Garrett D'Amore <garrett at damore.org> wrote:
> On Tue, 2011-01-18 at 10:35 +0100, Joerg Schilling wrote:
>> "Garrett D'Amore" <garrett at damore.org> wrote:
>>
>> > On Mon, 2011-01-17 at 11:54 -0800, Adam Leventhal wrote:
>> > > Hey Roland,
>> > >
>> > > Apologies if I missed this discussion, but why is this something that
>> > > should be in illumos? First less is not the same as more; second, why
>> > > wouldn't the downstream distros just include less if that's what they
>> > > wanted to do?
>> >
>> > Actually, it *is* the same as more, when called as "more".  In fact, the
>> > author of the original "more" utility on some platforms is the same as
>> > the author of "less".
>>
>> I cm not willing to believe this.
>>
>> more has a careful attempt to deal with the terminal that even works in case
>> that there is no TERM set up, while less has an agressive attempt to deal with
>> the terminal (to be specific, it deals with the terminal as if it was an
>> editor) that is known to often fail.
>>
>> A quick check with calling /usr/bin/less as more (more /etc/passwd) shows a
>> flicker and then it looks as if nothing happened.
>>
>> It would be nice if things were so simple that you really can use less to
>> replace /usr/xpg4/bin/more.
>>
>> Jörg
>>
>
> I think the problem you are seeing is a bug in xterm or TERMCAP, not in
> less.
>
> Specifically, less behaves as more -e by default (which might be argued
> to be a bug) when called as more.
>
> Given a short file (say /etc/motd), the output from less is not
> displayed on the terminal.  But truss shows that it did indeed write()
> to the tty.
>
> Notably, XPG4 more -e suffers from the same bug.
>
> To reproduce, do
>
> % printf "abc\n" > /tmp/a
> % /usr/xpg4/bin/more -e /tmp/a
>
> Surprisingly, piping to /bin/cat resolves the problem.
>
> Also, setting TERM=dumb resolves the problem.
>
> I'm not sure yet if the bug occurs on the console.
>
> I'd be willing to accept that fixing this problem (which might just be
> something stupid in the TERMCAP) is a pre-requisite for getting this
> integrated.

Why? Oracle's /usr/xpg4/bin/more exhibits the same problem. Neither
does it pass all tests of VSC. Why can't you integrate this patch and
then work on improvements in incremental steps?

Irek



More information about the Developer mailing list