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 687556 - polKitAgent: Don't crash when we cannot enable/disable the auth agent
polKitAgent: Don't crash when we cannot enable/disable the auth agent
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-11-04 10:54 UTC by drago01
Modified: 2013-02-19 19:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
polKitAgent: Don't crash when we cannot enable/disable the auth agent (1.23 KB, patch)
2012-11-04 10:54 UTC, drago01
reviewed Details | Review
polKitAgent: Don't crash when we cannot enable/disable the auth agent (1.25 KB, patch)
2012-11-04 15:17 UTC, drago01
committed Details | Review

Description drago01 2012-11-04 10:54:08 UTC
See patch.
Comment 1 drago01 2012-11-04 10:54:10 UTC
Created attachment 228013 [details] [review]
polKitAgent: Don't crash when we cannot enable/disable the auth agent

This makes it easier to run with jhbuild.
Comment 2 Giovanni Campagna 2012-11-04 12:47:58 UTC
Review of attachment 228013 [details] [review]:

Do we expect such failures? Under what circumstances can they happen?
If not, then logError is more appropriate. If yes, having the error message appended to the log is still useful.
Comment 3 drago01 2012-11-04 15:16:09 UTC
(In reply to comment #2)
> Review of attachment 228013 [details] [review]:
> 
> Do we expect such failures? Under what circumstances can they happen?
> If not, then logError is more appropriate. If yes, having the error message
> appended to the log is still useful.

I don't expect them to happen "in the wild" i.e outside of jhbuild configurations.
Comment 4 drago01 2012-11-04 15:17:58 UTC
Created attachment 228027 [details] [review]
polKitAgent: Don't crash when we cannot enable/disable the auth agent

This makes it easier to run with jhbuild.

---

Use logError instead of just log.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-11-04 15:31:49 UTC
We shouldn't just be dropping polkit on the floor -- why is it failing, and if so, how can we make it not fail?
Comment 6 drago01 2012-11-04 15:43:27 UTC
(In reply to comment #5)
> We shouldn't just be dropping polkit on the floor -- why is it failing, and if
> so, how can we make it not fail?

Probably because stuff isn't suid root in the jhbuild env (didn't debug just a guess) .. the thing is this is just for jhbuild it should not happen in the real world ... and even if it does no auth dialogs is still better then outright crashing.
Comment 7 Allison Karlitskaya (desrt) 2012-11-09 13:58:14 UTC
I'm not sure this is strictly related to missing setuid binaries...

I have a jhbuild install setup and I have both of the appropriate pk binaries marked as setuid (pkexec and the agent helper).  I still see this in my session.log:

(gnome-shell:6505): Gvc-WARNING **: Failed to connect context: Connection refused
    JS ERROR: !!!   Exception was: Polkit.Error: No session for pid 6505
    JS ERROR: !!!     message = '"No session for pid 6505"'
    JS ERROR: !!!     fileName = '"/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/polkitAgent.js"'
    JS ERROR: !!!     lineNumber = '329'
    JS ERROR: !!!     stack = '"0 anonymous()@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/polkitAgent.js:329
1 wrapper()@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:204
2 anonymous("name" = ""polkitAgent"")@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/__init__.js:56
3 wrapper(""polkitAgent"")@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:204
4 anonymous("name" = ""polkitAgent"", 1, [object Array])@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/__init__.js:22
5 anonymous()@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/__init__.js:21
6 wrapper()@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:204
7 anonymous()@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/components/__init__.js:13
8 wrapper()@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:204
9 anonymous()@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:145
10 anonymous()@/opt/ca/desrt/gnome-3.8/share/gjs-1.0/lang.js:239
11 start()@/opt/ca/desrt/gnome-3.8/share/gnome-shell/js/ui/main.js:150
12 <TOP LEVEL>@<main>:1
"'
Window manager warning: Log level 32: Execution of main.js threw exception: Polkit.Error: No session for pid 6505
gnome-session[6287]: WARNING: App 'gnome-shell.desktop' respawning too quickly
gnome-session[6287]: WARNING: Detected that screensaver has left the bus
Comment 8 Allison Karlitskaya (desrt) 2012-11-09 14:02:49 UTC
actually, maybe my polKitAgent crash is just different from yours...
Comment 9 Allison Karlitskaya (desrt) 2012-11-09 14:06:10 UTC
In any case, I can confirm that the patches here make the issue go away for me (I just applied the javascript one to my already-installed gnome-shell but I assume that the other one would work equally well).
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-11-09 19:51:01 UTC
Right, that's just because we get back an error and then drop it on the floor. I think it's worthwhile to instead fix whatever's generating that error. I'm going to assume it's a PolKit/ConsoleKit bug around tracking sessions, since you certainly should have a session.
Comment 11 Allison Karlitskaya (desrt) 2012-11-10 01:58:47 UTC
Pretty sure I know what the issue is -- my polkit is built against libsystemd-login but my system is using ConsoleKit...

Trying to figure out what I should do about this...
Comment 12 drago01 2013-02-19 16:26:30 UTC
Pushed with log() instead of logError after IRC review.

Attachment 228027 [details] pushed as dd6fe58 - polKitAgent: Don't crash when we cannot enable/disable the auth agent
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-02-19 19:17:32 UTC
I think outright crashing is better than no auth dialogs, to be honest. We need to fix jhbuild so it Just Works on all systems.
Comment 14 Colin Walters 2013-02-19 19:29:08 UTC
(In reply to comment #13)
> I think outright crashing is better than no auth dialogs, to be honest. We need
> to fix jhbuild so it Just Works on all systems.

Unfortunately, and trust me I gave this a lot of thought, that's just not always possible.  It's a technological dead end, albeit one quite useful for what it does do. 

However, it still could make sense to add hacks to the system code where it does help out jhbuild.  In this case for example, we could do:

if (GLib.getenv("CERTIFIED_GNOMIE")) {
  try
    { doSomething(); }
  catch (e)
    { logError(e); }
} else {
  doSomething();
}