Subject: Bug#3952: Less annoyances

From: Christoph Lameter <[email-masked]>
Date: Sat, 27 Jul 1996 09:43:47 -0700 (PDT)

Package: less
Version: 290-8

Problems with less under Debian:

1. If you do a less on a file that does not exist then it will first show
you an empty screen. If you press q then you get a "file not found" or so.

2. Upon exiting less the cursor is not restored to the original position
in a larger (60x80) window. Instead its apparently restored to the
25th line. Plus the content just viewed vanishes!
It would be nice if the content would stay on the screen to be selected
with the mouse and pasted etc etc.

A wish because of the heavy usage of gzipped files under debian:

- Add functionality for less to automatically recognize a gzipped file
and view it correctly without having to resort to zless.

I have not figured it out yet but there must be some sort of way to have
less display IBM-PC characters?

The Slackware 3.0 less does not have the problems mentioned above.

{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{}    Snail Mail:   FTS Box 466, 135 N.Oakland Ave, Pasadena, CA 91182        {}
{}    FISH Internet System Administrator at Fuller Theological Seminary       {}
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
PGP Public Key  =  FB 9B 31 21 04 1E 3A 33  C7 62 2F C0 CD 81 CA B5

---

From: [email-masked]
Date: Sun, 28 Jul 96 22:52 EDT

Christoph>  Package: less 
  Christoph>  Version: 290-8

[...]

  Christoph> A wish because of the heavy usage of gzipped files under debian:
  Christoph> 
  Christoph> - Add functionality for less to automatically recognize a
  Christoph> gzipped file and view it correctly without having to resort to
  Christoph> zless.

Alias your zless to less. Zless does this correctly.

  Christoph> I have not figured it out yet but there must be some sort of way
  Christoph> to have less display IBM-PC characters?

export LESSCHARSET=latin1

--
Dirk Eddelb"uttel                             http://qed.econ.queensu.ca/~edd

---

From: Guy Maor <[email-masked]>
Date: Mon, 29 Jul 1996 00:55:03 -0500 (CDT)

> Alias your zless to less. Zless does this correctly.

Better is to set the LESSOPEN environment variable and write a lessopen
script.  You can view all sorts of files.

For example:
femto[~]$ echo $LESSOPEN
|/home/gmaor/bin/lessopen %s
femto[~]$ cat bin/lessopen
#!/bin/sh
case "$1" in
  *tar.gz|*tgz|*tar.Z)
    tar tvfz $1
    ;;
  *tar)
    tar tvf $1
    ;;
  *.Z|*.gz)
    gunzip -c $1
    ;;
  *.zip|*.ZIP)
    unzip -v $1
    ;;
  *.arj|*.ARJ)
    unarj l $1
    ;;
esac

---

From: [email-masked] (J.H.M.Dassen)
Date: Mon, 29 Jul 1996 11:10:15 +0200 (MDT)

> export LESSCHARSET=latin1

Hmmm... This will give you an ISO-8859-1 ("ISO Latin 1") character set.
Less knows that _more_ characters are displayable in that character set,
but I'm not sure it'll give you all of the "graphical" IBM-PC characters.

(In fact, on my system, it gives a lot of accents, since my screenfont
is set to iso1 too).

less(1) talks about a LESSCHARDEF variable to indicate which characters
are "printable"... maybe that's a better solution?

Ray
-- 
POPULATION EXPLOSION  Unique in human experience, an event which happened 
yesterday but which everyone swears won't happen until tomorrow.  
- The Hipcrime Vocab by Chad C. Mulligan

---

From: Michael Alan Dorman <[email-masked]>
Date: Mon, 29 Jul 1996 08:40:09 -0400

>with the mouse and pasted etc etc.

Except for the first part of #2 (which I cannot reproduce), both of
these are configurable by command-line or environment variable.

Putting 'LESS="-acegimwy10X" ; export LESS' in ~/.bash_profile takes
care of both of these as well as some other personal preferences.

None of these are bugs, just complaints about less' defaults not
reflecting personal preferences.  This should be closed.

Mike.
--
"Don't let me make you unhappy by failing to be contrary enough...."

---

From: Christoph Lameter <[email-masked]>
Date: Mon, 29 Jul 1996 07:47:41 -0700 (PDT)

> reflecting personal preferences.  This should be closed.
Then change the defaults. Especially number 1 is a rather strange
configuration.

---

From: Steve Greenland <[email-masked]>
Date: Mon, 29 Jul 1996 11:08:24 -0500 (CDT)

> Then change the defaults. Especially number 1 is a rather strange

But I like the defaults the way they are. Please don't change them.

Actually, I don't really care. My point is that Michael is correct.
These programs read configuration files and environment variables
so that you can tune them to your _personal_ preferences, rather
than being dictated by the author or debian maintainer. I think
unless there is a _good_ reason (compliance with the FSSTND, for
example), programs should be delivered with the defaults set as
the author distributes them, to best match what occurs on other
systems. If the program does not provide a way to adjust behavior
other than recompiling, then maybe it should go up for discussion.

It might be nice if the maintainer provided a few common configuration
examples in /usr/docs/examples, if they feel up to it :-).

Also, thanks to Guy (I think that's who it was...) for the "lessopen"
example -- pretty cool. I think I've learned more neat unix tricks
on this list than anywhere else...

Steve

-- 
The Mole - I think, therefore I scream 

			Reporter (to Mahatma Gandhi):
				"Mr. Gandhi, what do you think of
				 Western Civilization?"
			Gandhi:
				"I think it would be a good idea."

---

From: [email-masked] (Erick Branderhorst)
Date: Mon, 29 Jul 1996 16:18:00 +0100

> Then change the defaults. Especially number 1 is a rather strange

I did an update on less a few days ago and since then these "bugs"
came in or what.  I'm not a less expert and only updated it because
a new version came out.  If this broke anything we might put this
recent upload on hold and put back the old one (or were the "bugs" in
that one too).  Otherwise one might patch the sources and upload a
correct version.  The lessopen function might be added to the package?

Anyone willing to patch, if not I'll give it a try?

Erick

---

From: Christoph Lameter <[email-masked]>
Date: Mon, 29 Jul 1996 08:48:50 -0700 (PDT)

I am using the "old" less from Debian 1.1!

On Mon, 29 Jul 1996, Erick Branderhorst wrote:

> Date: Mon, 29 Jul 1996 16:18:00 +0100
> From: Erick Branderhorst <[email-masked]>
> To: [email-masked], [email-masked]
> Subject: Re: Bug#3952: Less annoyances
> 
>

---

From: [email-masked]
Date: Mon, 29 Jul 96 11:58 EDT

Christoph> 1. If you do a less on a file that does not exist then it will
  Christoph> first show >you an empty screen. If you press q then you get a
  Christoph> "file not found" or so.

  Michael> None of these are bugs, just complaints about less' defaults not
  Michael> reflecting personal preferences.  This should be closed.

  Christoph> Then change the defaults. Especially number 1 is a rather
  Christoph> strange configuration.

Nope, less does the Right Thing (TM):

edd@miles:~> less voodoo
voodoo: No such file or directory     

and I haven't specified anything special here (other than the LESSCHARSET I
mentioned earlier and which had missed your question by a foot, sorry for that)

edd@miles:~> set
BASH=/bin/bash
BASH_VERSION=1.14.6(1)
COLORTERM=rxvt
DISPLAY=:0.0
EDITOR=emacsclient
EUID=1000
HISTFILE=/home/edd/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/home/edd
HOSTTYPE=i386
IFS=
LESSCHARSET=latin1
LS_COLORS=no=00:fi=00:di=00;34:ln=00;35:or=05;35:pi=40;33:so=40;35:bd=40;31:cd=40;32:ex=31;01:*.tar=01;30:*.tgz=01;30:*.arj=01;30:*.taz=01;30:*.lzh=01;30:*.zip=01;30:*.z=01;30:*.Z=01;30:*.gz=01;30:*.deb=01;30:
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=Linux
PAGER=less
PATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:.
PPID=20349
PS1=\u@\h:\w>
PS2=>
PS4=+
PWD=/home/edd
SHELL=/bin/bash
SHLVL=1
TERM=xterm
UID=1000
USER=edd
WINDOWID=20971522
_=voodoo
history_control=ignoredups

---

From: Christoph Lameter <[email-masked]>
Date: Mon, 29 Jul 1996 09:49:13 -0700 (PDT)

> voodoo: No such file or directory     
Try that with zless.

---

From: "Darren/Torin/Who Ever..." <[email-masked]>
Date: 29 Jul 1996 10:31:07 -0700

-----BEGIN PGP SIGNED MESSAGE-----

Would you like to be the less maintainer?  I took on less when Bill
Mitchell was leaving because it looked like no one else was going to.

Darren
- -- 
<[email-masked]> <http://www.daft.com/~torin> <[email-masked]> <[email-masked]>
Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996
@ Do you have your clothes on? I probably don't. Take yours off. Feel better. @
@ Sysadmin, webweaver, postmaster for hire.  C/Perl/CGI programmer and tutor. @

---

From: Christoph Lameter <[email-masked]>
Date: Mon, 29 Jul 1996 11:09:35 -0700 (PDT)

On 29 Jul 1996, Darren/Torin/Who Ever... wrote:

> Christoph Lameter, in an immanent manifestation of deity, wrote:
> Note the following:
> gzip: /usr/bin/zless
> gzip: /usr/man/man1/zless.1
> 
> If you have a problem with how zless performs and less performs
> correctly, it's a gzip package bug.  You might want to close this bug and open
> a new one with this problem.  I doubt the gzip maintainers care about
> what's happened up to this point.
This is not a gzip issue. The interaction between less and gzip is the
problem. zless should first check if the file is there and give an
error message before bringing the empty display up.

How do I "close a bug" ?

---

From: "Darren/Torin/Who Ever..." <[email-masked]>
Date: 29 Jul 1996 10:38:28 -0700

-----BEGIN PGP SIGNED MESSAGE-----

Note the following:
gzip: /usr/bin/zless

Darren
- --

---

From: Lars Wirzenius <[email-masked]>
Date: Mon, 29 Jul 1996 22:14:22 +0300

[ NB: I read the list.  Don't CC replies to me.  I pay for my PPP.  Thanks ]

> > voodoo: No such file or directory     

With zless, you get an error message (presumably output by zless), then
less starts and clears the screen and waits for you to press q.  If you
set PAGER to more, you only get the error message.

The reason for this is that more exits as soon as it has output the last
byte of the file, while less does not.  Less can be configured to work
like more in this case, if that's what you prefer (I usually don't).

The problem seems to be that zless starts the pager at all, when the file
does not exist.  Sounds like a bug in zless, but someone with fifteen
extra minutes should check if my analysis is correct.

Less clears the screen, because the terminfo description for the
terminal type (xterm, in my case) includes an initialization sequence
that does that.  The termination sequence restores the screen as it
was when the terminal was initialized.  Some people like it, others
don't.  It's been suggested that there should be two xterm terminfo
entries, one that does this and one that doesn't.  (And it should
be repeated for xterm-color.)

I'm happy with the defaults of less, except I'd like it to support
Latin1 out of the box.  The same applies to other programs of course.

---

From: [email-masked] (Emilio Lopes)
Date: Mon, 29 Jul 96 18:09 EST

>>>>> "EB" == Erick Branderhorst <[email-masked]> wrote:

EB> The lessopen function might be added to the package?

Well, I think there is an example in the man page, but it's a good
idea anyway to put it in the examples dir.

Ciao, Emilio.

-- 
                 Emilio C. Lopes <mailto:[email-masked]>
               Instituto de Fisica da Universidade de Sao Paulo
             Caixa Postal 66318, 05389-970 Sao Paulo - SP, BRAZIL
              Phone: (+55) (11) 818-6724 (Voice) / 818-6715 (Fax)

---

From: Lars Wirzenius <[email-masked]>
Date: Tue, 30 Jul 1996 02:08:38 +0300

> error message before bringing the empty display up.

zless is part of the gzip package.

> How do I "close a bug" ?

There should be instructions for that on www.debian.org, but you can leave
it to the package maintainer.

---

From: Lars Wirzenius <[email-masked]>
Date: Tue, 30 Jul 1996 02:20:04 +0300

Christoph Lameter:
> in a larger (60x80) window. 

Did you enlarge the window?  That is the only way it has happened to me.
But that behavior is not specific to less, other programs suffer from the
same thing.