Subject: bug#51689: emacs

From: Han Boetes <[email-masked]>
Date: Fri, 19 Nov 2021 23:18:04 +0100

Another thing I noticed: if there is a valid ~/.config/emacs/init.el,
emacs -nw -Q works fine. If I mv ~/.config/emacs{,.bak} I see the
problem. I don't have a /etc/emacs folder either, so maybe that helps
you in reproducing the issue?

Eli Zaretskii wrote:
>   . emacs -Q -nw
>   . in *scratch* type "features" (without the quotes)
>   . go to the end of "features", after the final 's', and type C-j
>   . if the list Emacs inserts into the buffer has ellipsis in it, go
>     to that ellipsis and type RET
>   . post the resulting list here

This feature didn't do anything right after the start, but after closing
the *scratch* window, and then trying again in the new *scratch* I got:

features
(comp-cstr warnings rx cl-seq cl-macs cl-extra help-mode tool-bar seq gv subr-x byte-opt cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc paren electr\
ic uniquify ediff-hook vc-hooks lisp-float-type elisp-mode tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch\
 easymenu timer select mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-v\
iet 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 simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env co\
de-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind kqueue lcms2 multi-tty make-network-process native-compile emacs)

> I think at this point only running under a debugger will help us
> efficiently.  So please act according to the instructions below, and
> show the backtrace it produces:
> 
>   $ cd /path/to/emacs/src/
>   $ gdb ./emacs
>   GNU gdb (GDB) 11.1
>   Copyright (C) 2021 Free Software Foundation, Inc.
>   ...
>   (gdb) source ./.gdbinit
>   (gdb) break Fsignal
>   (gdb) commands
>   Type commands for breakpoint(s) 2, one per line.
>   End with a line saying just "end".
>   > pp error_symbol
>   > pp data
>   > end
>   (gdb) run -Q -nw
> 
> When the breakpoint breaks, look at the error_symbol and data printed
> by GDB; if the symbol are not "void-function", type "continue" at
> GDB's prompt to run Emacs further.  When you eventually get symbol as
> "void-function" and data that mentions regexp-opt-group, type:
> 
>   (gdb) thread apply all bt
> 
> This should produce both C-level backtrace and Lisp-level backtrace of
> all the threads in Emacs.  Please post that here in its entirety.

 /usr/pkgmk/work/emacs/src/emacs/src % egdb ./emacs
GNU gdb (GDB) 9.2
Copyright (C) 2020 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-unknown-openbsd7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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"...
Reading symbols from ./emacs...
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
Environment variable "DISPLAY" not defined.
TERM = screen-256color
Breakpoint 1 at 0x137c7f
.gdbinit:1239: Error in sourced command file:
No symbol "defined_HAVE_X_WINDOWS" in current context.
[snip: other instructions]
And after

    (gdb) run -Q -nw

I get: 

    Breakpoint 3, 0x00000d95326ee646 in Fsignal ()
    No symbol "error_symbol" in current context.

Also after each consecutive continue, until emacs starts normally,
without triggering the error.

So I think something is missing here. But what?

# Han