From unknown Fri Aug 15 19:35:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin Resent-From: yorwba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Sep 2017 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 28346@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.150453802520484 (code B ref -1); Mon, 04 Sep 2017 15:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Sep 2017 15:13:45 +0000 Received: from localhost ([127.0.0.1]:49037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dot4K-0005KK-SU for submit@debbugs.gnu.org; Mon, 04 Sep 2017 11:13:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doo0z-00023H-4M for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0n-0002CE-V5 for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1doo0n-0002Bu-Rr for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doo0i-0004jW-58 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0c-00023I-M7 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:40 -0400 Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]:36335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1doo0c-00020z-GB for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:34 -0400 Received: by mail-it0-x22c.google.com with SMTP id j17so912955iti.1 for ; Mon, 04 Sep 2017 02:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=pllL7LIXoSY+0ascVvvumVK7ciwwdcm4ugU35k5IuHFNTnDfMY2Woo8sNJIDDf/uGc ZFoR/TS1WkdgN4+KH6Svn3Fm6n0AywS74mrZ66V3MA3ydfOHxfXY7RfM1MzlwKUK5dXG N5SX2w2p2pQRKVjE9f71hGRjzaOXEjiuFYY1a+A+LzcZczIsPsUD4w0EU2bvq+s+q+R8 u0JVXr8Ha4vVsd5Y7GkpqyLAKuPXoWR4WIO3PpmiPymlrOUK3uE8YgFSVgkfxYFQa0td jQBD/sLPuJp6MGkYIbwIsh3+q2N/KzOrcC6q2bs6oS9Untv6Y/z4eaToEmwR0DG7TE2y OSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=iOaEHcagAQ4zsMHOTx/tzrnqBBdTyY0i+SY+g1we39e+k7pw2ItgSoPqniXsuCK4ox RNRndtsCj40lECaVaJecBPrQ2s6+LiOF2jj+wyh5XldjiHmLc6Me5HL+/xKOJuu6pMsv Xj9Pds4JplGgDqC9Sug40PGEUdTWq5R530e4A3jNJSuwWHYwXH/HzY2075vjOKr0Z/Hd adbV3R5cTNayh2GgtNlkmYQeujvEuVgk+mYv0qD7AlwLXw3qvWuPDtkJCAnHcXPtlVLW zX8YRFbs9i1YORppcC4mTdnrItUbAiVrfIbBvMxKo093td+EwJ5MsWIWk81FkYK5K9ZY W4lQ== X-Gm-Message-State: AHPjjUjN2Euwoxk177K7OaoN6+cuDvfTXA3vxid1VaYKM1MBa4QvGsXi mcovJZbMvfA4jHYh X-Google-Smtp-Source: ADKCNb6dNaahzCzRB5VMfu3su3zTcDvIyRdG2i/Wpo3rM+SsNSUuB93zYLzPx3REr/CyE3wN2+Oabg== X-Received: by 10.36.138.69 with SMTP id v66mr7124700itd.106.1504518570979; Mon, 04 Sep 2017 02:49:30 -0700 (PDT) Received: from [192.168.1.12] ([180.158.103.16]) by smtp.googlemail.com with ESMTPSA id d69sm104425itc.18.2017.09.04.02.49.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 02:49:30 -0700 (PDT) From: yorwba Message-ID: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> Date: Mon, 4 Sep 2017 17:49:25 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Mailman-Approved-At: Mon, 04 Sep 2017 11:13:43 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) 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)) From unknown Fri Aug 15 19:35:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Sep 2017 15:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: yorwba Cc: 28346@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 28346-submit@debbugs.gnu.org id=B28346.150453915322441 (code B ref 28346); Mon, 04 Sep 2017 15:33:01 +0000 Received: (at 28346) by debbugs.gnu.org; 4 Sep 2017 15:32:33 +0000 Received: from localhost ([127.0.0.1]:49065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dotMX-0005pt-2B for submit@debbugs.gnu.org; Mon, 04 Sep 2017 11:32:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dotMV-0005pg-Vq for 28346@debbugs.gnu.org; Mon, 04 Sep 2017 11:32:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dotMM-0001j5-2l for 28346@debbugs.gnu.org; Mon, 04 Sep 2017 11:32:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dotML-0001iz-VL; Mon, 04 Sep 2017 11:32:22 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2863 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dotML-0000fb-C3; Mon, 04 Sep 2017 11:32:21 -0400 Date: Mon, 04 Sep 2017 18:32:19 +0300 Message-Id: <83efrm32f0.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> (message from yorwba on Mon, 4 Sep 2017 17:49:25 +0800) References: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: yorwba > 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. From unknown Fri Aug 15 19:35:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: yorwba Subject: bug#28346: closed (Re: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin) Message-ID: References: <83d17631rz.fsf@gnu.org> <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> X-Gnu-PR-Message: they-closed 28346 X-Gnu-PR-Package: emacs Reply-To: 28346@debbugs.gnu.org Date: Mon, 04 Sep 2017 15:47:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1504540022-23850-1" This is a multi-part message in MIME format... ------------=_1504540022-23850-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #28346: 24.5; Emacs hangs when terminal becomes smaller than set margin which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 28346@debbugs.gnu.org. --=20 28346: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28346 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1504540022-23850-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 28346-done) by debbugs.gnu.org; 4 Sep 2017 15:46:22 +0000 Received: from localhost ([127.0.0.1]:49081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dotZu-0006Bh-9M for submit@debbugs.gnu.org; Mon, 04 Sep 2017 11:46:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dotZs-0006BT-R7 for 28346-done@debbugs.gnu.org; Mon, 04 Sep 2017 11:46:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dotZj-0002hd-3N for 28346-done@debbugs.gnu.org; Mon, 04 Sep 2017 11:46:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dotZi-0002hZ-W3; Mon, 04 Sep 2017 11:46:11 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2873 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dotZi-0001Yd-CW; Mon, 04 Sep 2017 11:46:10 -0400 Date: Mon, 04 Sep 2017 18:46:08 +0300 Message-Id: <83d17631rz.fsf@gnu.org> From: Eli Zaretskii To: yorwba In-reply-to: <5211a085-f1ea-5aeb-21e0-1a4143d5ebaf@gmail.com> (message from yorwba on Mon, 4 Sep 2017 23:43:23 +0800) Subject: Re: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin References: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> <83efrm32f0.fsf@gnu.org> <5211a085-f1ea-5aeb-21e0-1a4143d5ebaf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 28346-done Cc: 28346-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: yorwba > 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=, dy@entry=19) at xdisp.c:9563 > target_y = 20 > y0 = > y1 = > line_height = 1 > nlines = > h = > 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. ------------=_1504540022-23850-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Sep 2017 15:13:45 +0000 Received: from localhost ([127.0.0.1]:49037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dot4K-0005KK-SU for submit@debbugs.gnu.org; Mon, 04 Sep 2017 11:13:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doo0z-00023H-4M for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0n-0002CE-V5 for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1doo0n-0002Bu-Rr for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doo0i-0004jW-58 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0c-00023I-M7 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:40 -0400 Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]:36335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1doo0c-00020z-GB for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:34 -0400 Received: by mail-it0-x22c.google.com with SMTP id j17so912955iti.1 for ; Mon, 04 Sep 2017 02:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=pllL7LIXoSY+0ascVvvumVK7ciwwdcm4ugU35k5IuHFNTnDfMY2Woo8sNJIDDf/uGc ZFoR/TS1WkdgN4+KH6Svn3Fm6n0AywS74mrZ66V3MA3ydfOHxfXY7RfM1MzlwKUK5dXG N5SX2w2p2pQRKVjE9f71hGRjzaOXEjiuFYY1a+A+LzcZczIsPsUD4w0EU2bvq+s+q+R8 u0JVXr8Ha4vVsd5Y7GkpqyLAKuPXoWR4WIO3PpmiPymlrOUK3uE8YgFSVgkfxYFQa0td jQBD/sLPuJp6MGkYIbwIsh3+q2N/KzOrcC6q2bs6oS9Untv6Y/z4eaToEmwR0DG7TE2y OSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=iOaEHcagAQ4zsMHOTx/tzrnqBBdTyY0i+SY+g1we39e+k7pw2ItgSoPqniXsuCK4ox RNRndtsCj40lECaVaJecBPrQ2s6+LiOF2jj+wyh5XldjiHmLc6Me5HL+/xKOJuu6pMsv Xj9Pds4JplGgDqC9Sug40PGEUdTWq5R530e4A3jNJSuwWHYwXH/HzY2075vjOKr0Z/Hd adbV3R5cTNayh2GgtNlkmYQeujvEuVgk+mYv0qD7AlwLXw3qvWuPDtkJCAnHcXPtlVLW zX8YRFbs9i1YORppcC4mTdnrItUbAiVrfIbBvMxKo093td+EwJ5MsWIWk81FkYK5K9ZY W4lQ== X-Gm-Message-State: AHPjjUjN2Euwoxk177K7OaoN6+cuDvfTXA3vxid1VaYKM1MBa4QvGsXi mcovJZbMvfA4jHYh X-Google-Smtp-Source: ADKCNb6dNaahzCzRB5VMfu3su3zTcDvIyRdG2i/Wpo3rM+SsNSUuB93zYLzPx3REr/CyE3wN2+Oabg== X-Received: by 10.36.138.69 with SMTP id v66mr7124700itd.106.1504518570979; Mon, 04 Sep 2017 02:49:30 -0700 (PDT) Received: from [192.168.1.12] ([180.158.103.16]) by smtp.googlemail.com with ESMTPSA id d69sm104425itc.18.2017.09.04.02.49.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 02:49:30 -0700 (PDT) From: yorwba Subject: 24.5; Emacs hangs when terminal becomes smaller than set margin To: bug-gnu-emacs@gnu.org Message-ID: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> Date: Mon, 4 Sep 2017 17:49:25 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 04 Sep 2017 11:13:43 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) 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)) ------------=_1504540022-23850-1--