From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QAopG-0000uh-Co for garchives@archives.gentoo.org; Fri, 15 Apr 2011 19:37:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 506821C01E; Fri, 15 Apr 2011 19:36:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id ED1CC1C01E for ; Fri, 15 Apr 2011 19:36:57 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4051F1B401E for ; Fri, 15 Apr 2011 19:36:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 48C0180065 for ; Fri, 15 Apr 2011 19:36:56 +0000 (UTC) From: "Nirbheek Chauhan" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Nirbheek Chauhan" Message-ID: Subject: [gentoo-commits] proj/gnome:master commit in: gnome-base/gdm/, gnome-base/gdm/files/ X-VCS-Repository: proj/gnome X-VCS-Files: gnome-base/gdm/files/gdm-3.0.0-fix-vt-problems.patch gnome-base/gdm/gdm-3.0.0-r1.ebuild gnome-base/gdm/gdm-3.0.0.ebuild X-VCS-Directories: gnome-base/gdm/ gnome-base/gdm/files/ X-VCS-Committer: nirbheek X-VCS-Committer-Name: Nirbheek Chauhan X-VCS-Revision: c0ded3e0fe2576cf70a224394ee08d18b6fcfd98 Date: Fri, 15 Apr 2011 19:36:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 29cb56c8d65298eb662b48e433c5f50d commit: c0ded3e0fe2576cf70a224394ee08d18b6fcfd98 Author: Nirbheek Chauhan gentoo org> AuthorDate: Fri Apr 15 19:31:06 2011 +0000 Commit: Nirbheek Chauhan gentoo org> CommitDate: Fri Apr 15 19:35:43 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gnome.git;a=3D= commit;h=3Dc0ded3e0 gnome-base/gdm: fix bug 261339, bug 288852, bug 284053, remove old cruft * VT detection should finally be fixed. See patch for details. --- .../gdm/files/gdm-3.0.0-fix-vt-problems.patch | 195 ++++++++++++++= ++++++ .../gdm/{gdm-3.0.0.ebuild =3D> gdm-3.0.0-r1.ebuild} | 33 +--- 2 files changed, 202 insertions(+), 26 deletions(-) diff --git a/gnome-base/gdm/files/gdm-3.0.0-fix-vt-problems.patch b/gnome= -base/gdm/files/gdm-3.0.0-fix-vt-problems.patch new file mode 100644 index 0000000..b7ceb49 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.0.0-fix-vt-problems.patch @@ -0,0 +1,195 @@ +From 64002e623fea54ab10040206d164c5fdee4a43d2 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Fri, 15 Apr 2011 22:13:44 +0530 +Subject: [PATCH] Fix VT grab race with getty causing X to grab the wrong= VT + +On bootup, if X is spawned without any args, it'll take up the first unu= sed VT. +If GDM starts up before gettys are spawned, X takes up VT1 or VT2 depend= ing on +the init system and bootsplash. + +This is problematic because afterwards getty will come up underneath X, = and +cause keyboard problems and eventually crash X. + +So we read /etc/inittab, check for open VTs, compare the two values, and= take +the conservative one. +--- + configure.ac | 4 ++ + daemon/Makefile.am | 1 + + daemon/gdm-server.c | 106 ++++++++++++++++++++++++++++++++++++++++++++= ++++++- + 3 files changed, 110 insertions(+), 1 deletions(-) + +diff --git a/configure.ac b/configure.ac +index ca0f8bb..b9e7462 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -302,6 +302,10 @@ AC_CHECK_TYPE(socklen_t,, + AC_CHECK_HEADERS(sys/sockio.h) + AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv]) +=20 ++dnl Needed for querying the kernel for free VTs ++AC_CHECK_HEADERS(sys/vt.h) ++AC_CHECK_HEADERS(sys/ioctl.h) ++ + dnl checks needed for Darwin compatibility to linux **environ. + AC_CHECK_HEADERS(crt_externs.h) + AC_CHECK_FUNCS(_NSGetEnviron) +diff --git a/daemon/Makefile.am b/daemon/Makefile.am +index da18835..c1b6bda 100644 +--- a/daemon/Makefile.am ++++ b/daemon/Makefile.am +@@ -14,6 +14,7 @@ AM_CPPFLAGS =3D \ + -DLIBEXECDIR=3D\"$(libexecdir)\" \ + -DLOGDIR=3D\"$(logdir)\" \ + -DSBINDIR=3D\"$(sbindir)\" \ ++ -DSYSCONFDIR=3D\""$(sysconfdir)"\" \ + -DGNOMELOCALEDIR=3D\""$(datadir)/locale"\" \ + -DGDM_XAUTH_DIR=3D\"$(GDM_XAUTH_DIR)\" \ + -DGDM_SCREENSHOT_DIR=3D\"$(GDM_SCREENSHOT_DIR)\" \ +diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c +index 339f3cc..29d16dc 100644 +--- a/daemon/gdm-server.c ++++ b/daemon/gdm-server.c +@@ -26,6 +26,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -42,6 +44,7 @@ + #include + #include + #include ++#include +=20 + #include /* for Display */ +=20 +@@ -54,6 +57,8 @@ extern char **environ; +=20 + #define GDM_SERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GD= M_TYPE_SERVER, GdmServerPrivate)) +=20 ++#define INITTAB SYSCONFDIR"/inittab" ++ + /* These are the servstat values, also used as server + * process exit codes */ + #define SERVER_TIMEOUT 2 /* Server didn't start */ +@@ -674,6 +679,105 @@ gdm_server_spawn (GdmServer *server, + } +=20 + /** ++ * Parse the inittab file used by getty to spawn VTs to find unused tty= s ++ */ ++int ++get_free_vt_from_inittab () ++{ ++ GFile *gfile; ++ GFileInputStream *contents; ++ GDataInputStream *dstream; ++ GRegex *getty; ++ GMatchInfo *tty_match =3D NULL; ++ GSList *tty_list =3D NULL; ++ GError *error =3D NULL; ++ gchar *temp =3D NULL; ++ int vtno =3D 0; ++ ++ gfile =3D g_file_new_for_path (INITTAB); ++ contents =3D g_file_read (gfile, NULL, &error); ++ g_object_unref (gfile); ++ if (!contents) { ++ if (error) { ++ g_debug ("Unable to open file %s", INITTAB); ++ g_error_free (error); ++ } ++ goto out; ++ } ++ ++ dstream =3D g_data_input_stream_new (G_INPUT_STREAM (contents))= ; ++ getty =3D g_regex_new ("^c[0-9]+:.+getty.+tty([0-9]+)", 0, 0, N= ULL); ++ g_object_unref (contents); ++ ++ while (1) { ++ temp =3D g_data_input_stream_read_line (dstream, NULL, = NULL, &error); ++ if (!temp) ++ break; ++ if (!g_regex_match (getty, temp, 0, &tty_match)) ++ continue; ++ g_free (temp); ++ temp =3D g_match_info_fetch (tty_match, 1); ++ if (!temp) ++ continue; ++ tty_list =3D g_slist_insert_sorted (tty_list, temp, (GC= ompareFunc)g_strcmp0); ++ g_match_info_free (tty_match); ++ } ++ ++ if (error) { ++ g_debug ("Unable to read line from %s", INITTAB); ++ g_error_free (error); ++ goto free; ++ } ++ ++ /* Ignore holes in vt allocation, just take the last one */ ++ temp =3D g_slist_last (tty_list)->data; ++ if (temp) ++ vtno =3D (int) g_ascii_strtoull (temp, NULL, 10) + 1; ++ ++free: ++ g_object_unref (dstream); ++ g_regex_unref (getty); ++ g_slist_free_full (tty_list, g_free); ++ g_free (error); ++out: ++ return vtno; ++} ++ ++/** ++ * Query the VT_* kernel ioctls to find an empty tty ++ */ ++int ++get_free_vt_from_kernel() ++{ ++ int fd, vtno =3D 0; ++ ++ fd =3D open ("/dev/tty0", O_WRONLY, 0); ++ if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) || (vtno =3D=3D -1)) { ++ vtno =3D 0; ++ g_debug ("Unable to find a free vt, falling back to Xor= g autodetect"); ++ } ++ return vtno; ++} ++ ++gchar* ++get_free_vt () ++{ ++ int inittab_vtno, kernel_vtno; ++ gchar* vt =3D NULL; ++ ++ inittab_vtno =3D get_free_vt_from_inittab(); ++ if (inittab_vtno > 0) ++ g_debug ("Inittab says vt%i is free\n", inittab_vtno); ++ kernel_vtno =3D get_free_vt_from_kernel(); ++ if (kernel_vtno > 0) ++ g_debug ("Kernel says vt%i is free\n", kernel_vtno); ++ /* Select the greater of the two because getty will use the oth= ers */ ++ if (kernel_vtno !=3D 0 && inittab_vtno !=3D 0) ++ vt =3D g_strdup_printf ("vt%i", kernel_vtno > inittab_v= tno ? kernel_vtno : inittab_vtno); ++ return vt; ++} ++ ++/** + * gdm_server_start: + * @disp: Pointer to a GdmDisplay structure + * +@@ -686,7 +790,7 @@ gdm_server_start (GdmServer *server) + gboolean res; +=20 + /* fork X server process */ +- res =3D gdm_server_spawn (server, NULL); ++ res =3D gdm_server_spawn (server, get_free_vt()); +=20 + return res; + } +--=20 +1.7.3.4 + diff --git a/gnome-base/gdm/gdm-3.0.0.ebuild b/gnome-base/gdm/gdm-3.0.0-r= 1.ebuild similarity index 84% rename from gnome-base/gdm/gdm-3.0.0.ebuild rename to gnome-base/gdm/gdm-3.0.0-r1.ebuild index 6b964ab..0e43a55 100644 --- a/gnome-base/gdm/gdm-3.0.0.ebuild +++ b/gnome-base/gdm/gdm-3.0.0-r1.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/gnome-base/gdm/gdm-2.32.0.ebuild,v 1.= 2 2010/11/11 11:48:55 ssuominen Exp $ +# $Header: $ =20 EAPI=3D"3" GCONF_DEBUG=3D"yes" @@ -90,7 +90,6 @@ pkg_setup() { --with-xdmcp=3Dyes --enable-authentication-scheme=3Dpam --with-pam-prefix=3D/etc - SOUND_PROGRAM=3D/usr/bin/gdmplay $(use_with accessibility xevie) $(use_enable ipv6) $(use_enable xklavier libxklavier) @@ -112,9 +111,8 @@ src_prepare() { # daemonize so that the boot process can continue, bug #236701 epatch "${FILESDIR}/${PN}-2.32.0-fix-daemonize-regression.patch" =20 - # fix VT grab problem causing GDM to grab VT2 instead of 7, bug #261339 - # FIXME FIXME FIXME: this is due to a race b/w getty and gdm - #epatch "${FILESDIR}/${PN}-2.32.0-broken-VT-detection.patch" + # GDM grabs VT2 instead of VT7, bug 261339, bug 284053, bug 288852 + epatch "${FILESDIR}/${PN}-3.0.0-fix-vt-problems.patch" =20 # make custom session work, bug #216984 epatch "${FILESDIR}/${PN}-2.32.0-custom-session.patch" @@ -125,7 +123,7 @@ src_prepare() { # fix libxklavier automagic support epatch "${FILESDIR}/${PN}-2.32.0-automagic-libxklavier-support.patch" =20 - mkdir "${S}"/m4 + mkdir -p "${S}"/m4 intltoolize --force --copy --automake || die "intltoolize failed" eautoreconf } @@ -135,6 +133,7 @@ src_install() { =20 local gentoodir=3D"${WORKDIR}/${GDM_EXTRA}" =20 + # FIXME: Remove dosym usage, gone in EAPI 4 # gdm-binary should be gdm to work with our init (#5598) rm -f "${D}/usr/sbin/gdm" dosym /usr/sbin/gdm-binary /usr/sbin/gdm @@ -144,14 +143,6 @@ src_install() { =20 # log, etc. keepdir /var/log/gdm - keepdir /var/gdm - - fowners root:gdm /var/gdm - fperms 1770 /var/gdm - - # add a custom xsession .desktop by default (#44537) - exeinto /etc/X11/dm/Sessions - doexe "${gentoodir}/custom.desktop" || die "doexe 1 failed" =20 # add xinitrc.d scripts exeinto /etc/X11/xinit/xinitrc.d @@ -162,19 +153,9 @@ src_install() { echo 'XDG_DATA_DIRS=3D"/usr/share/gdm"' > 99xdg-gdm doenvd 99xdg-gdm || die "doenvd failed" =20 - # add a custom sound playing script (#248253) - dobin "${gentoodir}/gdmplay" - - # avoid file collision, bug #213118 - rm -f "${D}/usr/share/xsessions/gnome.desktop" - - # We replace the pam stuff by our own - rm -rf "${D}/etc/pam.d" - use gnome-keyring && sed -i "s:#Keyring=3D::g" "${gentoodir}"/pam.d/* =20 - dopamd "${gentoodir}"/pam.d/* - dopamsecurity console.apps "${gentoodir}/security/console.apps/gdmsetup= " + dopamd "${gentoodir}"/pam.d/gdm{,-autologin} } =20 pkg_postinst() {