Subject: bug#70073: 29.3; Emacs-PGTK crashes upon marking some text inside emacs and then middle clicking outside of Emacs

From: "Abraham S.A.H." <[email-masked]>
Date: Fri, 12 Apr 2024 11:54:50 +0200 (CEST)

Sorry for delay.

I got the opportunity to build Arch's `emacs-wayland` package myself, from the same PKGBUILD file used to build it in Arch's official repositories, including debug and without stripping anything. The result was about 30mg increase in size of the final built Emacs.  And the issue still persist.

GDB OUTPUT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ gdb emacs
GNU gdb (GDB) 14.2
Copyright (C) 2023 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-pc-linux-gnu".
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"...
Reading symbols from emacs...
(gdb) r -Q
Starting program: /usr/bin/emacs -Q
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffeda006c0 (LWP 7410)]
[New Thread 0x7fffed0006c0 (LWP 7411)]
[New Thread 0x7fffe7e006c0 (LWP 7412)]
[New Thread 0x7fffe74006c0 (LWP 7413)]
[New Thread 0x7fffe6a006c0 (LWP 7414)]
[New Thread 0x7fffe54006c0 (LWP 7415)]
[Detaching after vfork from child process 7435]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
pgtk_handle_selection_request (event=0x7fffffffbe80)
    at /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c:573
warning: 573    /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c: No such file or directory
(gdb) r -Q
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/emacs -Q
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffeda006c0 (LWP 7535)]
[New Thread 0x7fffed0006c0 (LWP 7536)]
[New Thread 0x7fffe7e006c0 (LWP 7537)]
[New Thread 0x7fffe74006c0 (LWP 7538)]
[New Thread 0x7fffe6a006c0 (LWP 7539)]
[New Thread 0x7fffe54006c0 (LWP 7540)]
[Detaching after vfork from child process 7541]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
pgtk_handle_selection_request (event=0x7fffffffbe80)
    at /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c:573
573     in /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

report-emacs-bug OUTPUT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.18.0)
System Description: Arch Linux

Configured using:
'configure --with-pgtk --with-native-compilation=aot --sysconfdir=/etc
--prefix=/usr --libexecdir=/usr/lib --with-tree-sitter
--localstatedir=/var --with-cairo --disable-build-details
--with-harfbuzz --with-libsystemd --with-modules 'CFLAGS=-march=native
-O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat
-Werror=format-security -fstack-clash-protection -fcf-protection -g
-ffile-prefix-map=/tmp/makepkg/emacs/src=/usr/src/debug/emacs
-flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
-Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs,-fuse-ld=mold
-flto=auto' 'CXXFLAGS=-march=native -O3 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g
-ffile-prefix-map=/tmp/makepkg/emacs/src=/usr/src/debug/emacs
-flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: en_GB.UTF-8
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: fa_IR.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_DK.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
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 dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 77550 5699)
(symbols 48 7115 0)
(strings 32 19768 2366)
(string-bytes 1 600069)
(vectors 16 15780)
(vector-slots 8 329652 14342)
(floats 8 28 46)
(intervals 56 276 0)
(buffers 984 12))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now that I got time to build it and can more responsively reply for anything needed about this issue.

BY THE WAY, checking arch-devel and arch-general mailing lists and also "issues" page of the emacs pacakge, it seems like no one else have this issue… kinda only happening to me!

During the time, I gave GTK+ and Lucid toolkits a try, and now I decided on staying with the lucid toolkit. Even switched my whole desktop, from Pure Wayland of Gnome, to Pure X11 of Xfce4.  

I think, I stay with it until using X is not practically possible.  Or when PGTK is recommended by you (Emacs-devs).

--
Best Regards,
Abraham
Sent with Tutanota; https://tuta.com