Subject: bug#37331: 27.0.50; segfault when starting from pdump and using dbus

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 11 Oct 2021 16:28:10 +0200

Leonard Lausen <[email-masked]> writes:

> Content of $HOME/debug-init.el
>
>   (require 'dbus)
>
> Dump
>
>   emacs --batch -Q -l $HOME/debug-init.el -eval '(dump-emacs-portable "/tmp/dmp")
>
> Load
>
>   emacs -Q -l $HOME/debug-init.el --dump-file=/tmp/dmp
>
> Execute
>
>   (require 'dbus)
>   (dbus-get-unique-name :system)
>
> Error
>
>   Debugger entered--Lisp error: (dbus-error "No connection to bus" :system)
>     dbus-get-unique-name(:system)
>     (progn (dbus-get-unique-name :system))
>     eval((progn (dbus-get-unique-name :system)) t)

I can reproduce this in Emacs 29, too.  This is because dbus.el
initialises the buses like this:

;; Initialize `:system' and `:session' buses.  This adds their file
;; descriptors to input_wait_mask, in order to detect incoming
;; messages immediately.
(when (featurep 'dbusbind)
  (dbus-ignore-errors
    (dbus-init-bus :system))
  (dbus-ignore-errors
    (dbus-init-bus :session)))

But this isn't run when dbus.el was present in Emacs when it was dumped,
so these inits have to be run in a different way.  I'm not sure where
init code like this is supposed to happen in a pdumped Emacs, though.
Anybody?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no