Subject: Re: bug#70760: 29.3.50; core dumps when copy in other apps

From: Eli Zaretskii <[email-masked]>
Date: Tue, 14 May 2024 10:13:17 +0300

> From: Kun Liu <[email-masked]>
> Date: Mon, 13 May 2024 23:17:16 -0700
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> I tried various things including upgrading the guest Linux to Debian 12, and trying master vs 29 branches. Still
> seeing crashes.
> 
> Today I tried configure emacs 29 without "--with-native-compilation". It appears that core dump is no longer
> happening. Now when I copy on the host, I see the following message in Emacs:
> 
> dbus-check-event: D-Bus error: "Not a valid D-Bus event", (dbus-event 10 14)
> 
> Backtrace buffer shows the following:
> 
> Debugger entered--Lisp error: (dbus-error "Not a valid D-Bus event" (dbus-event 10 14))
>   signal(dbus-error ("Not a valid D-Bus event" (dbus-event 10 14)))
>   dbus-check-event((dbus-event 10 14))
>   dbus-event-bus-name((dbus-event 10 14))
>   dbus-notice-synchronous-call-errors((dbus-event 10 14) (dbus-error "Not a valid D-Bus event" (dbus-event 10
> 14)))
>   run-hook-with-args(dbus-notice-synchronous-call-errors (dbus-event 10 14) (dbus-error "Not a valid D-Bus
> event" (dbus-event 10 14)))
>   dbus-handle-event((dbus-event 10 14))
>   funcall-interactively(dbus-handle-event (dbus-event 10 14))
>   call-interactively(dbus-handle-event nil [(dbus-event 10 14)])
>   command-execute(dbus-handle-event nil [(dbus-event 10 14)] t)

We have already established that some invalid D-Bus events cause these
problems.  What we need now is to find out what kind of D-Bus events
are those, and what does VirtualBox mean to happen when it emits these
D-Bus events?

Looking at dbus-check-event, I see that event of the form

  (dbus-event 10 14)

is invalid because the first member of the list after 'dbus-event'
should be either a keyword (a symbol, AFAIU) or a string, but here we
have a number.

The event

  (dbus-event "[ \11]*$")

from your previous message is also invalid, since it has only one
member after 'dbus-event'.

IOW, VirtualBox is emitting invalid D-Bus events, at least as far as
our support for D-Bus is concerned.

Michael, are these events invalid according to the D-Bus spec, or we
just lack support for them in Emacs?  If the former, I don't see how
this can be an Emacs problem; you should ask the VirtualBox folks what
to do to avoid this.

Maybe we can make Emacs more tolerant to these issues, e.g., make the
error a warning or a message?

Reading the VirtualBox documentation I find on the net, I see that
this page:

  https://www.virtualbox.org/manual/ch04.html#guestadd-dnd

says you need to install "the latest version of the Guest Additions".
Since copy/paste is a variant of drag-and-drop, perhaps this is
relevant for your case as well, I don't know.  See also

  https://www.virtualbox.org/manual/ch04.html#guestadd-dnd-limitations

The following pages might also be relevant:

  https://www.virtualbox.org/manual/ch12.html#ts_linux-guest-x11-services
  https://www.virtualbox.org/manual/ch12.html#ts_win-dnd-uipi

All in all, I feel like this is not an Emacs issue at all, and should
not be brought to us.