[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24608: 26.0.50; PTY window size initially zero
From: |
Helmut Eller |
Subject: |
bug#24608: 26.0.50; PTY window size initially zero |
Date: |
Tue, 04 Oct 2016 10:18:05 +0200 |
When a subprocess tries to read the window size of the tty with the
TIOCGWINSZ ioctl the result is initially zero. This causes problems for
programs that aren't prepared for zero sized windows. It would be
better if the size would be initialized correctly or at least not be
zero.
To reproduce the situation compile the attached C program and execute
Emacs like this:
emacs -Q -nw -f shell \
--eval '(progn (sit-for 1) (insert "getwinsize") (comint-send-input))' \
--eval '(progn (sit-for 1) (insert "getwinsize") (comint-send-input))' \
--eval '(progn (sit-for 1) (delete-other-windows) (insert "getwinsize")
(comint-send-input))'
After that, the *shell* buffer look like so:
helmut@caladan:/tmp> getwinsize
Window size: 0 columns 0 rows
helmut@caladan:/tmp> getwinsize
Window size: 0 columns 0 rows
helmut@caladan:/tmp> getwinsize
Window size: 80 columns 21 rows
helmut@caladan:/tmp>
We see that the size is initially zero but after resizing the window the
size is no longer zero. (Note: when typing the commands manually
tab-completion may create temporary windows and will initialize the
window size as side effect.)
Here the C programm to read the window size:
/* -*- compile-command:"cc getwinsize.c -o getwinsize" -*- */
#include <sys/ioctl.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
struct winsize sz;
if (ioctl (0, TIOCGWINSZ, &sz) == -1)
{
printf ("ioctl failed: %s", strerror (errno));
exit (1);
}
printf ("Window size: %i columns %i rows\n", sz.ws_col, sz.ws_row);
return 0;
}
In GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
of 2016-10-04 built on caladan
Repository revision: e2913dc880b9843bf69cf885270551bafeb46120
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description: Debian GNU/Linux 8.5 (jessie)
Configured using:
'configure --with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no'
Configured features:
PNG SOUND DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LANG: C.UTF-8
locale-coding-system: utf-8-unix
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#24608: 26.0.50; PTY window size initially zero,
Helmut Eller <=