From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: crashes when setting COLUMNS=0 or 1
Date: Tue, 26 Jun 2012 00:03:11 -0700 [thread overview]
Message-ID: <120626000311.ZM19019@torch.brasslantern.com> (raw)
In-Reply-To: <20120626033802.GA3066@primenet.com.au>
On Jun 26, 1:38pm, Geoff Wing wrote:
}
} Old versions of Zsh never let COLUMNS be set to 0 or negative numbers.
Not precisely true. Here's zsh 2.4:
torch<501> COLUMNS=-1
torch<502> print $COLUMNS
-1
*** glibc detected *** malloc(): memory corruption (fast): 0x0809d838 ***
zsh: abort (core dumped) src/zsh
} It would retain its old value if you tried since it just doesn't make
} sense. This behaviour should be recovered.
In 2.4, putprompt() would force columns = 80 when columns == 0, but there
isn't any test I can find for columns < 0.
In recent version adjustcolumns() has this:
#ifdef TIOCGWINSZ
if (signalled || zterm_columns <= 0)
zterm_columns = shttyinfo.winsize.ws_col;
else
shttyinfo.winsize.ws_col = zterm_columns;
#endif /* TIOCGWINSZ */
if (zterm_columns <= 0) {
DPUTS(signalled, "BUG: Impossible TIOCGWINSZ cols");
zterm_columns = tccolumns > 0 ? tccolumns : 80;
}
This is called from adjustwinsize(), and from various bits of params.c:
IPDEF5("COLUMNS", &zterm_columns, zlevar_gsu)
static const struct gsu_integer zlevar_gsu =
{ intvargetfn, zlevarsetfn, stdunsetfn };
void
zlevarsetfn(Param pm, zlong x)
{
zlong *p = pm->u.valptr;
*p = x;
if (p == &zterm_lines || p == &zterm_columns)
adjustwinsize(2 + (p == &zterm_columns));
}
But for some reason zlvarsetfn is never called when assigning COLUMNS,
so adjustwinsize() never happens.
Tracing through, COLUMNS=0 is handled by addvars() via execsimple(),
which does call v->pm->gsu.i->setfn at params.c:2343 ... but that's
the generic intvarsetfn, zlevarsetfn has been lost somewhere along
the way.
This may indicate there's a more generalized problem with the handling
of parameters for which IPDEF* have assigned a custom gsu.
next prev parent reply other threads:[~2012-06-26 7:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 10:36 Mikael Magnusson
2012-06-26 3:38 ` Geoff Wing
2012-06-26 7:03 ` Bart Schaefer [this message]
2012-06-26 7:21 ` Bart Schaefer
2012-06-26 7:30 ` Bart Schaefer
2012-06-26 9:33 ` Peter Stephenson
2012-06-26 14:26 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=120626000311.ZM19019@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).