Subject: 24.1.50; Dbus hangs indefinitely during batch mode & daemon startup

From: "Ryan C. Thompson" <[email-masked]>
Date: Sat, 05 May 2012 14:54:15 -0700

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

It seems that during the startup of any emacs without a terminal
(i.e. "--batch" or "--daemon"), recent emacs snapshots cannot make dbus
calls. Worse, any attempt to make a dbus call will hang
indefinitely. This stops me from being able to use some of my config in
emacs, since it is dbus based and cannot be loaded on startup in daemon
mode.

Specifically, I can easily reproduce the bug like this:

emacs-snapshot -Q --batch -l dbus --eval '(message
  "DBus system names: %s"
  (dbus-call-method :system dbus-service-dbus
   dbus-path-dbus dbus-interface-dbus "ListNames"))'

Running the same command with emacs 23 works just fine:

emacs23 -Q --batch -l dbus --eval '(message
  "DBus system names: %s"
  (dbus-call-method :system dbus-service-dbus
   dbus-path-dbus dbus-interface-dbus "ListNames"))'

Running the same command *without* batch mode works just fine (I add the
extra kill-emacs eval so that you can run it from the command line
without having to close emacs afterward):

emacs-snapshot -Q -l dbus --eval '(message
  "DBus system names: %s"
  (dbus-call-method :system dbus-service-dbus
   dbus-path-dbus dbus-interface-dbus "ListNames"))' \
  --eval '(kill-emacs)'

Running the same command in daemon mode triggers the bug:

emacs-snapshot -Q --daemon -l dbus --eval '(message
  "DBus system names: %s"
  (dbus-call-method :system dbus-service-dbus
   dbus-path-dbus dbus-interface-dbus "ListNames"))'

However, starting the daemon and running the dbus call through
emacsclient works fine:

emacs-snapshot -Q --daemon -l dbus;
emacsclient --eval   '(message "DBus system names: %s"
   (dbus-call-method :system dbus-service-dbus
   dbus-path-dbus dbus-interface-dbus "ListNames"))';
# Clean up
emacsclient --eval '(kill-emacs)'

I am using the Emacs 23 from the Ubuntu 12.04 repos, and the
emacs-snapshot from this PPA:
https://launchpad.net/~cassou/+archive/emacs, which I believe is
generally built weekly. This started happening within the last month or
so (I'm not sure how far behind that PPA lags, so add some time on for
that as well).

There is no backtrace or anything, because the dbus call never
returns. It just hangs until I press Control+C. I am willing to try
fixes and debug things if people will tell me what to do.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
     `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.1.50/etc/DEBUG.

In GNU Emacs 24.1.50.1 (x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
  of 2012-05-02 on meitnerium, modified by Debian
  (emacs-snapshot package, version 2:20120502-1~ppa1~precise1)
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
Configured using:
  `configure '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu'
  '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
  '--localstatedir=/var' '--infodir=/usr/share/info'
  '--mandir=/usr/share/man' '--with-pop=yes'
  '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1.50/site-lisp:/usr/share/emacs/site-lisp'
  '--without-compress-info' '--with-crt-dir=/usr/lib/x86_64-linux-gnu/'
  '--with-x=yes' '--with-x-toolkit=lucid' 'build_alias=x86_64-linux-gnu'
  'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN
  -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed
  -znocombreloc' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-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
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/usr/share/emacs/24.1.50/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/24.1.50/site-lisp/flim/hex-util hides 
/usr/share/emacs/24.1.50/lisp/hex-util
/usr/share/emacs/24.1.50/site-lisp/flim/md4 hides 
/usr/share/emacs/24.1.50/lisp/md4
/usr/share/emacs/site-lisp/rst hides 
/usr/share/emacs/24.1.50/lisp/textmodes/rst
/usr/share/emacs/24.1.50/site-lisp/flim/ntlm hides 
/usr/share/emacs/24.1.50/lisp/net/ntlm
/usr/share/emacs/24.1.50/site-lisp/flim/sasl-ntlm hides 
/usr/share/emacs/24.1.50/lisp/net/sasl-ntlm
/usr/share/emacs/24.1.50/site-lisp/flim/sasl hides 
/usr/share/emacs/24.1.50/lisp/net/sasl
/usr/share/emacs/24.1.50/site-lisp/flim/sasl-digest hides 
/usr/share/emacs/24.1.50/lisp/net/sasl-digest
/usr/share/emacs/24.1.50/site-lisp/flim/sasl-cram hides 
/usr/share/emacs/24.1.50/lisp/net/sasl-cram
/usr/share/emacs/24.1.50/site-lisp/flim/hmac-def hides 
/usr/share/emacs/24.1.50/lisp/net/hmac-def
/usr/share/emacs/24.1.50/site-lisp/flim/hmac-md5 hides 
/usr/share/emacs/24.1.50/lisp/net/hmac-md5

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty emacs)