Subject: 29.0.60; Fatal error accurred when editing init.el with flymake enabled on Windows 10
From: Eason Huang <[email-masked]>
To: [email-masked]
Date: Wed, 04 Jan 2023 22:44:22 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi emacs,

When I editing my ~/.config/emacs/init.el file, Emacs will raise a fatal
error frequenly when flymake-mode enabled.

With a few hours debug, I found that it's related to flymake-mode and
Borg( A package manager writed by Jonas Bernoulli).

Borg repos: https://github.com/emacscollective/borg

This issue can be fixed by disable flymake-mode or without Borg, just
use package.el to install packages.

It would be nice if I can use Borg with flymake-mode. I am not sure this
bug if from Borg or flymake-mode or Emacs itself, so I report it here.

Steps to reproduce:

1. Make sure you have Emacs 29 installed, I build it from emacs-29
branch:

https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=2569ede9c496bb060e0b88428cb541088aaba1f9

2. Install Borg by the emacs.g seed
```
git clone [email-masked]:emacscollective/emacs.g.git ~/.config/emacs
cd ~/.config/emacs
make bootstrap-borg
make bootstrap
```
By default, It use ssh, if you want to use https, you can configure like
this:
```
git config --global url.https://github.com/.insteadOf [email-masked]:
git config --global url.https://git.sr.ht/.insteadOf [email-masked]:
```

3. Start Emacs and open the ~/.config/emacs/init.el file
```
C-x, C-f ~/.config/emacs/init.el
```
4. Enable flymake-mode by M-x, flymake-mode
5. Add some new blank line in the init.el buffer and then save the
buffer with C-x, C-s

6. Now you will see the fatal error popup window with below message:

Emacs Abort Dialog
A fatal error has occurred!
Would you like to attach a debugger?

Select:
YES -- to debug Emacs, or
NO -- to abort Emacs and produce a backtrace
      (emacs backtracetxt in current directory).
(type "gdb -p <emacs-PID>" and
"continue" inside GDB before clicking YES.)

7. I follow the error message to use GDB debug and got the infomation as
below, maybe it can help you to find the bug:

➜ ~  ps -name emacs

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
     62    81.07      92.62       9.23    7544   1 emacs

➜ ~  mingw

Aqua@DESKTOP-CIHAF12 MINGW64 ~
$ gdb -p 7544
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 7544
[New Thread 7544.0x3c50]
[New Thread 7544.0x49bc]
[New Thread 7544.0x1e94]
[New Thread 7544.0x3f3c]
[New Thread 7544.0x4370]
Reading symbols from C:\opt\emacs\bin\emacs.exe...
(gdb) c
Continuing.
[Thread 7544.0x4370 exited with code 0]
[New Thread 7544.0x1b60]
[New Thread 7544.0x2edc]
[New Thread 7544.0x4d6c]
[New Thread 7544.0x4474]
[Thread 7544.0x2edc exited with code 0]
[Thread 7544.0x1b60 exited with code 0]
[New Thread 7544.0x39fc]
[New Thread 7544.0x3a9c]
[Thread 7544.0x4474 exited with code 0]
[Thread 7544.0x4d6c exited with code 0]
[New Thread 7544.0x2050]
[New Thread 7544.0x4da8]
[Thread 7544.0x3a9c exited with code 0]
[Thread 7544.0x39fc exited with code 0]
[Thread 7544.0x4da8 exited with code 0]
[Thread 7544.0x2050 exited with code 0]
[New Thread 7544.0x42f4]
[New Thread 7544.0xc9c]
[New Thread 7544.0x1a70]
[Thread 7544.0x1a70 exited with code 1]
[New Thread 7544.0x462c]
[Thread 7544.0x462c exited with code 1]
[New Thread 7544.0x3198]
[Thread 7544.0x3198 exited with code 1]
[New Thread 7544.0x53b4]
[New Thread 7544.0x256c]
[New Thread 7544.0x304]
[New Thread 7544.0x10a4]
[Thread 7544.0x256c exited with code 0]
[Thread 7544.0x53b4 exited with code 0]
[New Thread 7544.0x4c3c]
[Thread 7544.0x4c3c exited with code 1]
[New Thread 7544.0x874]
[Thread 7544.0x874 exited with code 1]
[New Thread 7544.0x4964]
[Thread 7544.0x4964 exited with code 1]
[New Thread 7544.0x2328]
[New Thread 7544.0x3a0c]
[Thread 7544.0x10a4 exited with code 0]
[Thread 7544.0x304 exited with code 0]
[Thread 7544.0xc9c exited with code 0]
[Thread 7544.0x42f4 exited with code 0]
[New Thread 7544.0x5d8]
[New Thread 7544.0x1d30]
[Thread 7544.0x3a0c exited with code 0]
[Thread 7544.0x2328 exited with code 0]
[Thread 7544.0x1d30 exited with code 0]
[Thread 7544.0x5d8 exited with code 0]
[New Thread 7544.0x46e4]
[New Thread 7544.0x43ec]
[New Thread 7544.0x2594]
[Thread 7544.0x2594 exited with code 1]
[New Thread 7544.0x630]
[Thread 7544.0x630 exited with code 1]
[New Thread 7544.0x399c]
[Thread 7544.0x399c exited with code 1]
[New Thread 7544.0x3f80]
[New Thread 7544.0x4324]
[Thread 7544.0x4324 exited with code 0]
[Thread 7544.0x3f80 exited with code 0]
[Thread 7544.0x43ec exited with code 0]
[Thread 7544.0x46e4 exited with code 0]
[New Thread 7544.0x35fc]
[New Thread 7544.0x256c]
[New Thread 7544.0x2050]
[New Thread 7544.0xc9c]
[Thread 7544.0x256c exited with code 0]
[Thread 7544.0x35fc exited with code 0]
[New Thread 7544.0x3368]
[New Thread 7544.0x4178]
[Thread 7544.0x4178 exited with code 0]
[Thread 7544.0x3368 exited with code 0]
[Thread 7544.0xc9c exited with code 0]
[Thread 7544.0x2050 exited with code 0]
[New Thread 7544.0x32a0]

Thread 44 received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 7544.0x32a0]
0x00007fff84fd0bb1 in ntdll!DbgBreakPoint () from C:\Windows\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x00007fff84fd0bb1 in ntdll!DbgBreakPoint () from C:\Windows\SYSTEM32\ntdll.dll
#1  0x00007fff84ffcc2e in ntdll!DbgUiRemoteBreakin () from C:\Windows\SYSTEM32\ntdll.dll
#2  0x00007fff84947614 in KERNEL32!BaseThreadInitThunk () from C:\Windows\System32\kernel32.dll
#3  0x00007fff84f826a1 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
#4  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) q
A debugging session is active.

        Inferior 1 [process 7544] will be detached.

Quit anyway? (y or n) y
Detaching from program: C:\opt\emacs\bin\emacs.exe, process 7544
[Inferior 1 (process 7544) detached]

In GNU Emacs 29.0.60 (build 1, x86_64-w64-mingw32) of 2023-01-02 built
 on DESKTOP-CIHAF12
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.2364)

Configured using:
 'configure --with-native-compilation=aot --without-dbus'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LANG: CHS
  locale-coding-system: cp936

Major mode: ELisp/l

Minor modes in effect:
  flymake-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  outline-minor-mode: t
  reveal-mode: t
  save-place-mode: t
  savehist-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  global-dash-fontify-mode: t
  dash-fontify-mode: t
  override-global-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  auto-compile-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t

Load-path shadows:
c:/Users/Aqua/.config/emacs/lib/transient/lisp/transient hides c:/opt/emacs/share/emacs/29.0.60/lisp/transient
c:/Users/Aqua/.config/emacs/lib/use-package/use-package hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-lint hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-lint
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-jump hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-jump
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-ensure hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-ensure
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-ensure-system-package hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-ensure-system-package
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-diminish hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-diminish
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-delight hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-delight
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-core hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-core
c:/Users/Aqua/.config/emacs/lib/use-package/use-package-bind-key hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/use-package-bind-key
c:/Users/Aqua/.config/emacs/lib/use-package/bind-key hides c:/opt/emacs/share/emacs/29.0.60/lisp/use-package/bind-key

Features:
(shadow sort mail-extr emacsbug face-remap checkdoc flymake-proc flymake
project thingatpt tramp-sh tramp tramp-loaddefs trampver
tramp-integration cus-edit pp cus-start cus-load files-x tramp-compat
parse-time iso8601 man magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-handlers url-parse auth-source url-vars
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit message sendmail mailcap yank-media
puny rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor shell pcomplete magit-mode transient edmacro kmacro
magit-git magit-base magit-section format-spec crm compat-27 dired
dired-loaddefs server epkg-elpa json map epkg-utils epkg-list epkg-desc
find-func epkg emacsql-sqlite-builtin sqlite closql emacsql-sqlite
advice emacsql emacsql-compiler llama compat-26 compile
text-property-search comint ansi-osc ansi-color ring vc-git noutline
outline reveal saveplace savehist recentf tree-widget wid-edit diff-hl
log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode eieio byte-opt
eieio-core dash use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core with-editor-autoloads use-package-autoloads
treepy-autoloads transient-autoloads magit-autoloads llama-autoloads
git-modes-autoloads epkg-autoloads emacsql-autoloads diff-hl-autoloads
dash-autoloads compat-autoloads closql-autoloads borg-autoloads
auto-compile-autoloads borg loaddefs-gen generate-lisp-file lisp-mnt
radix-tree pcase info jka-compr auto-compile comp comp-cstr warnings
icons subr-x rx cl-seq cl-macs gv cl-extra help-mode compat compat-macs
cl-loaddefs cl-lib bytecomp byte-compile china-util rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 296963 51271)
 (symbols 48 22365 4)
 (strings 32 77770 4132)
 (string-bytes 1 2727040)
 (vectors 16 52699)
 (vector-slots 8 1065938 75872)
 (floats 8 124 323)
 (intervals 56 3575 0)
 (buffers 984 20))

-- 
Eason Huang