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 431044 - gdmflexiserver gtk-init bug
gdmflexiserver gtk-init bug
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-18 15:14 UTC by William Jon McCann
Modified: 2007-04-23 10:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description William Jon McCann 2007-04-18 15:14:01 UTC
If you run:

gdmflexiserver -a --command ""

It doesn't seem to work because the display isn't set.

Probably due to:
http://svn.gnome.org/viewcvs/gdm2/trunk/gui/gdmflexiserver.c?view=diff&r1=4789&r2=4790


Also, not initializing gtk means that we can't use --g-fatal-warnings to aid debugging.
Comment 1 Brian Cameron 2007-04-20 07:16:13 UTC
Note when running in --command mode we *don't* want to initalize gtk+ because it is possible to run this command even if the user cannot connect to the Xserver.
For example, a user might telnet into a machine, su as root, and run gdm-stop or gdm-restart.
 
When using --command mode, it should only print out an ASCII message to the terminal.

Your example command:

gdmflexiserver -a --command ""

isn't really a valid gdmflexiserver command, by the way.

Probably when --command mode is used, we should just use $DISPLAY rather than trying to get the display from gdkdisplay-x11.c:

Note that gtk_init is called in gdmflexiserver, but only when --command isn't used.

Comment 2 William Jon McCann 2007-04-20 07:37:18 UTC
If -a shouldn't be used with command then the following is a bit strange:
$ gdmflexiserver --command "QUERY_LOGOUT_ACTION"
ERROR 100 Not authenticated
$ gdmflexiserver -a --command "QUERY_LOGOUT_ACTION"
gdmflexiserver[17021]: Gdk-CRITICAL: gdk_display_get_name: assertion `GDK_IS_DISPLAY (display)' failed
OK HALT;REBOOT

Also, if you want the program to be used even when a Display isn't available then maybe gtk_init_check() is a better approach.
http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-init-check
Comment 3 Brian Cameron 2007-04-20 08:08:34 UTC
Oh, perhaps it is reasonable to use GTK when using -a, but not when running --command without -a.  To authenticate, you obviously need a display.  Sorry about my confusion there.

It should be okay, for example, for users to run commands that don't require authentication (like GET_CONFIG or UPDATE_CONFIG) to run without a display. 
That's what I mean tot say.

Comment 4 William Jon McCann 2007-04-20 15:32:51 UTC
Fixed in trunk.

2007-04-20  William Jon McCann  <mccann@jhu.edu>

	* gui/gdmflexiserver.c: (maybe_lock_screen), (main):
	Properly initialize gtk.  Fixes #431044
Comment 5 Brian Cameron 2007-04-23 10:38:48 UTC
William, did you test to make sure that you can run gdmflexiserver --command="GET_CONFIG key/foo" and other commands that do not take -a from console login to make sure that it still works (and doesn't generate any errors/warnings about there being no display to connect to) after your change?  

Also, I'd appreciate any comments to explain the changes if there's anything that isn't completely obvious.