summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-11-20 18:10:19 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2010-11-20 18:10:19 +0100
commit6ed43e448dd175d253caa64a9b9b78036dc7809f (patch)
treeeb945fbe4412c54e6404963dd41287349da3fe90
parentd86d38d0ad1c9f8eded897a323c1d5d2267ba3b2 (diff)
downloadconsolekit-6ed43e448dd175d253caa64a9b9b78036dc7809f.tar.gz
Add 01-retry-console-open-on-EIO.patch: As reported in LP: #544139, ConsoleKit sometimes fails to track the active VT. This particular case was tracked down to a race condition that happens if you try to open /dev/console while the current TTY is currently being closed. This yields an -EIO error, in which case CK should just try again. Thanks Colin Watson for the patch!
-rw-r--r--debian/changelog11
-rw-r--r--debian/patches/01-retry-console-open-on-EIO.patch61
-rw-r--r--debian/patches/series1
3 files changed, 73 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index d61d3e1..2c8a335 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+consolekit (0.4.3-2) UNRELEASED; urgency=low
+
+ * Add 01-retry-console-open-on-EIO.patch: As reported in LP: #544139,
+ ConsoleKit sometimes fails to track the active VT. This particular case
+ was tracked down to a race condition that happens if you try to open
+ /dev/console while the current TTY is currently being closed. This yields
+ an -EIO error, in which case CK should just try again. Thanks Colin Watson
+ for the patch!
+
+ -- Martin Pitt <mpitt@debian.org> Sat, 20 Nov 2010 18:09:00 +0100
+
consolekit (0.4.3-1) unstable; urgency=low
* New upstream release.
diff --git a/debian/patches/01-retry-console-open-on-EIO.patch b/debian/patches/01-retry-console-open-on-EIO.patch
new file mode 100644
index 0000000..5f81f94
--- /dev/null
+++ b/debian/patches/01-retry-console-open-on-EIO.patch
@@ -0,0 +1,61 @@
+From 3665e8094e50f1f70b02a34d96c005ce152d62a6 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Sat, 20 Nov 2010 17:57:22 +0100
+Subject: [PATCH] Retry opening console device on EIO
+
+As reported in https://launchpad.net/bugs/544139, ConsoleKit sometimes fails to
+track the active VT. This particular case was tracked down to a race condition
+that happens if you try to open /dev/console while the current TTY is currently
+being closed. This yields an -EIO error, in which case CK should just try
+again.
+
+For a more detailled summary of the problem from a kernel perspective, please
+see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245 .
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=31790
+Bug-Ubuntu: https://launchpad.net/bugs/544139
+---
+ src/ck-sysdeps-unix.c | 17 +++++++++++++++++
+ 1 files changed, 17 insertions(+), 0 deletions(-)
+
+diff --git a/src/ck-sysdeps-unix.c b/src/ck-sysdeps-unix.c
+index e4ab16b..4a1736c 100644
+--- a/src/ck-sysdeps-unix.c
++++ b/src/ck-sysdeps-unix.c
+@@ -26,6 +26,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <errno.h>
++#include <time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+@@ -150,9 +151,25 @@ open_a_console (char *fnam)
+ {
+ int fd;
+
++again:
+ fd = open (fnam, O_RDONLY | O_NOCTTY);
+ if (fd < 0 && errno == EACCES)
+ fd = open (fnam, O_WRONLY | O_NOCTTY);
++#ifdef __linux__
++ if (fd < 0 && errno == EIO) {
++ /* Linux can return EIO if the tty is currently closing,
++ * which can happen if multiple processes are opening and
++ * closing the console in parallel. Unfortunately it can
++ * also return EIO in more serious situations too (see
++ * https://bugs.launchpad.net/bugs/554172), but there isn't
++ * much we can do about that since we really need a console
++ * fd.
++ */
++ struct timespec ts = { 0, 100000000 }; /* 0.1 seconds */
++ nanosleep (&ts, NULL);
++ goto again;
++ }
++#endif
+
+ if (fd < 0)
+ return -1;
+--
+1.7.2.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 1591648..ce23ce9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
# Debian patches for consolekit
+01-retry-console-open-on-EIO.patch
03-cleanup_console_tags.patch
82-hurd_support.patch