GNU bug report logs - #51007
27.2; emacs hangs when using window-toggle-side-windows

Previous Next

Package: emacs;

Reported by: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>

Date: Mon, 4 Oct 2021 13:37:02 UTC

Severity: normal

Found in version 27.2

Fixed in version 28.1

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51007 in the body.
You can then email your comments to 51007 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Mon, 04 Oct 2021 13:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Oct 2021 13:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2; emacs hangs when using window-toggle-side-windows
Date: Mon, 4 Oct 2021 19:06:12 +0530
[Message part 1 (text/plain, inline)]
1. start vanila, emacs session.
2. add following configuration.
(setq debug-on-quit 1)
(setq display-buffer-alist
       '(
         ("\\*\\(Async Shell Command\\|Shell Command Output\\)\\*"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (window-width . 0.40)
         (side . right)
         (slot . 0))
         ("\\*Shell\\*"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (window-width . 0.40)
         (side . top)
         (slot . 0))
        )
       )

3. split the window horizontally `C-x 3`
4. start a shell `M-x shell RET`
5. Run a async shell `M-x async-command-shell ls RET`
6. Run `M-x window-toggle-side-windows RET` the session stalls nothing works.

- C-g does not help in this case.
- C-x C-z does not help.
- C-x C-c does not help.


In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
of 2021-03-28 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.6

Recent messages:


Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: en_IN.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org

Minor modes in effect:
  global-company-mode: t
  company-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  shell-dirtrack-mode: t
  ivy-mode: t
  which-key-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  override-global-mode: t
  recentf-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:


Features:
(shadow sort mail-extr emacsbug sendmail markdown-mode tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat
org-colview org-archive swiper tabify org-capture org-duration sh-script
smie executable rx bookmark pp cal-move diary-lib diary-loaddefs cal-iso
org-element avl-tree ol-eww eww mm-url url-queue ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnir gnus-sum shr svg dom gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message rfc822 mml
mml-sec epa derived epg epg-config mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util rmail rmail-loaddefs
text-property-search ol-docview doc-view jka-compr image-mode exif dired
dired-loaddefs ol-bibtex bibtex ol-bbdb ol-w3m face-remap org-agenda
org-refile disp-table tsdh-light-theme company-oddmuse company-keywords
company-etags company-gtags company-dabbrev-code company-dabbrev
company-files company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-bbdb company
pcase helpful imenu trace edebug backtrace info-look f dash-functional
help-fns radix-tree elisp-refs s loop evil evil-keybindings
evil-integration undo-tree diff evil-maps evil-commands reveal flyspell
ispell evil-jumps evil-command-window evil-types evil-search evil-ex
shell evil-macros evil-repeat evil-states evil-core evil-common windmove
rect evil-digraphs evil-vars go-mode find-file ffap thingatpt etags
fileloop generator xref project compile ivy delsel ivy-faces ivy-overlay
colir color restart-emacs which-key org-jira org-jira-sdk jiralib
request autorevert filenotify mail-utils soap-client mm-decode mm-bodies
mm-encode url-http url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny warnings rng-xsd rng-dt
rng-util xsd-regexp xml dash ls-lisp org-clock org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete comint ansi-color org-list org-faces
org-entities time-date noutline outline org-version ob-emacs-lisp
ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
advice find-func cal-menu calendar cal-loaddefs diminish
page-break-lines hackernews url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
format-spec cus-edit cus-start cus-load use-package use-package-delight
use-package-diminish edmacro kmacro use-package-bind-key bind-key
easy-mmode recentf tree-widget wid-edit modus-themes hydra ring lv
cl-extra help-mode use-package-ensure use-package-core finder-inf info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded 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
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 491087 55526)
(symbols 48 39800 2)
(strings 32 142076 4678)
(string-bytes 1 4451885)
(vectors 16 60803)
(vector-slots 8 1081859 88134)
(floats 8 523 471)
(intervals 56 5270 1535)
(buffers 1000 29))
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Mon, 04 Oct 2021 18:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>,
 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Mon, 4 Oct 2021 20:22:42 +0200
> 1. start vanila, emacs session.
> 2. add following configuration.
> (setq debug-on-quit 1)
> (setq display-buffer-alist
>         '(
>           ("\\*\\(Async Shell Command\\|Shell Command Output\\)\\*"
>           (display-buffer-reuse-window display-buffer-in-side-window)
>           (window-width . 0.40)
>           (side . right)
>           (slot . 0))
>           ("\\*Shell\\*"
>           (display-buffer-reuse-window display-buffer-in-side-window)
>           (window-width . 0.40)
>           (side . top)
>           (slot . 0))
>          )
>         )
>
> 3. split the window horizontally `C-x 3`
> 4. start a shell `M-x shell RET`
> 5. Run a async shell `M-x async-command-shell ls RET`
> 6. Run `M-x window-toggle-side-windows RET` the session stalls nothing works.
>
> - C-g does not help in this case.
> - C-x C-z does not help.
> - C-x C-c does not help.
>
>
> In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
> of 2021-03-28 built on builder10-14.porkrind.org
> Windowing system distributor 'Apple', version 10.3.2022
> System Description:  macOS 11.6

I can't try your recipe because `async-command-shell' isn't defined
here.  When I try with

(setq debug-on-quit 1)
(setq display-buffer-alist
       '(
         ("\\*Info\\*"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (window-width . 0.40)
         (side . right)
         (slot . 0))
         ("\\*Help\\*"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (window-height . 0.40)
         (side . top)
         (slot . 0))
        )
       )

everything works as expected so the problem seems that shell command
output wants to use the window used for ls, or vice-versa.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Tue, 05 Oct 2021 08:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Tue, 5 Oct 2021 10:09:20 +0200
> Sorry, I made a mistake while sending the report, I used a wrong version of emacs,
>
> This is observed only on emacs 27.1

I don't have Emacs 27.1 installed here.  But I tried with Emacs 27.2
plus the patch for Bug#50867 applied and yet don't see any problems.

> And the `async-command-shell` is typo it should have been, `async-shell-command`

I noted that meanwhile and already use your recipe.  I still think that
when you do that something goes awry that is not related to toggling but
maybe to shell output.  Could you try with the *Help*/*Info* example I
posted earlier to exclude that possibility?

But maybe also 'window--sides-reverse-frame' is the culprit.  So could
you try with the call of 'window--sides-reverse-frame' removed from
'window-toggle-side-windows'?  I didn't give that much testing then.

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Tue, 05 Oct 2021 10:54:01 GMT) Full text and rfc822 format available.

Message #14 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Tue, 5 Oct 2021 16:23:26 +0530
[Message part 1 (text/plain, inline)]
Hi, I tried with following code, in scratch 

(defun window-toggle-side-windows (&optional frame)
  "Toggle display of side windows on specified FRAME.
FRAME must be a live frame and defaults to the selected one.

If FRAME has at least one side window, delete all side
windows on FRAME after saving FRAME's state in the
FRAME's `window-state' frame parameter.  Otherwise,
restore any side windows recorded in FRAME's `window-state'
parameter, leaving FRAME's main window alone.  Signal an
error if FRAME has no side windows and no saved state for
it is found."
  (interactive)
  (let* ((frame (window-normalize-frame frame))
         (window--sides-inhibit-check t)
         state)
    (cond
     ((window-with-parameter 'window-side nil frame)
      ;; At least one side window exists.  Remove all side windows after
      ;; saving FRAME's state in its `window-state' parameter.
      (set-frame-parameter
       frame 'window-state (window-state-get (frame-root-window frame)))
      (let ((ignore-window-parameters t))
        (delete-other-windows (window-main-window frame))))
     ((setq state (frame-parameter frame 'window-state))
      ;; A window state was saved for FRAME.  Restore it and put the
      ;; current root window into its main window.
      (let ((window-combination-resize t)
            (main-state (window-state-get (frame-root-window frame))))
        (window-state-put state (frame-root-window frame) t)
        (window-state-put main-state (window-main-window frame)))
      (window--sides-reverse-frame frame))
     (t
      (error "No side windows state found")))))
(setq display-buffer-alist
      '(
        ("\\*Info\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-width . 0.40)
        (side . right)
        (slot . 0))
        ("\\*Help\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-height . 0.40)
        (side . top)
        (slot . 0))
       )
      )


And also without `window—-sides-reverse-frame`

(defun window-toggle-side-windows (&optional frame)
  "Toggle display of side windows on specified FRAME.
FRAME must be a live frame and defaults to the selected one.

If FRAME has at least one side window, delete all side
windows on FRAME after saving FRAME's state in the
FRAME's `window-state' frame parameter.  Otherwise,
restore any side windows recorded in FRAME's `window-state'
parameter, leaving FRAME's main window alone.  Signal an
error if FRAME has no side windows and no saved state for
it is found."
  (interactive)
  (let* ((frame (window-normalize-frame frame))
         (window--sides-inhibit-check t)
         state)
    (cond
     ((window-with-parameter 'window-side nil frame)
      ;; At least one side window exists.  Remove all side windows after
      ;; saving FRAME's state in its `window-state' parameter.
      (set-frame-parameter
       frame 'window-state (window-state-get (frame-root-window frame)))
      (let ((ignore-window-parameters t))
        (delete-other-windows (window-main-window frame))))
     ((setq state (frame-parameter frame 'window-state))
      ;; A window state was saved for FRAME.  Restore it and put the
      ;; current root window into its main window.
      (let ((window-combination-resize t)
            (main-state (window-state-get (frame-root-window frame))))
        (window-state-put state (frame-root-window frame) t)
        (window-state-put main-state (window-main-window frame)))
      )
     (t
      (error "No side windows state found")))))
(setq display-buffer-alist
      '(
        ("\\*Info\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-width . 0.40)
        (side . right)
        (slot . 0))
        ("\\*Help\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-height . 0.40)
        (side . top)
        (slot . 0))
       )
      )

In both cases, after doing following:

1. `C-x 3`
2. `C-h i`
3. `C-h m`
4. `M-x window-toggle-side-windows RET`

emacs still hangs.

Indrajeet.


> On 04-Oct-2021, at 11:52 PM, martin rudalics <rudalics <at> gmx.at> wrote:
> 
> (setq display-buffer-alist
>       '(
>         ("\\*Info\\*"
>         (display-buffer-reuse-window display-buffer-in-side-window)
>         (window-width . 0.40)
>         (side . right)
>         (slot . 0))
>         ("\\*Help\\*"
>         (display-buffer-reuse-window display-buffer-in-side-window)
>         (window-height . 0.40)
>         (side . top)
>         (slot . 0))
>        )
>       )

[Message part 2 (text/html, inline)]
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Tue, 05 Oct 2021 12:38:02 GMT) Full text and rfc822 format available.

Message #17 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
Cc: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Tue, 5 Oct 2021 14:37:09 +0200
> Hi, I tried with following code, in scratch
[...]
> In both cases, after doing following:
>
> 1. `C-x 3`
> 2. `C-h i`
> 3. `C-h m`
> 4. `M-x window-toggle-side-windows RET`
>
> emacs still hangs.

Both work here in Emacs 26 and 27 - with 'window-toggle-side-windows'
called twice.  Does yours really hang already in the first call?

Anyway, please with emacs -Q do C-x 5 2, C-u C-M-x in your version of
`window-toggle-side-windows' in *scratch* on the second frame and in the
first frame display *Messages* and then proceed as above, stepping
through that function with SPC.  This way we should be able to find out
where it hangs.  If you find the culprit, please edebug the function
where it hangs - originally I'd have suspected 'window-state-put' but if
it really hangs in the first call it would be 'window-state-get'.

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sat, 09 Oct 2021 18:59:01 GMT) Full text and rfc822 format available.

Message #20 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
Cc: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sat, 9 Oct 2021 20:57:52 +0200
> I made little progress with this, and here are few of my observations.
> 1. The bug is producible in non-gui, when starting emacs with `-nw`, even on emacs27.2
>     I am using the info and help buffers as side windows.

Very good.  Can you reproduce it with a GUI build too?  I still cannot
here.

> 2. I tried the stepping through process, it took me through following function calls
>     `window-toggle-side-windows`
>     `delete-other-windows`
>      in this function it takes me to
>     `delete-other-windows-internal`
>
>        ;; If WINDOW is the main window of its frame do nothing.
>        (if (eq window main)
>            ;; Give a message to the user if this has been called as a
>            ;; command.
>            (when (called-interactively-p 'interactive)
>              (message "No other windows to delete"))
> =>      (delete-other-windows-internal window main)
>          (window--check frame))
>
> And it stalls after this point, the `window` and `main` argument have non-nil values.

Here on the emacs-28 branch (with a non-optimized GTK build) I get an
assertion failure instead with the following backtrace:

#0  0x00000000005acb54 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at ../../src/emacs.c:400
#1  0x000000000065acc7 in die (msg=0x786590 "r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA] && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]", file=0x78629b "../../src/dispnew.c", line=1899) at ../../src/alloc.c:7478
#2  0x000000000041cfab in fake_current_matrices (window=XIL(0x2444a2d)) at ../../src/dispnew.c:1898
#3  0x000000000041ce37 in fake_current_matrices (window=XIL(0x252e995)) at ../../src/dispnew.c:1882
#4  0x000000000041d7ba in adjust_frame_glyphs_for_frame_redisplay (f=0x24447e8) at ../../src/dispnew.c:2111
#5  0x000000000041cd11 in adjust_frame_glyphs (f=0x24447e8) at ../../src/dispnew.c:1838
#6  0x00000000004d409c in Fdelete_other_windows_internal (window=XIL(0x252e995), root=XIL(0x242e1b5)) at ../../src/window.c:3427
#7  0x000000000069488b in funcall_subr (subr=0xc589a0 <Sdelete_other_windows_internal>, numargs=2, args=0x7ffcbd5c2870) at ../../src/eval.c:3103
#8  0x0000000000694324 in Ffuncall (nargs=3, args=0x7ffcbd5c2868) at ../../src/eval.c:3026
#9  0x00000000006eed2a in exec_byte_code (bytestr=XIL(0x7f23c134b2d4), vector=XIL(0x7f23c134b045), maxdepth=make_fixnum(11), args_template=make_fixnum(512), nargs=1, args=0x7ffcbd5c2de8) at ../../src/bytecode.c:632
#10 0x0000000000694aec in fetch_and_exec_byte_code (fun=XIL(0x7f23c134afed), syms_left=make_fixnum(512), nargs=1, args=0x7ffcbd5c2de0) at ../../src/eval.c:3150
#11 0x0000000000694f72 in funcall_lambda (fun=XIL(0x7f23c134afed), nargs=1, arg_vector=0x7ffcbd5c2de0) at ../../src/eval.c:3231
#12 0x0000000000694c96 in apply_lambda (fun=XIL(0x7f23c134afed), args=XIL(0x254a5b3), count=18) at ../../src/eval.c:3175
#13 0x0000000000692dbd in eval_sub (form=XIL(0x254a583)) at ../../src/eval.c:2548
#14 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#15 0x000000000068ebce in Flet (args=XIL(0x254a573)) at ../../src/eval.c:1054
#16 0x00000000006927c2 in eval_sub (form=XIL(0x254a533)) at ../../src/eval.c:2454
#17 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#18 0x000000000068c964 in Fcond (args=XIL(0x254a5e3)) at ../../src/eval.c:448
#19 0x00000000006927c2 in eval_sub (form=XIL(0x254a403)) at ../../src/eval.c:2454
#20 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#21 0x000000000068e6bb in FletX (args=XIL(0x254abd3)) at ../../src/eval.c:986
#22 0x00000000006927c2 in eval_sub (form=XIL(0x254ab33)) at ../../src/eval.c:2454
#23 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#24 0x000000000069547b in funcall_lambda (fun=XIL(0x254a1a3), nargs=0, arg_vector=0x0) at ../../src/eval.c:3306
#25 0x000000000069448b in Ffuncall (nargs=1, args=0x7ffcbd5c3878) at ../../src/eval.c:3042
#26 0x0000000000688029 in Ffuncall_interactively (nargs=1, args=0x7ffcbd5c3878) at ../../src/callint.c:260
#27 0x000000000069475e in funcall_subr (subr=0xc63f20 <Sfuncall_interactively>, numargs=1, args=0x7ffcbd5c3878) at ../../src/eval.c:3081
#28 0x0000000000694324 in Ffuncall (nargs=2, args=0x7ffcbd5c3870) at ../../src/eval.c:3026
#29 0x0000000000693112 in Fapply (nargs=3, args=0x7ffcbd5c3870) at ../../src/eval.c:2609
#30 0x00000000006884b1 in Fcall_interactively (function=XIL(0x7f23c09fcab8), record_flag=XIL(0), keys=XIL(0x7f23c18b69f5)) at ../../src/callint.c:353
#31 0x00000000006948b7 in funcall_subr (subr=0xc63f60 <Scall_interactively>, numargs=3, args=0x7ffcbd5c3b30) at ../../src/eval.c:3106
#32 0x0000000000694324 in Ffuncall (nargs=4, args=0x7ffcbd5c3b28) at ../../src/eval.c:3026
#33 0x00000000006eed2a in exec_byte_code (bytestr=XIL(0x7f23c129fd0c), vector=XIL(0x7f23c129f975), maxdepth=make_fixnum(13), args_template=make_fixnum(1025), nargs=1, args=0x7ffcbd5c40a0) at ../../src/bytecode.c:632
#34 0x0000000000694aec in fetch_and_exec_byte_code (fun=XIL(0x7f23c129f945), syms_left=make_fixnum(1025), nargs=1, args=0x7ffcbd5c4098) at ../../src/eval.c:3150
#35 0x0000000000694f72 in funcall_lambda (fun=XIL(0x7f23c129f945), nargs=1, arg_vector=0x7ffcbd5c4098) at ../../src/eval.c:3231
#36 0x0000000000694378 in Ffuncall (nargs=2, args=0x7ffcbd5c4090) at ../../src/eval.c:3030
#37 0x0000000000693c41 in call1 (fn=XIL(0x43e0), arg1=XIL(0x7f23c09fcab8)) at ../../src/eval.c:2886
#38 0x00000000005b5298 in command_loop_1 () at ../../src/keyboard.c:1505
#39 0x000000000068fdd6 in internal_condition_case (bfun=0x5b4a3f <command_loop_1>, handlers=XIL(0x90), hfun=0x5b3ec1 <cmd_error>) at ../../src/eval.c:1453
#40 0x00000000005b4624 in command_loop_2 (handlers=XIL(0x90)) at ../../src/keyboard.c:1133
#41 0x000000000068f05b in internal_catch (tag=XIL(0xe370), func=0x5b45fd <command_loop_2>, arg=XIL(0x90)) at ../../src/eval.c:1184
#42 0x00000000005b45c8 in command_loop () at ../../src/keyboard.c:1111
#43 0x00000000005b398c in recursive_edit_1 () at ../../src/keyboard.c:720
#44 0x00000000005b3ba0 in Frecursive_edit () at ../../src/keyboard.c:803
#45 0x00000000005afa5b in main (argc=5, argv=0x7ffcbd5c45a8) at ../../src/emacs.c:2310

Lisp Backtrace:
"delete-other-windows-internal" (0xbd5c2870)
"delete-other-windows" (0xbd5c2de0)
"let" (0xbd5c3100)
"cond" (0xbd5c3290)
"let*" (0xbd5c3450)
"window-toggle-side-windows" (0xbd5c3880)
"funcall-interactively" (0xbd5c3878)
"call-interactively" (0xbd5c3b30)
"command-execute" (0xbd5c4098)


I'll try to look into what goes wrong here as soon as I understand what
that assertion really means.  I suppose yours is an optimized build so
the assertion won't trigger.

Please make sure to always CC to 51007 <at> debbugs.gnu.org.

Many thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 06:21:01 GMT) Full text and rfc822 format available.

Message #23 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 09:20:01 +0300
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sat, 9 Oct 2021 20:57:52 +0200
> Cc: 51007 <at> debbugs.gnu.org
> 
> #0  0x00000000005acb54 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at ../../src/emacs.c:400
> #1  0x000000000065acc7 in die (msg=0x786590 "r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA] && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]", file=0x78629b "../../src/dispnew.c", line=1899) at ../../src/alloc.c:7478
> #2  0x000000000041cfab in fake_current_matrices (window=XIL(0x2444a2d)) at ../../src/dispnew.c:1898
> #3  0x000000000041ce37 in fake_current_matrices (window=XIL(0x252e995)) at ../../src/dispnew.c:1882
> #4  0x000000000041d7ba in adjust_frame_glyphs_for_frame_redisplay (f=0x24447e8) at ../../src/dispnew.c:2111
> #5  0x000000000041cd11 in adjust_frame_glyphs (f=0x24447e8) at ../../src/dispnew.c:1838
> 
> I'll try to look into what goes wrong here as soon as I understand what
> that assertion really means.

It's a basic sanity check that makes sure the window you are deleting
indeed belongs to the frame you think it does.  Since on TTY frames
the window glyph matrices are actually portions of the frame glyph
matrix, this assertion makes sure the window's glyphs of a row are
completely enclosed in the corresponding frame's glyphs.

What are the actual values of the data in this assertion:

	      eassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA]
		       && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]);




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 08:59:02 GMT) Full text and rfc822 format available.

Message #26 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 10:58:12 +0200
> What are the actual values of the data in this assertion:
>
> 	      eassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA]
> 		       && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]);

How would I do that?  These are structures like

(gdb) p r->glyphs[TEXT_AREA]
$1 = (struct glyph *) 0xe2df90
(gdb) p fr->glyphs[TEXT_AREA]
$2 = (struct glyph *) 0xe36690

BTW, the bug is easily reproducible using the following scenario: With
a master emacs -Q in an -nw session I evaluate

(setq display-buffer-alist
      '(("\\*Info\\*" (display-buffer-in-side-window) (side . right))
        ("\\*Help\\*" (display-buffer-in-side-window) (side . top))))

If I then do

C-x 3
C-h m

and evaluate

(delete-other-windows (window-main-window))

I get the assertion violation.  If instead I do

C-x 3
C-h m
C-h i

and evaluate

(delete-other-windows (window-main-window))

Emacs hangs in redisplay.  And if instead I do

C-x 3
C-h i

and evaluate

(delete-other-windows (window-main-window))

Emacs behaves as expected.

I suppose 'delete-other-windows-internal' mangles the window dimensions
but the scenarios work on GUI frames and pass all internal checks here
so it will take me some time to sort this out ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 09:50:02 GMT) Full text and rfc822 format available.

Message #29 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 11:48:51 +0200
> I suppose 'delete-other-windows-internal' mangles the window dimensions
> but the scenarios work on GUI frames and pass all internal checks here
> so it will take me some time to sort this out ...

It indeed mangles the window dimensions in terms of lines and columns.
The Lisp routines to assign those run with a not yet updated window
tree.  So don't bother trying to reproduce it.

martin






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 10:57:02 GMT) Full text and rfc822 format available.

Message #32 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 13:55:53 +0300
> Cc: indrajeet.khandekar <at> taranawireless.com, 51007 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sun, 10 Oct 2021 10:58:12 +0200
> 
>  > What are the actual values of the data in this assertion:
>  >
>  > 	      eassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA]
>  > 		       && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]);
> 
> How would I do that?  These are structures like
> 
> (gdb) p r->glyphs[TEXT_AREA]
> $1 = (struct glyph *) 0xe2df90
> (gdb) p fr->glyphs[TEXT_AREA]
> $2 = (struct glyph *) 0xe36690

These are the values I meant: the above shows the window's glyph
matrix and the frame's glyph matrix are unrelated.  Not sure how that
happened; perhaps one of them was recently reallocated?

> BTW, the bug is easily reproducible using the following scenario: With
> a master emacs -Q in an -nw session I evaluate

So you want me to debug it?

> I suppose 'delete-other-windows-internal' mangles the window dimensions
> but the scenarios work on GUI frames and pass all internal checks here
> so it will take me some time to sort this out ...

On GUI frames, the window's glyph matrices are allocated separately
and there's no frame glyph matrix to begin with.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 12:32:02 GMT) Full text and rfc822 format available.

Message #35 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 14:31:06 +0200
>> How would I do that?  These are structures like
>>
>> (gdb) p r->glyphs[TEXT_AREA]
>> $1 = (struct glyph *) 0xe2df90
>> (gdb) p fr->glyphs[TEXT_AREA]
>> $2 = (struct glyph *) 0xe36690
>
> These are the values I meant: the above shows the window's glyph
> matrix and the frame's glyph matrix are unrelated.  Not sure how that
> happened; perhaps one of them was recently reallocated?

IIUC these are the beginning of the root's and the frame's text areas
where on TTYs the former must be embedded in the latter (1) when mapped
to the screen and (2) within the memory of my computer.  So if the root
matrix starts before the frame matrix in my memory I have a bug.  Is
that interpretation correct?

>> BTW, the bug is easily reproducible using the following scenario: With
>> a master emacs -Q in an -nw session I evaluate
>
> So you want me to debug it?

Don't bother.  The culprit sits in 'delete-other-windows-internal'.  I
apparently was just lucky that the assertion error triggered in one
scenario while in the other scenario Emacs somehow bypassed that check,
went into redisplay with bogus values and just got hung.

>> I suppose 'delete-other-windows-internal' mangles the window dimensions
>> but the scenarios work on GUI frames and pass all internal checks here
>> so it will take me some time to sort this out ...
>
> On GUI frames, the window's glyph matrices are allocated separately
> and there's no frame glyph matrix to begin with.

Which means that my first scenario cannot happen on GUIs.  I'm still
surprised that GUI frames apparently swallow quite a number of bogus
values without serious implications.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 13:11:02 GMT) Full text and rfc822 format available.

Message #38 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 51007 <at> debbugs.gnu.org, indrajeet.khandekar <at> taranawireless.com
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 16:09:58 +0300
> Cc: indrajeet.khandekar <at> taranawireless.com, 51007 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sun, 10 Oct 2021 14:31:06 +0200
> 
>  >> How would I do that?  These are structures like
>  >>
>  >> (gdb) p r->glyphs[TEXT_AREA]
>  >> $1 = (struct glyph *) 0xe2df90
>  >> (gdb) p fr->glyphs[TEXT_AREA]
>  >> $2 = (struct glyph *) 0xe36690
>  >
>  > These are the values I meant: the above shows the window's glyph
>  > matrix and the frame's glyph matrix are unrelated.  Not sure how that
>  > happened; perhaps one of them was recently reallocated?
> 
> IIUC these are the beginning of the root's and the frame's text areas
> where on TTYs the former must be embedded in the latter (1) when mapped
> to the screen and (2) within the memory of my computer.  So if the root
> matrix starts before the frame matrix in my memory I have a bug.  Is
> that interpretation correct?

Yes, AFAIU.
>  >> I suppose 'delete-other-windows-internal' mangles the window dimensions
>  >> but the scenarios work on GUI frames and pass all internal checks here
>  >> so it will take me some time to sort this out ...
>  >
>  > On GUI frames, the window's glyph matrices are allocated separately
>  > and there's no frame glyph matrix to begin with.
> 
> Which means that my first scenario cannot happen on GUIs.  I'm still
> surprised that GUI frames apparently swallow quite a number of bogus
> values without serious implications.

I think they just don't check, because there's no way of checking
that, unlike on TTY frames.  Glyph matrices of windows on GUI frames
are completely independent, and GUI frames don't have glyph matrices.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Sun, 10 Oct 2021 17:17:02 GMT) Full text and rfc822 format available.

Message #41 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
Cc: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Sun, 10 Oct 2021 19:16:38 +0200
[Message part 1 (text/plain, inline)]
Indrajeet

I think I have fixed this here.  Basically, the bug totally breaks the
behavior with -nw but only partially breaks the gui behavior.  In the
latter case, parts of the window structure are corrupted but apparently
these do not substantially inhibit working with Emacs here.  It's not
excluded though, that the NS port fails in the gui case as well.

I attach two fixes for this:

- window.c.diff is the one I intend to install on Emacs 28 soon.

- window-27.diff is one you can install for Emacs 27 provided you are
  able to build Emacs on your system.  It includes the window.el patch
  which is already on Emacs 28.  If you can't build Emacs yourself, I'm
  afraid you have to wait for the new release.

Good luck and many thanks for the forensics, martin
[window.c.diff (text/x-patch, attachment)]
[window-27.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51007; Package emacs. (Tue, 12 Oct 2021 08:12:03 GMT) Full text and rfc822 format available.

Message #44 received at 51007 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com>
Cc: 51007 <at> debbugs.gnu.org
Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows
Date: Tue, 12 Oct 2021 10:11:05 +0200
close 51007 28.1
quit

> I attach two fixes for this:
>
> - window.c.diff is the one I intend to install on Emacs 28 soon.

This has been installed on the release branch for Emacs 28.1.  Closing
this bug now; if there are any problems please reopen.

Thanks, martin




bug marked as fixed in version 28.1, send any further explanations to 51007 <at> debbugs.gnu.org and Indrajeet Khandekar <indrajeet.khandekar <at> taranawireless.com> Request was from martin rudalics <rudalics <at> gmx.at> to control <at> debbugs.gnu.org. (Tue, 12 Oct 2021 08:12:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 09 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.