GNOME Bugzilla – Bug 431044
gdmflexiserver gtk-init bug
Last modified: 2007-04-23 10:38:48 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.
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.
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
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.
Fixed in trunk. 2007-04-20 William Jon McCann <mccann@jhu.edu> * gui/gdmflexiserver.c: (maybe_lock_screen), (main): Properly initialize gtk. Fixes #431044
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.