summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <Brian.Cameron@sun.com>2009-11-09 14:14:51 -0600
committerBrian Cameron <Brian.Cameron@sun.com>2009-11-09 14:14:51 -0600
commitf5b2931ffab26995970ebbbe0af2fafd985753a1 (patch)
tree1325364e70daf55c46a5b3c60f6ad61df948516f
parent63ce2462db5d6b1cce8f420046b2bcf079de3f2f (diff)
downloadgdm-f5b2931ffab26995970ebbbe0af2fafd985753a1.tar.gz
Fix GDM debugging so that it works. Now debugging is enabled via the
debug/Enable key in the custom.conf file. See bug #596831.
-rw-r--r--common/gdm-settings-keys.h2
-rw-r--r--daemon/factory-slave-main.c29
-rw-r--r--daemon/main.c18
-rw-r--r--daemon/product-slave-main.c29
-rw-r--r--daemon/session-worker-main.c29
-rw-r--r--daemon/simple-slave-main.c15
-rw-r--r--daemon/xdmcp-chooser-slave-main.c13
-rw-r--r--data/gdm.conf-custom.in2
-rw-r--r--data/gdm.schemas.in.in6
-rw-r--r--docs/C/gdm.xml62
-rw-r--r--gui/simple-greeter/gdm-simple-greeter.schemas.in11
-rw-r--r--gui/simple-greeter/greeter-main.c12
12 files changed, 148 insertions, 80 deletions
diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h
index 3b8016e6..e0637f55 100644
--- a/common/gdm-settings-keys.h
+++ b/common/gdm-settings-keys.h
@@ -33,6 +33,8 @@ G_BEGIN_DECLS
#define GDM_KEY_TIMED_LOGIN_USER "daemon/TimedLogin"
#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay"
+#define GDM_KEY_DEBUG "debug/Enable"
+
#define GDM_KEY_DISALLOW_TCP "security/DisallowTCP"
#define GDM_KEY_XDMCP_ENABLE "xdmcp/Enable"
diff --git a/daemon/factory-slave-main.c b/daemon/factory-slave-main.c
index d8a13381..8a99749f 100644
--- a/daemon/factory-slave-main.c
+++ b/daemon/factory-slave-main.c
@@ -44,7 +44,12 @@
#include "gdm-common.h"
#include "gdm-factory-slave.h"
-static int gdm_return_code = 0;
+#include "gdm-settings.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
+
+static GdmSettings *settings = NULL;
+static int gdm_return_code = 0;
static DBusGConnection *
get_system_bus (void)
@@ -145,14 +150,17 @@ on_slave_stopped (GdmSlave *slave,
}
static gboolean
-is_debug_set (gboolean arg)
+is_debug_set (void)
{
+ gboolean debug = FALSE;
+
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- return arg;
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}
int
@@ -164,10 +172,8 @@ main (int argc,
DBusGConnection *connection;
GdmSlave *slave;
static char *display_id = NULL;
- static gboolean debug = FALSE;
GdmSignalHandler *signal_handler;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("ID") },
{ NULL }
};
@@ -193,7 +199,18 @@ main (int argc,
gdm_log_init ();
- gdm_log_set_debug (is_debug_set (debug));
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
+ }
+
+ if (! gdm_settings_direct_init (settings, GDMCONFDIR "/gdm.schemas", "/")) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
+ }
+
+ gdm_log_set_debug (is_debug_set ());
if (display_id == NULL) {
g_critical ("No display ID set");
diff --git a/daemon/main.c b/daemon/main.c
index 5bb407af..cfc3655a 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -499,6 +499,20 @@ signal_cb (int signo,
return ret;
}
+static gboolean
+is_debug_set (void)
+{
+ gboolean debug = FALSE;
+
+ /* enable debugging for unstable builds */
+ if (gdm_is_version_unstable ()) {
+ return TRUE;
+ }
+
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
+}
+
int
main (int argc,
char **argv)
@@ -512,12 +526,10 @@ main (int argc,
gboolean res;
gboolean xdmcp_enabled;
GdmSignalHandler *signal_handler;
- static gboolean debug = FALSE;
static gboolean do_timed_exit = FALSE;
static gboolean print_version = FALSE;
static gboolean fatal_warnings = FALSE;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &fatal_warnings, N_("Make all warnings fatal"), NULL },
{ "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time - for debugging"), NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print GDM version"), NULL },
@@ -585,7 +597,7 @@ main (int argc,
goto out;
}
- gdm_log_set_debug (debug);
+ gdm_log_set_debug (is_debug_set ());
gdm_daemon_change_user (&gdm_uid, &gdm_gid);
gdm_daemon_check_permissions (gdm_uid, gdm_gid);
diff --git a/daemon/product-slave-main.c b/daemon/product-slave-main.c
index 3072648d..b696ad2e 100644
--- a/daemon/product-slave-main.c
+++ b/daemon/product-slave-main.c
@@ -44,7 +44,12 @@
#include "gdm-common.h"
#include "gdm-product-slave.h"
-static int gdm_return_code = 0;
+#include "gdm-settings.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
+
+static GdmSettings *settings = NULL;
+static int gdm_return_code = 0;
static DBusGConnection *
get_system_bus (void)
@@ -149,14 +154,17 @@ on_slave_stopped (GdmSlave *slave,
}
static gboolean
-is_debug_set (gboolean arg)
+is_debug_set (void)
{
+ gboolean debug = FALSE;
+
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- return arg;
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}
int
@@ -168,10 +176,8 @@ main (int argc,
DBusGConnection *connection;
GdmSlave *slave;
static char *display_id = NULL;
- static gboolean debug = FALSE;
GdmSignalHandler *signal_handler;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("ID") },
{ NULL }
};
@@ -197,7 +203,18 @@ main (int argc,
gdm_log_init ();
- gdm_log_set_debug (is_debug_set (debug));
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ goto out;
+ }
+
+ if (! gdm_settings_direct_init (settings, GDMCONFDIR "/gdm.schemas", "/")) {
+ g_warning ("Unable to initialize settings");
+ goto out;
+ }
+
+ gdm_log_set_debug (is_debug_set ());
if (display_id == NULL) {
g_critical ("No display ID set");
diff --git a/daemon/session-worker-main.c b/daemon/session-worker-main.c
index 6709cbeb..babe827f 100644
--- a/daemon/session-worker-main.c
+++ b/daemon/session-worker-main.c
@@ -44,9 +44,15 @@
#include "gdm-log.h"
#include "gdm-session-worker.h"
+#include "gdm-settings.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
+
#define SERVER_DBUS_PATH "/org/gnome/DisplayManager/SessionServer"
#define SERVER_DBUS_INTERFACE "org.gnome.DisplayManager.SessionServer"
+static GdmSettings *settings = NULL;
+
static gboolean
signal_cb (int signo,
gpointer data)
@@ -113,14 +119,17 @@ signal_cb (int signo,
}
static gboolean
-is_debug_set (gboolean arg)
+is_debug_set (void)
{
+ gboolean debug = FALSE;
+
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- return arg;
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}
int
@@ -132,9 +141,7 @@ main (int argc,
GdmSessionWorker *worker;
GdmSignalHandler *signal_handler;
const char *address;
- static gboolean debug = FALSE;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ NULL }
};
@@ -153,7 +160,19 @@ main (int argc,
g_option_context_free (context);
gdm_log_init ();
- gdm_log_set_debug (is_debug_set (debug));
+
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
+ }
+
+ if (! gdm_settings_direct_init (settings, GDMCONFDIR "/gdm.schemas", "/")) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
+ }
+
+ gdm_log_set_debug (is_debug_set ());
address = g_getenv ("GDM_SESSION_DBUS_ADDRESS");
if (address == NULL) {
diff --git a/daemon/simple-slave-main.c b/daemon/simple-slave-main.c
index b8926d8b..629f004b 100644
--- a/daemon/simple-slave-main.c
+++ b/daemon/simple-slave-main.c
@@ -46,7 +46,9 @@
#include "gdm-settings.h"
#include "gdm-settings-direct.h"
-#include "gdm-settings-client.h"
+#include "gdm-settings.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
static GdmSettings *settings = NULL;
static int gdm_return_code = 0;
@@ -154,14 +156,17 @@ on_slave_stopped (GdmSlave *slave,
}
static gboolean
-is_debug_set (gboolean arg)
+is_debug_set (void)
{
+ gboolean debug = FALSE;
+
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- return arg;
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}
int
@@ -173,10 +178,8 @@ main (int argc,
DBusGConnection *connection;
GdmSlave *slave;
static char *display_id = NULL;
- static gboolean debug = FALSE;
GdmSignalHandler *signal_handler;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("ID") },
{ NULL }
};
@@ -216,7 +219,7 @@ main (int argc,
goto out;
}
- gdm_log_set_debug (is_debug_set (debug));
+ gdm_log_set_debug (is_debug_set ());
if (display_id == NULL) {
g_critical ("No display ID set");
diff --git a/daemon/xdmcp-chooser-slave-main.c b/daemon/xdmcp-chooser-slave-main.c
index b875bfcd..a35c978e 100644
--- a/daemon/xdmcp-chooser-slave-main.c
+++ b/daemon/xdmcp-chooser-slave-main.c
@@ -43,8 +43,10 @@
#include "gdm-log.h"
#include "gdm-common.h"
#include "gdm-xdmcp-chooser-slave.h"
+
#include "gdm-settings.h"
#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
static GdmSettings *settings = NULL;
static int gdm_return_code = 0;
@@ -154,14 +156,17 @@ on_slave_stopped (GdmSlave *slave,
}
static gboolean
-is_debug_set (gboolean arg)
+is_debug_set (void)
{
+ gboolean debug = FALSE;
+
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- return arg;
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}
int
@@ -173,10 +178,8 @@ main (int argc,
DBusGConnection *connection;
GdmSlave *slave;
static char *display_id = NULL;
- static gboolean debug = FALSE;
GdmSignalHandler *signal_handler;
static GOptionEntry entries [] = {
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("ID") },
{ NULL }
};
@@ -213,7 +216,7 @@ main (int argc,
goto out;
}
- gdm_log_set_debug (is_debug_set (debug));
+ gdm_log_set_debug (is_debug_set ());
if (display_id == NULL) {
g_critical ("No display ID set");
diff --git a/data/gdm.conf-custom.in b/data/gdm.conf-custom.in
index c2bdaf20..6cbfaeb6 100644
--- a/data/gdm.conf-custom.in
+++ b/data/gdm.conf-custom.in
@@ -8,3 +8,5 @@
[security]
+[debug]
+
diff --git a/data/gdm.schemas.in.in b/data/gdm.schemas.in.in
index 82a2223b..a3e06f29 100644
--- a/data/gdm.schemas.in.in
+++ b/data/gdm.schemas.in.in
@@ -49,6 +49,12 @@
</schema>
<schema>
+ <key>debug/Enable</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+
+ <schema>
<key>security/DisallowTCP</key>
<signature>b</signature>
<default>true</default>
diff --git a/docs/C/gdm.xml b/docs/C/gdm.xml
index 34277070..d2c38f7f 100644
--- a/docs/C/gdm.xml
+++ b/docs/C/gdm.xml
@@ -500,8 +500,9 @@
<para>
GDM uses syslog to log errors and status. It can also log debugging
information, which can be useful for tracking down problems if GDM is
- not working properly. This can be enabled by starting the GDM daemon
- with the "--debug" option.
+ not working properly. Debug output can be enabled by setting the
+ debug/Enable key to &quot;true&quot; in the
+ <filename>&lt;etc&gt;/gdm/custom.conf</filename> file.
</para>
<para>
@@ -1080,7 +1081,7 @@ PostSession/
<filename>&lt;etc&gt;/gdm/custom.conf</filename> file. Default
values are stored in GConf in the <filename>gdm.schemas</filename>
file. It is recommended that end-users modify the
- <filename>/etc/gdm/custom.conf</filename> file because the
+ <filename>&lt;etc&gt;/gdm/custom.conf</filename> file because the
schemas file may be overwritten when the user updates their system to
have a newer version of GDM.
</para>
@@ -1099,7 +1100,7 @@ PostSession/
</para>
<para>
- The file <filename>/etc/gdm/custom.conf</filename> supports the
+ The file <filename>&lt;etc&gt;/gdm/custom.conf</filename> supports the
"[daemon]", "[security]", and "[xdmcp]"
group sections. Within each group, there are particular key/value
pairs that can be specified to modify how GDM behaves. For example,
@@ -1267,6 +1268,30 @@ TimedLogin=you
</variablelist>
</sect3>
+ <sect3 id="debugsection">
+ <title>Debug Options</title>
+
+ <variablelist>
+ <title>[debug]</title>
+
+ <varlistentry>
+ <term>Enable</term>
+ <listitem>
+ <synopsis>Enable=false</synopsis>
+ <para>
+ To enable debugging, set the debug/Enable key to
+ &quot;true&quot; in the
+ <filename>&lt;etc&gt;/gdm/custom.conf</filename>
+ file and restart GDM. Then debug output will be sent to the
+ system log file (<filename>&lt;var&gt;/log/messages</filename>
+ or <filename>&lt;var&gt;/adm/messages</filename> depending on
+ your Operating System).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
<sect3 id="securitysection">
<title>Security Options</title>
@@ -1530,16 +1555,6 @@ gdm:.my.domain
</varlistentry>
<varlistentry>
- <term>/apps/gdm/simple-greeter/debug</term>
- <listitem>
- <synopsis>false (boolean)</synopsis>
- <para>
- If true, then debugging mode is enabled for the greeter.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term>/apps/gdm/simple-greeter/disable_restart_buttons</term>
<listitem>
<synopsis>false (boolean)</synopsis>
@@ -1991,18 +2006,6 @@ Language=cs_CZ.UTF-8
</varlistentry>
<varlistentry>
- <term>--debug</term>
- <listitem>
- <para>
- Print debug output to the syslog. This is typically
- <filename>&lt;var&gt;/log/messages</filename> or
- <filename>&lt;var&gt;/adm/messages</filename> depending on
- your Operating System.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term>--fatal-warnings</term>
<listitem>
<para>
@@ -2082,9 +2085,10 @@ Language=cs_CZ.UTF-8
<para>
If GDM is failing to work properly, it is always a good idea to include
- debug information. To turn on debug, launch gdm with the --debug
- option. Then use GDM to the point where it fails, and debug output will
- be sent to your system log
+ debug information. To enable debugging, set the debug/Enable key to
+ &quot;true&quot; in the <filename>&lt;etc&gt;/gdm/custom.conf</filename>
+ file and restart GDM. Then use GDM to the point where it fails, and
+ debug output will be sent to the system log file
(<filename>&lt;var&gt;/log/messages</filename> or
<filename>&lt;var&gt;/adm/messages</filename> depending on your Operating
System). If you share this output with the GDM community via a bug
diff --git a/gui/simple-greeter/gdm-simple-greeter.schemas.in b/gui/simple-greeter/gdm-simple-greeter.schemas.in
index f6e9a6b9..b69335df 100644
--- a/gui/simple-greeter/gdm-simple-greeter.schemas.in
+++ b/gui/simple-greeter/gdm-simple-greeter.schemas.in
@@ -1,17 +1,6 @@
<gconfschemafile>
<schemalist>
<schema>
- <key>/schemas/apps/gdm/simple-greeter/debug</key>
- <applyto>/apps/gdm/simple-greeter/debug</applyto>
- <owner>gdm-simple-greeter</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable debugging</short>
- <long>Enable debugging mode for the greeter.</long>
- </locale>
- </schema>
- <schema>
<key>/schemas/apps/gdm/simple-greeter/banner_message_enable</key>
<applyto>/apps/gdm/simple-greeter/banner_message_enable</applyto>
<owner>gdm-simple-greeter</owner>
diff --git a/gui/simple-greeter/greeter-main.c b/gui/simple-greeter/greeter-main.c
index 7a800288..09f9e08e 100644
--- a/gui/simple-greeter/greeter-main.c
+++ b/gui/simple-greeter/greeter-main.c
@@ -42,8 +42,6 @@
#include "gdm-greeter-session.h"
-#define DEBUG_KEY "/apps/gdm/simple-greeter/debug"
-
#define SM_DBUS_NAME "org.gnome.SessionManager"
#define SM_DBUS_PATH "/org/gnome/SessionManager"
#define SM_DBUS_INTERFACE "org.gnome.SessionManager"
@@ -58,19 +56,15 @@ static DBusGProxy *client_proxy = NULL;
static gboolean
is_debug_set (void)
{
- GConfClient *client;
- gboolean is;
+ gboolean debug = FALSE;
/* enable debugging for unstable builds */
if (gdm_is_version_unstable ()) {
return TRUE;
}
- client = gconf_client_get_default ();
- is = gconf_client_get_bool (client, DEBUG_KEY, NULL);
- g_object_unref (client);
-
- return is;
+ gdm_settings_client_get_boolean (GDM_KEY_DEBUG, &debug);
+ return debug;
}