Bug 91237 - Better error when .desktop is invalid or absent
Summary: Better error when .desktop is invalid or absent
Status: RESOLVED FIXED
Alias: None
Product: GeoClue
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Geoclue Bugs
QA Contact: Geoclue Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-06 09:02 UTC by Laurent Bigonville
Modified: 2015-07-07 15:15 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Laurent Bigonville 2015-07-06 09:02:22 UTC
Hi,

There are several bug reports about redshift not being able to get the location from geoclue:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789883
https://bugzilla.redhat.com/show_bug.cgi?id=1214978
https://github.com/jonls/redshift/issues/158

Reading https://bugzilla.redhat.com/show_bug.cgi?id=1214978#c3 it shouldn't be necessary to change the configuration file, but without explicit authorization it's definitely not working.
Comment 1 Zeeshan Ali 2015-07-06 10:47:03 UTC
(In reply to Laurent Bigonville from comment #0)
> Hi,
> 
> There are several bug reports about redshift not being able to get the
> location from geoclue:
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789883
> https://bugzilla.redhat.com/show_bug.cgi?id=1214978
> https://github.com/jonls/redshift/issues/158
> 
> Reading https://bugzilla.redhat.com/show_bug.cgi?id=1214978#c3 it shouldn't
> be necessary to change the configuration file, but without explicit
> authorization it's definitely not working.

As I commented on the RHEL bug, it's either a bug in the app or geoclue itself but redshift doesn't need any special config in geoclue.
Comment 2 Zeeshan Ali 2015-07-06 14:42:38 UTC
I think this is a user error (see comment on redhat bug). If it turns out that I'm wrong, please do re-open this bug.
Comment 3 Laurent Bigonville 2015-07-06 15:01:22 UTC
Well I also have the same issue.

The geolocation parameter in the privacy tab is on
Comment 4 Laurent Bigonville 2015-07-06 15:03:28 UTC
$ G_MESSAGES_DEBUG=all /usr/lib/geoclue-2.0/geoclue
(geoclue:23157): Geoclue-DEBUG: Available accuracy level from GClueWifi: 4
(geoclue:23157): Geoclue-DEBUG: New agent for user ID '1000'
(geoclue:23157): Geoclue-DEBUG: WiFi device 'wlan0' added.
(geoclue:23157): Geoclue-DEBUG: Available accuracy level from GClueWifi: 6
(geoclue:23157): Geoclue-DEBUG: Number of connected clients: 1
(geoclue:23157): Geoclue-DEBUG: New distance threshold: 50000
(geoclue:23157): Geoclue-DEBUG: 'redshift' not in configuration
(geoclue:23157): Geoclue-DEBUG: requested accuracy level: 4. Accuracy level allowed by agent: 8
Comment 5 Bastien Nocera 2015-07-06 15:06:11 UTC
(In reply to Laurent Bigonville from comment #4)
> $ G_MESSAGES_DEBUG=all /usr/lib/geoclue-2.0/geoclue
> (geoclue:23157): Geoclue-DEBUG: Available accuracy level from GClueWifi: 4
> (geoclue:23157): Geoclue-DEBUG: New agent for user ID '1000'
> (geoclue:23157): Geoclue-DEBUG: WiFi device 'wlan0' added.
> (geoclue:23157): Geoclue-DEBUG: Available accuracy level from GClueWifi: 6
> (geoclue:23157): Geoclue-DEBUG: Number of connected clients: 1
> (geoclue:23157): Geoclue-DEBUG: New distance threshold: 50000
> (geoclue:23157): Geoclue-DEBUG: 'redshift' not in configuration
> (geoclue:23157): Geoclue-DEBUG: requested accuracy level: 4. Accuracy level
> allowed by agent: 8

There were more questions on the RH Bugzilla bug:
- does it have a .desktop file
- please link to the code that registers the .desktop file with Geoclue
Comment 6 Laurent Bigonville 2015-07-06 15:20:29 UTC
> There were more questions on the RH Bugzilla bug:
> - does it have a .desktop file

Alright, so indeed adding a .desktop file is fixing the issue..

I'm not sure what you mean by:

> - please link to the code that registers the .desktop file with Geoclue
Comment 7 Bastien Nocera 2015-07-06 15:24:10 UTC
(In reply to Laurent Bigonville from comment #6)
> > There were more questions on the RH Bugzilla bug:
> > - does it have a .desktop file
> 
> Alright, so indeed adding a .desktop file is fixing the issue..
> 
> I'm not sure what you mean by:
> 
> > - please link to the code that registers the .desktop file with Geoclue

A link to the code in Redshift that uses Geoclue2 would have been needed, if indeed it had a .desktop file.
Comment 9 Zeeshan Ali 2015-07-06 15:42:28 UTC
(In reply to Laurent Bigonville from comment #6)
> > There were more questions on the RH Bugzilla bug:
> > - does it have a .desktop file
> 
> Alright, so indeed adding a .desktop file is fixing the issue..

Cool. Problem solved then?
Comment 10 Bastien Nocera 2015-07-07 05:23:15 UTC
(In reply to Laurent Bigonville from comment #8)
> Oh
> 
> https://github.com/jonls/redshift/blob/master/src/location-geoclue2.c#L202

That's not a valid .desktop ID. Geoclue should probably warn loudly when the .desktop ID is invalid, or not present on the system. Reopening to that effect.
Comment 11 Zeeshan Ali 2015-07-07 11:13:26 UTC
(In reply to Bastien Nocera from comment #10)
> (In reply to Laurent Bigonville from comment #8)
> > Oh
> > 
> > https://github.com/jonls/redshift/blob/master/src/location-geoclue2.c#L202
> 
> That's not a valid .desktop ID. Geoclue should probably warn loudly when the
> .desktop ID is invalid, or not present on the system. Reopening to that
> effect.

It's not geoclue that's checking it, it's the agent (gnome-shell). This is more compatible with how things will be done in post-sandboxing world, I'm told.
Comment 12 Bastien Nocera 2015-07-07 11:40:27 UTC
(In reply to Zeeshan Ali from comment #11)
> (In reply to Bastien Nocera from comment #10)
> > (In reply to Laurent Bigonville from comment #8)
> > > Oh
> > > 
> > > https://github.com/jonls/redshift/blob/master/src/location-geoclue2.c#L202
> > 
> > That's not a valid .desktop ID. Geoclue should probably warn loudly when the
> > .desktop ID is invalid, or not present on the system. Reopening to that
> > effect.
> 
> It's not geoclue that's checking it, it's the agent (gnome-shell). This is
> more compatible with how things will be done in post-sandboxing world, I'm
> told.

Then we should make sure that that error is set in the agent, and have geoclue print the error as well, before passing the rejection back to the application.
Comment 13 Zeeshan Ali 2015-07-07 11:58:26 UTC
(In reply to Bastien Nocera from comment #12)
> (In reply to Zeeshan Ali from comment #11)
> > (In reply to Bastien Nocera from comment #10)
> > > (In reply to Laurent Bigonville from comment #8)
> > > > Oh
> > > > 
> > > > https://github.com/jonls/redshift/blob/master/src/location-geoclue2.c#L202
> > > 
> > > That's not a valid .desktop ID. Geoclue should probably warn loudly when the
> > > .desktop ID is invalid, or not present on the system. Reopening to that
> > > effect.
> > 
> > It's not geoclue that's checking it, it's the agent (gnome-shell). This is
> > more compatible with how things will be done in post-sandboxing world, I'm
> > told.
> 
> Then we should make sure that that error is set in the agent, and have
> geoclue print the error as well, before passing the rejection back to the
> application.

That will require changes in agent API and hence incompatibility between newer geoclue and existing gnome-shell. :( Maybe upon rejection from agent, geoclue could just emit a slightly more helpful message: "Agent rejected '%s' for user '%u'. Please ensure that '%s' has installed a valid %s.desktop file."?
Comment 14 Bastien Nocera 2015-07-07 14:21:41 UTC
(In reply to Zeeshan Ali from comment #13)
> (In reply to Bastien Nocera from comment #12)
> > (In reply to Zeeshan Ali from comment #11)
> > > (In reply to Bastien Nocera from comment #10)
> > > > (In reply to Laurent Bigonville from comment #8)
> > > > > Oh
> > > > > 
> > > > > https://github.com/jonls/redshift/blob/master/src/location-geoclue2.c#L202
> > > > 
> > > > That's not a valid .desktop ID. Geoclue should probably warn loudly when the
> > > > .desktop ID is invalid, or not present on the system. Reopening to that
> > > > effect.
> > > 
> > > It's not geoclue that's checking it, it's the agent (gnome-shell). This is
> > > more compatible with how things will be done in post-sandboxing world, I'm
> > > told.
> > 
> > Then we should make sure that that error is set in the agent, and have
> > geoclue print the error as well, before passing the rejection back to the
> > application.
> 
> That will require changes in agent API and hence incompatibility between
> newer geoclue and existing gnome-shell. :(

Ha, you should probably have used D-Bus errors when rejecting clients, instead of simply sending true/false.

> Maybe upon rejection from agent,
> geoclue could just emit a slightly more helpful message: "Agent rejected
> '%s' for user '%u'. Please ensure that '%s' has installed a valid %s.desktop
> file."?

That would be good enough for me, thanks.
Comment 15 Zeeshan Ali 2015-07-07 15:15:03 UTC
commit: ca7fb0ced37cd6b57ef7693eb05d99b4646b8abb

    service-client: More helpful error on agent rejection
    
    https://bugs.freedesktop.org/show_bug.cgi?id=91237


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.