Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Large COLUMNS crashes zsh



Miek Gieben wrote:
> bash seems handle this just fine. And it resets the value to something
> more sane (don't know if that is a bug or feature):
> 
> $ export COLUMNS=10000000000000000
> $ echo $COLUMNS
> 10000000000000000
> $ ls
> ...bunch of files...
> $ echo $COLUMNS
> 100
> $
> 
> This is with bash3. Zsh on the other hand is trying to trash my
> machine :)

zsh actually needs to know the number of columns internally for zle,
which stores all the lines it's printing out; this is needed to get
multiline buffers to work.  So if you get it wrong it's not going to
work properly anyway, even if we invent some kludge (and there are
plenty of possibilities).  I can't really think of a better answer than
"don't do that", offhand, but I'm open to specific suggestions.
(The question is not "is it bad for the shell to crash?"  The question
is "what do we do about it?")

By the way, if you simply don't want the shell to see a value you're
using in a function or script, there's a workaround:

fn() {
  local -hx COLUMNS=10000000000000000
}

The -h makes the parameter cover the special value; it's set in the
environment for the duration of the function but isn't coupled to the
shell's internall column setting.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author