unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin
@ 2017-09-04  9:49 yorwba
  2017-09-04 15:32 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: yorwba @ 2017-09-04  9:49 UTC (permalink / raw)
  To: 28346

This bug only appears when Emacs is run in a terminal emulator that
allows changing the window size.

Steps to reproduce:

1. Run `emacs -nw -Q` in a small terminal window
2. Evaluate (setq width (window-width (get-buffer-window (current-buffer))))
   The value is 74 in my case.
3. Enlarge the terminal window (I go fullscreen with 150 columns).
4. Evaluate (set-window-margins (get-buffer-window (current-buffer)) 0 width)
5. Resize the terminal emulator window back to the original size (or smaller).
6. The terminal goes blank and no longer reacts to input.

Attaching gdb and using finish to end all terminating functions, I found that
it gets stuck in move_it_vertically_backwards (in xdisp.c). It keeps taking
the goto move_further_back without actually moving further back.

I believe that this is caused by incorrectly adjusting the margins when the
total available width changes.

What I see in GDB:

(gdb) p *it->w
$2 = {header = {size = 4611686018494636052}, frame = 12472813, next = 12473765, prev = 12392562, parent = 12392562, normal_lines = 12367919, 
  normal_cols = 12367927, new_total = 0, new_normal = 0, new_pixel = 0, contents = 12419381, start = 12418371, pointm = 12418411, 
  temslot = 12392562, vertical_scroll_bar = 12392562, vertical_scroll_bar_type = 12392610, display_table = 12392562, dedicated = 12392562, 
  redisplay_end_trigger = 12392562, combination_limit = 12392562, window_parameters = 12392562, current_matrix = 0xbe8ce0, 
  desired_matrix = 0xbe8c70, prev_buffers = 12392562, next_buffers = 12392562, use_time = 1, sequence_number = 1, pixel_left = 0, pixel_top = 1, 
  left_col = 0, top_line = 1, pixel_width = 74, pixel_height = 40, total_cols = 74, total_lines = 40, hscroll = 0, min_hscroll = 0, 
  last_modified = 0, last_overlay_modified = 0, last_point = 322, base_line_number = 0, base_line_pos = 1, column_number_displayed = -1, 
  nrows_scale_factor = 1, ncols_scale_factor = 1, cursor = {x = 0, y = 6, hpos = 0, vpos = -1}, phys_cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, 
  output_cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, last_cursor_vpos = 6, phys_cursor_type = NO_CURSOR, phys_cursor_width = -1, 
  phys_cursor_ascent = 0, phys_cursor_height = 0, left_fringe_width = -1, right_fringe_width = -1, left_margin_cols = 0, right_margin_cols = 74, 
  scroll_bar_width = -1, mode_line_height = 1, header_line_height = -1, window_end_pos = 282, window_end_vpos = 38, mini = false, 
  horizontal = false, update_mode_line = true, last_had_star = true, start_at_line_beg = true, force_start = false, optional_new_start = false, 
  phys_cursor_on_p = false, cursor_off_p = false, last_cursor_off_p = false, must_be_updated_p = true, pseudo_window_p = false, 
  fringes_outside_margins = false, window_end_valid = false, redisplay = true, vscroll = 0, window_end_bytepos = 282}
(gdb) p *it->w->current_matrix
$3 = {pool = 0xbaaca0, rows = 0xc757b0, rows_allocated = 60, nrows = 40, matrix_x = 0, matrix_y = 1, matrix_w = 74, matrix_h = 40, 
  window_pixel_left = 0, window_pixel_top = 1, window_height = 39, window_width = 74, window_vscroll = 0, left_margin_glyphs = 0, 
  right_margin_glyphs = 36, no_scrolling_p = false, header_line_p = false, buffer = 0xbd8130, begv = 1, zv = 322}
(gdb) p *it->w->desired_matrix
$4 = {pool = 0xbaabd0, rows = 0xc64800, rows_allocated = 60, nrows = 40, matrix_x = 0, matrix_y = 1, matrix_w = 74, matrix_h = 40, 
  window_pixel_left = 0, window_pixel_top = 1, window_height = 39, window_width = 74, window_vscroll = 0, left_margin_glyphs = 0, 
  right_margin_glyphs = 36, no_scrolling_p = false, header_line_p = false, buffer = 0x0, begv = 0, zv = 0}

Notice that current_matrix and desired_matrix both have window_width = 74 and right_margin_glyphs = 36,
but the window itself has total_cols = 74 and right_margin_cols = 74.

I hope that's enough info to reproduce and fix this issue.



In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-17 on lgw01-04, modified by Debian
System Description:	Ubuntu 16.04.3 LTS

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...
Loading cjk-enc...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.5/lisp/language/thai-word

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils help-mode easymenu xterm time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 79653 6239)
 (symbols 48 17875 0)
 (miscs 40 71 113)
 (strings 32 10754 4684)
 (string-bytes 1 267933)
 (vectors 16 7270)
 (vector-slots 8 343931 30089)
 (floats 8 66 517)
 (intervals 56 212 0)
 (buffers 960 13)
 (heap 1024 12619 1914))





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin
  2017-09-04  9:49 bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin yorwba
@ 2017-09-04 15:32 ` Eli Zaretskii
       [not found]   ` <5211a085-f1ea-5aeb-21e0-1a4143d5ebaf@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2017-09-04 15:32 UTC (permalink / raw)
  To: yorwba; +Cc: 28346

> From: yorwba <yorwb4@gmail.com>
> Date: Mon, 4 Sep 2017 17:49:25 +0800
> 
> This bug only appears when Emacs is run in a terminal emulator that
> allows changing the window size.
> 
> Steps to reproduce:
> 
> 1. Run `emacs -nw -Q` in a small terminal window
> 2. Evaluate (setq width (window-width (get-buffer-window (current-buffer))))
>    The value is 74 in my case.
> 3. Enlarge the terminal window (I go fullscreen with 150 columns).
> 4. Evaluate (set-window-margins (get-buffer-window (current-buffer)) 0 width)
> 5. Resize the terminal emulator window back to the original size (or smaller).
> 6. The terminal goes blank and no longer reacts to input.
> 
> Attaching gdb and using finish to end all terminating functions, I found that
> it gets stuck in move_it_vertically_backwards (in xdisp.c). It keeps taking
> the goto move_further_back without actually moving further back.
> 
> I believe that this is caused by incorrectly adjusting the margins when the
> total available width changes.

Thanks, but please also show the C backtrace from the place where
Emacs hangs, it's an important part of the problem.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin
       [not found]   ` <5211a085-f1ea-5aeb-21e0-1a4143d5ebaf@gmail.com>
@ 2017-09-04 15:46     ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-09-04 15:46 UTC (permalink / raw)
  To: yorwba; +Cc: 28346-done

> From: yorwba <yorwb4@gmail.com>
> Date: Mon, 4 Sep 2017 23:43:23 +0800
> 
> On 09/04/2017 11:32 PM, Eli Zaretskii wrote:
> > Thanks, but please also show the C backtrace from the place where
> > Emacs hangs, it's an important part of the problem.
> 
> (gdb) bt full
> #0  0x000000000044bed8 in move_it_vertically_backward (it=it@entry=0x7ffe46795eb0, dy=<optimized out>, dy@entry=19) at xdisp.c:9563
>         target_y = 20
>         y0 = <optimized out>
>         y1 = <optimized out>
>         line_height = 1
>         nlines = <optimized out>
>         h = <optimized out>
>         it2 =

Thanks.  I can reproduce this in Emacs 24, but not in Emacs 25.2, the
latest releases version, nor on the current master branch of what will
become Emacs 26.1.  So I guess this bug was already fixed.

Thank you for taking time to report all the details.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-04 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04  9:49 bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin yorwba
2017-09-04 15:32 ` Eli Zaretskii
     [not found]   ` <5211a085-f1ea-5aeb-21e0-1a4143d5ebaf@gmail.com>
2017-09-04 15:46     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).