Harald Hanche-Olsen | 31 Jul 2012 16:49
Picon
Picon
Favicon
Gravatar

Emacs insists on starting dbus?

Short version: I built emacs with --without-dbus,
yet when I run emacs -Q, it runs dbus-launch.

Why? Surely, this is not the way it should be?

Slightly longer version: I am on Ubuntu, fresh emacs source from
trunk, and ./config.status -V outputs this:
emacs config.status 24.1.50
configured by ../configure, generated by GNU Autoconf 2.65,
  with options "'--without-dbus' '--prefix=/global/work/hanche/pkg/emacs/2012-07-31'
'--with-gif=no' '--with-x-toolkit=lucid'"
And here is what happens:
; strace -f -e execve /global/work/hanche/pkg/emacs/current/bin/emacs -Q
Process 31127 attached
[...]
[pid 31127] execve("/usr/bin/dbus-launch", ["dbus-launch", "--autolaunch",
"2873e88d4c5664b2024eb9654eddd59c", "--binary-syntax", "--close-stderr"], [/* 205 vars */]) = 0
[...]

A bit of background: This is on a server running as a virtual machine.
I would like to have an emacs daemon running on this server that I can
connect to and use (with x11) when I ssh into the machine. But when I
am done using my emacs windows and have closed them all, ssh still
hangs around when I log out because the dbus process(es) are hanging
onto one or two x11 connections tunneled by ssh. The only workaround I
see is to kill those dbus processes by hand, which is a bother.

I'd file a bug report, but I wanted to ask here first if this is a bug
or a feature. And if the latter, how do I work around it?

(Continue reading)

Jan Djärv | 31 Jul 2012 18:56
Picon

Re: Emacs insists on starting dbus?

Hello.

Add --without-gsettings also.

	Jan D.

31 jul 2012 kl. 16:49 skrev Harald Hanche-Olsen:

> Short version: I built emacs with --without-dbus,
> yet when I run emacs -Q, it runs dbus-launch.
> 
> Why? Surely, this is not the way it should be?
> 
> Slightly longer version: I am on Ubuntu, fresh emacs source from
> trunk, and ./config.status -V outputs this:
> emacs config.status 24.1.50
> configured by ../configure, generated by GNU Autoconf 2.65,
>  with options "'--without-dbus' '--prefix=/global/work/hanche/pkg/emacs/2012-07-31'
'--with-gif=no' '--with-x-toolkit=lucid'"
> And here is what happens:
> ; strace -f -e execve /global/work/hanche/pkg/emacs/current/bin/emacs -Q
> Process 31127 attached
> [...]
> [pid 31127] execve("/usr/bin/dbus-launch", ["dbus-launch", "--autolaunch",
"2873e88d4c5664b2024eb9654eddd59c", "--binary-syntax", "--close-stderr"], [/* 205 vars */]) = 0
> [...]
> 
> A bit of background: This is on a server running as a virtual machine.
> I would like to have an emacs daemon running on this server that I can
> connect to and use (with x11) when I ssh into the machine. But when I
(Continue reading)

Michael Albinus | 31 Jul 2012 19:54
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Jan Djärv <jan.h.d <at> swipnet.se> writes:

> Hello.

Hi,

> Add --without-gsettings also.

Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
impicitely when --without-dbus is applied?

And if not, this should be documented, at least.

> 	Jan D.

Best regards, Michael.

Harald Hanche-Olsen | 31 Jul 2012 20:01
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Michael Albinus <michael.albinus <at> gmx.de> (2012-07-31 17:54:18 UTC)]

> Jan Djärv <jan.h.d <at> swipnet.se> writes:
> 
> > Hello.
> 
> Hi,
> 
> > Add --without-gsettings also.
> 
> Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
> impicitely when --without-dbus is applied?

I just finished testing that, and it still started dbus.

- Harald

Ken Brown | 31 Jul 2012 20:15
Picon
Favicon

Re: Emacs insists on starting dbus?

On 7/31/2012 2:01 PM, Harald Hanche-Olsen wrote:
> [Michael Albinus<michael.albinus <at> gmx.de>  (2012-07-31 17:54:18 UTC)]
>
>> Jan Djärv<jan.h.d <at> swipnet.se>  writes:
>>
>>> Hello.
>>
>> Hi,
>>
>>> Add --without-gsettings also.
>>
>> Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
>> impicitely when --without-dbus is applied?
>
> I just finished testing that, and it still started dbus.

You might need to also add --without-gconf.

Ken

Harald Hanche-Olsen | 31 Jul 2012 20:32
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Ken Brown <kbrown <at> cornell.edu> (2012-07-31 18:15:27 UTC)]

> >>> Add --without-gsettings also.
> >
> > I just finished testing that, and it still started dbus.
> 
> You might need to also add --without-gconf.

Ah. That did it. Then the remaining question, then: Bug, feature, or
documentation bug? I can file a bug report, but I am not sure what to
write in it.

- Harald

Michael Albinus | 31 Jul 2012 20:51
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:

>> You might need to also add --without-gconf.
>
> Ah. That did it. Then the remaining question, then: Bug, feature, or
> documentation bug? I can file a bug report, but I am not sure what to
> write in it.

"Documentation enhancement"? It doesn't matter. File the report, and we
will fix it. 

> - Harald

Thanks for testing, and best regards, Michael.

Steinar Bang | 1 Aug 2012 15:25
Picon
Picon
Favicon

Re: Emacs insists on starting dbus?

>>>>> Harald Hanche-Olsen <hanche <at> math.ntnu.no>:

> Ah. That did it. Then the remaining question, then: Bug, feature, or
> documentation bug? I can file a bug report, but I am not sure what to
> write in it.

"Using emacs over ssh X11 forwarding makes it impossible to disconnect ssh"?

Jan Djärv | 31 Jul 2012 20:51
Picon

Re: Emacs insists on starting dbus?

Hello.

31 jul 2012 kl. 19:54 skrev Michael Albinus:

> Jan Djärv <jan.h.d <at> swipnet.se> writes:
> 
>> Hello.
> 
> Hi,
> 
>> Add --without-gsettings also.
> 
> Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
> impicitely when --without-dbus is applied?
> 

--without-dbus means that Emacs should not provide a dbus-interface and not link with dbus, which is doesn't.

> And if not, this should be documented, at least.

It is hard to document everything that external libraries do. Gsettings happens to start dbus, it does so
regardless of what Emacs does.

	Jan D.

Michael Albinus | 31 Jul 2012 21:02
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Jan Djärv <jan.h.d <at> swipnet.se> writes:

>> Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
>> impicitely when --without-dbus is applied?
>
> --without-dbus means that Emacs should not provide a dbus-interface
> and not link with dbus, which is doesn't.

It does not link libdbus *explicitly*, when --without-dbus is given.
>  
>> And if not, this should be documented, at least.
>
> It is hard to document everything that external libraries
> do. Gsettings happens to start dbus, it does so regardless of what
> Emacs does.

Maybe we could add a hint in the configure summary, when there is
--without-dbus, but not --without-gsettings and --without-gconf.
Something like

  Does Emacs use -ldbus?                                  no
  Does Emacs use -lgconf?                                 yes
       You might consider to disable Gconf
  Does Emacs use GSettings?                               yes
       You might consider to disable Gsettings

> 	Jan D.

Best regards, Michael.

(Continue reading)

Jan Djärv | 31 Jul 2012 22:43
Picon

Re: Emacs insists on starting dbus?

Hello.

31 jul 2012 kl. 21:02 skrev Michael Albinus:

> Jan Djärv <jan.h.d <at> swipnet.se> writes:
> 
>>> Hmm. If this is the reason for the D-Bus autostart, shouldn't it be set
>>> impicitely when --without-dbus is applied?
>> 
>> --without-dbus means that Emacs should not provide a dbus-interface
>> and not link with dbus, which is doesn't.
> 
> It does not link libdbus *explicitly*, when --without-dbus is given.

Yes.

>> 
>>> And if not, this should be documented, at least.
>> 
>> It is hard to document everything that external libraries
>> do. Gsettings happens to start dbus, it does so regardless of what
>> Emacs does.
> 
> Maybe we could add a hint in the configure summary, when there is
> --without-dbus, but not --without-gsettings and --without-gconf.
> Something like
> 
>  Does Emacs use -ldbus?                                  no
>  Does Emacs use -lgconf?                                 yes
>       You might consider to disable Gconf
(Continue reading)

Harald Hanche-Olsen | 31 Jul 2012 23:09
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Jan Djärv <jan.h.d <at> swipnet.se> (2012-07-31 20:43:16 UTC)]

> Why?  I usually configure --without-dbus, but want Gsettings.
> If we for example implement the Unity menubar thing (i.e. kind of like OSX menu bar at the top of the
desktop), that will also use dbus.  Must we document every feature that might use dbus?  We don't have
control over that.

Maybe not, but this caused quite a bit of confusion to me. I imagine other people could be in the same
situation of wanting to have an emacs daemon running on a server that they can connect to and disconnect
from multiple times, and it would be good if we could find a way to help them achieve that. But I admit I don't
know enough about dbus or the myriad libraries that emacs uses to offer any good suggestion. I am afraid in
the final analysis, if dbus gets into every corner of emacs, that emacs will be inextricably tied to the
desktop and will lose some of its utility on servers. That does not seem like a desirable outcome.

- Harald

Michael Albinus | 1 Aug 2012 14:11
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:

> I am afraid in the final analysis, if dbus gets into every corner of
> emacs, that emacs will be inextricably tied to the desktop and will
> lose some of its utility on servers. That does not seem like a
> desirable outcome.

It's not that simple. D-Bus could also be used by Emacs offering
services to other applications.

Furthermore, the D-Bus autolaunch feature is active only when there is a
connection to X11 (ie $DISPLAY is set). That's not the case for many
servers.

But I confirm, that we must care about (too much) dependencies on D-Bus.

> - Harald

Best regards, Michael.

Harald Hanche-Olsen | 1 Aug 2012 14:18
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Michael Albinus <michael.albinus <at> gmx.de> (2012-08-01 12:11:18 UTC)]

> Furthermore, the D-Bus autolaunch feature is active only when there is a
> connection to X11 (ie $DISPLAY is set). That's not the case for many
> servers.

Ah, so a workaround would have been to start it as

  DISPLAY= emacs --daemon

and then opening frames with with emacsclient -c, and it would then
refrain from launching dbus? That is good to know. It would have
solved my problem without any need for compiling with special
configure options.

- Harald

Michael Albinus | 1 Aug 2012 14:23
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:

> Ah, so a workaround would have been to start it as
>
>   DISPLAY= emacs --daemon
>
> and then opening frames with with emacsclient -c, and it would then
> refrain from launching dbus? That is good to know. It would have
> solved my problem without any need for compiling with special
> configure options.

Maybe, I haven't tested. Please let us know, whether it works.

> - Harald

Best regards, Michael.

Harald Hanche-Olsen | 1 Aug 2012 15:57
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Michael Albinus <michael.albinus <at> gmx.de> (2012-08-01 12:23:51 UTC)]

> Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:
> 
> > Ah, so a workaround would have been to start it as
> >
> >   DISPLAY= emacs --daemon
> >
> > and then opening frames with with emacsclient -c, and it would then
> > refrain from launching dbus? That is good to know. It would have
> > solved my problem without any need for compiling with special
> > configure options.
> 
> Maybe, I haven't tested. Please let us know, whether it works.

Tried it. Yes, it worked.

I have filed a bugreport. I'll report back with the number when I get
a response from the bugtracker.

- Harald

Harald Hanche-Olsen | 1 Aug 2012 16:19
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Harald Hanche-Olsen <hanche <at> math.ntnu.no> (2012-08-01 13:57:10 UTC)]

> I have filed a bugreport. I'll report back with the number when I get
> a response from the bugtracker.

It's number 12112: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12112

- Harald

Michael Albinus | 1 Aug 2012 10:17
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Jan Djärv <jan.h.d <at> swipnet.se> writes:

> Hello.

Hi,

> Why?  I usually configure --without-dbus, but want Gsettings.
> If we for example implement the Unity menubar thing (i.e. kind of like
> OSX menu bar at the top of the desktop), that will also use dbus.

I see your point. Well, let's do it another way.

> Must we document every feature that might use dbus?  We don't have
> control over that.

People who want to suppress D-Bus autolaunch are not very familiar with
D-Bus, in general. We shall give them some help.

D-Bus people know the problem of hanging autolaunched D-Bus sessions
over ssh connections, see the discussion in
<https://bugs.freedesktop.org/show_bug.cgi?id=32509>. AFAICS, there is
no fix integrated yet into the D-Bus sources.

Until there is a solution on D-Bus side, we might add a configure option
--without-dbus-autolaunch. This would have the same effect as
"--without-dbus --without-gconf --without-gsettings" for now, maybe we
need to add other libraries later.

> 	Jan D.

(Continue reading)

Michael Albinus | 31 Jul 2012 19:49
Picon
Picon
Gravatar

Re: Emacs insists on starting dbus?

Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:

> Short version: I built emacs with --without-dbus,
> yet when I run emacs -Q, it runs dbus-launch.
>
> Why? Surely, this is not the way it should be?

Nope, it shouldn't.

> Slightly longer version: I am on Ubuntu, fresh emacs source from
> trunk, and ./config.status -V outputs this:
> emacs config.status 24.1.50
> configured by ../configure, generated by GNU Autoconf 2.65,
>   with options "'--without-dbus'
> --prefix=/global/work/hanche/pkg/emacs/2012-07-31' '--with-gif=no'
> --with-x-toolkit=lucid'"

Since you have disabled dbus by configure option, dbusbind.c shouldn't
be linked with the emacs binary.

> And here is what happens:
> ; strace -f -e execve /global/work/hanche/pkg/emacs/current/bin/emacs -Q
> Process 31127 attached
> [...]
> [pid 31127] execve("/usr/bin/dbus-launch", ["dbus-launch",
> "--autolaunch", "2873e88d4c5664b2024eb9654eddd59c", "--binary-syntax",
> "--close-stderr"], [/* 205 vars */]) = 0
> [...]

This would need more debugging. As said, I don't believe that dbusbind.c
(Continue reading)

Harald Hanche-Olsen | 31 Jul 2012 20:16
Picon
Picon
Favicon
Gravatar

Re: Emacs insists on starting dbus?

[Michael Albinus <michael.albinus <at> gmx.de> (2012-07-31 17:49:49 UTC)]

> Since you have disabled dbus by configure option, dbusbind.c shouldn't
> be linked with the emacs binary.

Okay. Not sure how to make sure it didn't ... I am not too familiar
with gnu/linux, coming from the freebsd world myself.

> You might try to find which processes on the remote host run under D-Bus
> control, started by emacs. Something like this:
> 
> # sudo grep -l DBUS_SESSION_BUS_ADDRESS /proc/*/environ
> # ps -p <pid>     ### for all returned pid's

I find /usr/lib/libgconf2-4/gconfd-2 (plus a bunch of processes owned
by other users on the server).

> It isn't a feature. But it looks like a side-effect of a third party
> library linked with emacs. I see the following options to handle:
> 
> - If we know which service(s) autostart D-Bus, we might find a way to
>   suppress them.

So gconf(d) looks like a prime suspect?

> - The default way to suppress autostart is configuring D-Bus sources
>   with --disable-x11-autolaunch before compilation. But I guess you
>   don't compile D-Bus yourself, it isn't a real option, therefore.

You're right about that one.
(Continue reading)

Steinar Bang | 1 Aug 2012 15:23
Picon
Picon
Favicon

Re: Emacs insists on starting dbus?

>>>>> Harald Hanche-Olsen <hanche <at> math.ntnu.no>:

[snip!]
> I would like to have an emacs daemon running on this server that I can
> connect to and use (with x11) when I ssh into the machine. But when I
> am done using my emacs windows and have closed them all, ssh still
> hangs around when I log out because the dbus process(es) are hanging
> onto one or two x11 connections tunneled by ssh. The only workaround I
> see is to kill those dbus processes by hand, which is a bother.

> I'd file a bug report, but I wanted to ask here first if this is a bug
> or a feature.

If it's a feature, it is a feature that has annoyed me for a couple of
years now.


Gmane