[Pkg-utopia-maintainers] Bug#492686: consolekit: Crash on startup if /var/run/console/ does not exist

Martin Pitt martin.pitt at ubuntu.com
Mon Jul 28 07:27:03 UTC 2008


Package: consolekit
Version: 0.2.10-1
Severity: grave
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch intrepid

Hi Michael,

thanks for 0.2.10-1, it is a great release. I just noticed a small bug
in the "clean /var/run/console/" patch, if the directory does not
exist at all, it crashes with:

$ sudo console-kit-daemon --debug --no-daemon
console-kit-daemon[6206]: DEBUG: Debugging enabled
console-kit-daemon[6206]: DEBUG: initializing console-kit-daemon 0.2.10
console-kit-daemon[6206]: DEBUG: Cleaning up /var/run/console
console-kit-daemon[6206]: GLib-WARNING: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Error opening directory '/var/run/console': No such file or directory
Segmentation fault

I fixed the GError handling in attached patch, and also demoted
g_warning to g_debug, since it is not an error at all if
/var/run/console/ does not exist at startup (e. g. if you enabled
RAMRUN in /etc/default/rcS).

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
  * 03-cleanup_console_tags.patch: Properly initialize GError to avoid daemon
    crash if /var/run/console/ does not exist. Also, demote message about it
    from warning to debug, since it is not an error condition at all.
--- consolekit-0.2.10/debian/patches/03-cleanup_console_tags.patch
+++ consolekit-0.2.10/debian/patches/03-cleanup_console_tags.patch
@@ -12,14 +12,14 @@
 +delete_console_tags (void)
 +{
 +	GDir *dir;
-+	GError *error;
++	GError *error = NULL;
 +	const gchar *name;
 +
 +	g_debug ("Cleaning up %s", CONSOLE_TAGS_DIR);
 +
 +	dir = g_dir_open (CONSOLE_TAGS_DIR, 0, &error);
 +	if (dir == NULL) {
-+		g_warning ("Couldn't open directory %s: %s", CONSOLE_TAGS_DIR,
++		g_debug ("Couldn't open directory %s: %s", CONSOLE_TAGS_DIR,
 +		           error->message);
 +		g_error_free (error);
 +		return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20080728/4643bca8/attachment-0001.pgp 


More information about the Pkg-utopia-maintainers mailing list