[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#521122: console-setup: fails to install: "eval: line 2125: unexpected EOF while looking for matching `"'"



tag 521122 patch
kthxbye

On Tue, 2009-03-24 at 21:18 -0400, Celejar wrote:
> On Wed, 25 Mar 2009 02:06:03 +0100
> Julien Cristau <jcristau@debian.org> wrote:
> 
> ...
> 
> > can you send your /etc/X11/xorg.conf file to this bug?
> 
> Attached.

Thanks, the problem was the space in the XkbOptions value which my
script didn't handle.  The attached patch fixes that.

Cheers,
Julien
From d621fe355816546cb40f13f7b38e8d10504a3fcb Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Wed, 25 Mar 2009 03:06:02 +0100
Subject: [PATCH] Adjust parsing of xorg.conf to handle spaces in option values

* Handle comments when parsing xorg.conf.
* Fix parsing of xorg.conf option values with embedded space characters.
  Reported by Celejar <celejar@gmail.com> (closes: #521122).
---
 debian/changelog    |    8 ++++++++
 debian/config.proto |   32 ++++++++++++++++++++++++--------
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6f7b9be..6530979 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+console-setup (1.30) UNRELEASED; urgency=low
+
+  * Handle comments when parsing xorg.conf.
+  * Fix parsing of xorg.conf option values with embedded space characters.
+    Reported by Celejar <celejar@gmail.com> (closes: #521122).
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 25 Mar 2009 03:03:18 +0100
+
 console-setup (1.29) unstable; urgency=low
 
   [ Anton Zinoviev ]
diff --git a/debian/config.proto b/debian/config.proto
index a79c443..d2d5567 100644
--- a/debian/config.proto
+++ b/debian/config.proto
@@ -1172,20 +1172,36 @@ if [ -f /etc/X11/xorg.conf ] && which awk >/dev/null; then
     awk_expr='
 BEGIN { state=0 }
 {
+    # get rid of comments
+    sub("#.*$", "")
+
     if (state == 0) {
         if (tolower($1) == "section" && tolower($2) == "\"inputdevice\"")
             state = 1
     }
     if (state == 1) {
         if (tolower($1) == "option") {
-            if (tolower($2) == "\"xkbmodel\"")
-                xkbmodel = $3
-            if (tolower($2) == "\"xkblayout\"")
-                xkblayout = $3
-            if (tolower($2) == "\"xkbvariant\"")
-                xkbvariant = $3
-            if (tolower($2) == "\"xkboptions\"")
-                xkboptions = $3
+            if (tolower($2) == "\"xkbmodel\"") {
+		$1 = ""
+		$2 = ""
+		sub("^ *", "")
+                xkbmodel = $0
+	    } else if (tolower($2) == "\"xkblayout\"") {
+		$1 = ""
+		$2 = ""
+		sub("^ *", "")
+                xkblayout = $0
+	    } else if (tolower($2) == "\"xkbvariant\"") {
+		$1 = ""
+		$2 = ""
+		sub("^ *", "")
+                xkbvariant = $0
+	    } else if (tolower($2) == "\"xkboptions\"") {
+		$1 = ""
+		$2 = ""
+		sub("^ *", "")
+                xkboptions = $0
+	    }
         }
         if (tolower($1) == "endsection") {
             if (xkblayout) {
-- 
1.6.2.1


Reply to: