After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663721 - gnome-session no longer starts desktop files under /usr/share/gdm/autostart/LoginWindow
gnome-session no longer starts desktop files under /usr/share/gdm/autostart/L...
Product: gnome-session
Classification: Core
Component: gnome-session
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks: 684474
Reported: 2011-11-09 18:32 UTC by Hans de Goede
Modified: 2012-09-25 17:40 UTC
See Also:
GNOME target: 3.4
GNOME version: ---

wip patch (4.79 KB, patch)
2012-09-22 16:02 UTC, Matthias Clasen
none Details | Review
Make autostart overriding more flexible (14.14 KB, patch)
2012-09-24 18:13 UTC, Ray Strode [halfline]
committed Details | Review

Description Hans de Goede 2011-11-09 18:32:32 UTC
spice-vdagent installs a /usr/share/gdm/autostart/LoginWindow/spice-vdagent.desktop file, so that the agent gets auto started in the gdm session, so that things like client mouse mode work at the login screen too. This no longer seems to work with the latest gnome-session

I asked about this on irc, here are some interesting snippets from the discussion on irc:

<halfline> hansg: so we needed to switch gdm over to run gnome-session in a different mode
<halfline> so that we can have fallback/normal sessions
<halfline> the way it works is /usr/share/gnome-session/sessions contains a list of sessions
<halfline> dconf contains which session to start from there
<halfline> by default we use the "gdm" session
<halfline> and fall back to the "gdm-fallback" session
<halfline> unfortunately, the autostart mechanism is not available when gnome-session is run in this mode

<mclasen_> halfline: would it be hard to bring autostart back there ?
<halfline> we could probably make gnome-session support both at the same time

<halfline> vuntz: --autostart and --session don't work together right now i mean
<halfline> if you do --session it ignores --autostart
<vuntz> halfline: they should
<vuntz> halfline: I'm actually surprised it doesn't work as I can't see a reason why it wouldn't
<vuntz> halfline: so that'd be a bug
<halfline> vuntz: okay, so we can just fix it to work then I guess
<halfline> and then this problem will go away
<halfline> vuntz: oh i got it backwards
<halfline> vuntz: it's that --autostart ignores --session
<halfline> see the top of gsm_session_fill()
<halfline> so something like this should fix it:
<halfline> but
<halfline> there's a more complicated question of how should autostart and session interact
<halfline> given that session can fall back
<halfline> and you may want to run something when not falling back (or only when falling back)
<mclasen_> isn't that what we invented if-session for 
<mclasen_> ?
<halfline> i guess we can just proclaim the autostart dir is strictly for ISVs that want to uncondtionally run
<halfline> oh we have an if-session conditional in the desktop file?
<halfline> AutostartCondition=GNOME3 if-session gnome-fallback
<halfline> indeed
<halfline> okay good enough

And here is the patch from fpaste since that will likely timeout:

diff --git a/gnome-session/gsm-session-fill.c b/gnome-session/gsm-session-fill.c
index 61541b5..145c536 100644
--- a/gnome-session/gsm-session-fill.c
+++ b/gnome-session/gsm-session-fill.c
@@ -462,11 +462,6 @@ gsm_session_fill (GsmManager  *manager,
         gboolean is_fallback;
         char *actual_session;
-        if (override_autostart_dirs != NULL) {
-                load_override_apps (manager, override_autostart_dirs);
-                return TRUE;
-        }
         keyfile = get_session_keyfile (session, &actual_session, &is_fallback);
         if (!keyfile)
@@ -476,7 +471,11 @@ gsm_session_fill (GsmManager  *manager,
         g_free (actual_session);
-        load_standard_apps (manager, keyfile);
+        if (override_autostart_dirs != NULL) {
+                load_override_apps (manager, override_autostart_dirs);
+        } else {
+                load_standard_apps (manager, keyfile);
+        }
         g_key_file_free (keyfile);
Comment 1 Ray Strode [halfline] 2011-11-09 20:11:49 UTC
okay note we'll need to change gdm to use --autostart again when invoking gnome-session after we land this.
Comment 2 Vincent Untz 2011-11-10 13:21:09 UTC
Okay, reading the code again, I understand what's happening.

The above patch is not enough: we need to change all the code that checks if required components (and looks for defaut providers) so that it uses the directory set in --autostart, instead of the usual autostart dirs.

Or to say it otherwise, everything happening from gsm_session_fill() should happen with autostart dirs specified with the --autostart option.
Comment 3 Ray Strode [halfline] 2011-11-10 22:57:48 UTC
well one thought...

If we're saying that session files are the prescribed way for setting up sessions, and autostart dirs now are relegated to being a hook for ISVs to augment the session, then maybe autostart dirs shouldn't be able to override required components and default providers?
Comment 4 Vincent Untz 2011-11-14 11:12:00 UTC
(In reply to comment #3)
> well one thought...
> If we're saying that session files are the prescribed way for setting up
> sessions, and autostart dirs now are relegated to being a hook for ISVs to
> augment the session, then maybe autostart dirs shouldn't be able to override
> required components and default providers?

Autostart dirs can't override an explicit required component, but they can override a default provider. That's actually the main difference between "required component" and "default provider".

(If this doesn't work this way, it's a bug :-))
Comment 5 Matthias Clasen 2012-09-21 22:06:30 UTC
So, orca is using autostart with an autostartcondition to launch when the screen reader switch is toggled in the shell. Therefore, we need autostart to work in the login screen session, or we'll have a broken screen reader switch in the login screen.
Comment 6 Matthias Clasen 2012-09-22 16:02:56 UTC
Created attachment 224985 [details] [review]
wip patch

Here is a work-in-progress. I haven't succeeded in having orca activated in the login session yet, so more work needed.
Comment 7 Ray Strode [halfline] 2012-09-24 18:13:17 UTC
Created attachment 225088 [details] [review]
Make autostart overriding more flexible

This patch changes the interpretation of --autostart.

Previously, when specified on the commandline, no session file was
loaded at all. With this patch, we make it just override the locations
that we look for autostart files in, from the default

(we still consult those directories for fulfilling .session file

The goal of this is to enable gdm to use autostart in the login
session, so orca can be activated.
Comment 8 Ray Strode [halfline] 2012-09-24 20:39:35 UTC
Comment on attachment 225088 [details] [review]
Make autostart overriding more flexible

seems okay
Comment 9 Matthias Clasen 2012-09-25 10:27:10 UTC
Successfully tested now. Approval 1.
Comment 10 Colin Walters 2012-09-25 13:34:00 UTC
I'm not going to pretend to fully understand all of this code and how all the different components involved use it.  The patch doesn't look obviously wrong =)

If it fixes this bug, consider this a tentative +1.

I don't have Orca yet in gnome-ostree =/  Will work on that...
Comment 11 Ray Strode [halfline] 2012-09-25 14:33:16 UTC
basically before the login screen started gnome-session in failsafe mode which disabled checking autostart directories (since /etc/xdg/autostart is sysadmin controllable and we don't want random autostart things happening in the login screen).  This also broke orca, which depends on autostart to function.  Now we turn off failsafe mode, and instead tell gnome-session to find its autostart files in different gdm controlled directory.

The one twist is, gnome-settings-daemon isn't autostarted (it's explicitly started as part of the gnome.session file), but it's installed in /etc/xdg/autostart.  So the patch still looks at /etc/xdg/autostart for constructing session prerequistes, even though it doesn't use /etc/xdg/autostart for figuring out autostart files.
Comment 12 Ray Strode [halfline] 2012-09-25 17:40:06 UTC
Attachment 225088 [details] pushed as 17b0b11 - Make autostart overriding more flexible