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 777994 - AutostartCondition does not support absolute paths
AutostartCondition does not support absolute paths
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-31 17:43 UTC by Mario Sánchez Prada
Modified: 2017-02-05 10:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch proposal (2.55 KB, patch)
2017-02-03 15:08 UTC, Mario Sánchez Prada
committed Details | Review

Description Mario Sánchez Prada 2017-01-31 17:43:46 UTC
I was trying to write a autostart desktop file (to be placed in /etc/xdg/autostart) today and I found out that lines like the following one:

  AutostartCondition=unless-exists my-stamp-file

...will look for that file using the user's configuration directory as the base for the search (see https://git.gnome.org/browse/gnome-session/tree/gnome-session/gsm-autostart-app.c#n844), which is a big inconvenient for my case as I was trying to monitor under /var/lib/my-package/my-stamp-file instead.

I understand that supporting absolute paths could be problematic if such path points to a different volume (it could make the file monitor slow) but I still think it would be interesting to support this feature as it might be still useful in some less general cases, as it could be of our downstream case in Endless, for instance.

Comments?
Comment 1 Mario Sánchez Prada 2017-02-02 11:40:08 UTC
I thought I added Ray to CC, but seems I didn't. Adding now...
Comment 2 Ray Strode [halfline] 2017-02-02 12:29:49 UTC
I actually already cc to all g-s bugs by gmail...

I'd take a patch that does a g_path_is_absolute check
Comment 3 Mario Sánchez Prada 2017-02-02 12:57:48 UTC
Oops, sorry for spamming then. Thanks for considering this, I'll try to come up with a patch soon then.
Comment 4 Mario Sánchez Prada 2017-02-03 15:08:19 UTC
Created attachment 344870 [details] [review]
Patch proposal

See the proposed patch attached. I've tested it and seems to do exactly what I need,without regressing the currently expected functionality.

Please review, thanks!
Comment 5 Ray Strode [halfline] 2017-02-03 18:05:05 UTC
Review of attachment 344870 [details] [review]:

yea sure.  one suggestion that you can take or leave before pushing...

::: gnome-session/gsm-autostart-app.c
@@ +518,3 @@
 
+                file_path = g_path_is_absolute (key) ? g_strdup (key)
+                        : g_build_filename (g_get_user_config_dir (), key, NULL);

this is a little noisy ^.  Not a big deal, but the noise gets repeated several times.

maybe have

static char *
resolve_conditional_file_path (const char *file)
{
        if (g_path_is_absolute (file))
                return g_strdup (file);
        return g_build_filename (…);    
}

Anyway, just an idea, push it either way.
Comment 6 Mario Sánchez Prada 2017-02-04 12:29:29 UTC
Thanks for the review, Ray. Yes, I agree it's noisy, but I was not sure which way you'd prefer to have it so I wrote it in that way as a first proposal.

But I can change it before pushing, sure.
Comment 7 Mario Sánchez Prada 2017-02-05 09:34:03 UTC
Pushed now to master at https://git.gnome.org/browse/gnome-session/commit/?id=21690a7f09bd477ecdefe31f547081d3b1bb1d99

Resolving, thanks!