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

Bug#330304: dpkg-reconfigure fails when resolution list is empty



Package: xserver-xorg
Version: 6.8.2.dfsg.1-7+kbsd
Severity: normal
Tags: patch

When configuring this package, if you reply to the resolution list template
(xserver-xorg/config/display/modes) with an empty list, this will make postinst
fail with:

  expr: syntax error

This is contrary to the description, which says an empty list is equivalent to a
full one (in that the server will find the highest resolution that works).

Attached patch solves the problem.  I noticed the "yes it sucks" comment, so
instead of making it worse by adding another hardcoded list, I fixed it for the
default list to be automaticaly added by debian/rules.

-- System Information:
Debian Release: testing/unstable
Architecture: kfreebsd-i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.4-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)

Versions of packages xserver-xorg depends on:
ii  debconf [debconf-2.0 1.4.58              Debian configuration management sy
ii  libc0.1              2.3-1+kbsd.11       GNU C Library: Shared libraries an
ii  libgcc1              1:4.0.1-9           GCC support library
ii  libxau6              6.8.2.dfsg.1-7      X Authentication library
ii  libxdmcp6            6.8.2.dfsg.1-7      X Display Manager Control Protocol
ii  xserver-common       6.8.2.dfsg.1-7+kbsd files and utilities common to all 
ii  zlib1g               1:1.2.3-4           compression library - runtime

Versions of packages xserver-xorg recommends:
pn  discover1                 <none>         (no description available)
pn  laptop-detect             <none>         (no description available)
pn  mdetect                   <none>         (no description available)
ii  xlibs                     6.8.2.dfsg.1-7 X Window System client libraries m
pn  xresprobe                 <none>         (no description available)

-- debconf information excluded
diff -ur xorg-x11-6.8.2.dfsg.1/debian.old/rules xorg-x11-6.8.2.dfsg.1/debian/rules
--- xorg-x11-6.8.2.dfsg.1/debian.old/rules	2005-09-26 20:42:15.000000000 +0200
+++ xorg-x11-6.8.2.dfsg.1/debian/rules	2005-09-26 20:52:59.000000000 +0200
@@ -76,6 +76,8 @@
 SERVER_WRAPPER_OPT=-O2
 endif
 
+DEFAULT_DCRESOLUTIONS="1920x1440, 1920x1200, 1856x1392, 1792x1344, 1680x1050, 1600x1200, 1440x900, 1400x1050, 1280x1024, 1280x960, 1280x854, 1280x800, 1280x768, 1200x800, 1152x864, 1152x768, 1024x768, 800x600, 640x480"
+
 # Set up parameters for the Debian build environment.
 
 # Determine our architecture.
@@ -288,6 +290,7 @@
 	      | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
 	    sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
 	        -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
+	        -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \
 	      <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
 	    rm $$MAINTSCRIPT.tmp; \
 	  fi; \
diff -ur xorg-x11-6.8.2.dfsg.1/debian.old/xserver-xorg.config.in xorg-x11-6.8.2.dfsg.1/debian/xserver-xorg.config.in
--- xorg-x11-6.8.2.dfsg.1/debian.old/xserver-xorg.config.in	2005-09-26 20:42:15.000000000 +0200
+++ xorg-x11-6.8.2.dfsg.1/debian/xserver-xorg.config.in	2005-09-26 20:52:59.000000000 +0200
@@ -486,8 +486,7 @@
   if [ "$RET" != "10 xserver-xfree86/config/display/modes doesn't exist" ]; then
     db_subst xserver-xorg/config/display/modes choices "$RET"
   else
-    # remember to keep this list in sync with postinst.in. Yes, it sucks!
-    db_subst xserver-xorg/config/display/modes choices "1920x1440, 1920x1200, 1856x1392, 1792x1344, 1680x1050, 1600x1200, 1440x900, 1400x1050, 1280x1024, 1280x960, 1280x854, 1280x800, 1280x768, 1200x800, 1152x864, 1152x768, 1024x768, 800x600, 640x480"
+    db_subst xserver-xorg/config/display/modes choices @DEFAULT_DCRESOLUTIONS@
   fi
   # migrate keyboard/rules
   db_get xserver-xorg/config/inputdevice/keyboard/rules
diff -ur xorg-x11-6.8.2.dfsg.1/debian.old/xserver-xorg.postinst.in xorg-x11-6.8.2.dfsg.1/debian/xserver-xorg.postinst.in
--- xorg-x11-6.8.2.dfsg.1/debian.old/xserver-xorg.postinst.in	2005-09-26 20:42:15.000000000 +0200
+++ xorg-x11-6.8.2.dfsg.1/debian/xserver-xorg.postinst.in	2005-09-26 20:52:59.000000000 +0200
@@ -392,7 +392,7 @@
     DCRESOLUTIONS="$RET"
     DCRESOLUTIONS=$(echo $DCRESOLUTIONS | sed -e 's/, / /g')
   else
-    DCRESOLUTIONS="1920x1440 1920x1200 1856x1392 1792x1344 1680x1050 1600x1200 1440x900 1400x1050 1280x1024 1280x960 1280x854 1280x800 1280x768 1200x800 1152x864 1152x768 1024x768 800x600 640x480"
+    DCRESOLUTIONS=@DEFAULT_DCRESOLUTIONS@
   fi
   if [ -n "$RESOLUTIONS" ]; then
     DCRESOLUTIONS=$(for i in $DCRESOLUTIONS $RESOLUTIONS; do echo $i; done | sort -unr)
@@ -421,6 +421,9 @@
       # if we are here we did not detect the frequencies, but we have the resolution.
       # get the highest resolution.
       db_get xserver-xorg/config/display/modes
+      if [ -z "$RET" ]; then
+        RET=@DEFAULT_DCRESOLUTIONS@
+      fi
       MAXRES=$(echo $RET | sed -e 's/,//g')
       MAXRES=$(for i in $MAXRES; do echo $i; done | sort -unr | head -n 1)
       # set a sane default for mode-list

Reply to: