Author: branden
Date: 2004-06-03 22:36:07 -0500 (Thu, 03 Jun 2004)
New Revision: 1511

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/changelog
   trunk/debian/xserver-xfree86.config.in
Log:
Modify xserver-xfree86's config script to be more paranoid and mistrustful
of Discover.  Store standard error from checking for the installed version
of Discover instead of discarding it, and if this fails, report Discover's
error output to the user and trap the failure instead of permitting it to
break us.  (Thanks to Kevin B. McCarty for identifying the cause of these
mysterious failures; see #251690 and #252348.  Thanks also to the libcurl2
maintainer for the reminder that "The issue isn't whether you're
paranoid...The issue is whether you're paranoid *enough*." [Max Peltier])


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS     2004-06-04 03:17:34 UTC (rev 1510)
+++ trunk/debian/CHANGESETS     2004-06-04 03:36:07 UTC (rev 1511)
@@ -85,4 +85,14 @@
 (Closes: #225526)
     1510
 
+Modify xserver-xfree86's config script to be more paranoid and mistrustful
+of Discover.  Store standard error from checking for the installed version
+of Discover instead of discarding it, and if this fails, report Discover's
+error output to the user and trap the failure instead of permitting it to
+break us.  (Thanks to Kevin B. McCarty for identifying the cause of these
+mysterious failures; see #251690 and #252348.  Thanks also to the libcurl2
+maintainer for the reminder that "The issue isn't whether you're
+paranoid...The issue is whether you're paranoid *enough*." [Max Peltier])
+    1511
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2004-06-04 03:17:34 UTC (rev 1510)
+++ trunk/debian/changelog      2004-06-04 03:36:07 UTC (rev 1511)
@@ -89,8 +89,17 @@
     for the 2.6 style first (thanks, Daniel Seyffer and Ciaran McCreesh).
     (Closes: #225526)
 
- -- Branden Robinson <[EMAIL PROTECTED]>  Thu,  3 Jun 2004 14:14:49 -0500
+  * Modify xserver-xfree86's config script to be more paranoid and mistrustful
+    of Discover.  Store standard error from checking for the installed version
+    of Discover instead of discarding it, and if this fails, report Discover's
+    error output to the user and trap the failure instead of permitting it to
+    break us.  (Thanks to Kevin B. McCarty for identifying the cause of these
+    mysterious failures; see #251690 and #252348.  Thanks also to the libcurl2
+    maintainer for the reminder that "The issue isn't whether you're
+    paranoid...The issue is whether you're paranoid *enough*." [Max Peltier])
 
+ -- Branden Robinson <[EMAIL PROTECTED]>  Thu,  3 Jun 2004 22:28:14 -0500
+
 xfree86 (4.3.0.dfsg.1-4) unstable; urgency=medium
 
   * The "thanks for the 'testing'" release.

Modified: trunk/debian/xserver-xfree86.config.in
===================================================================
--- trunk/debian/xserver-xfree86.config.in      2004-06-04 03:17:34 UTC (rev 
1510)
+++ trunk/debian/xserver-xfree86.config.in      2004-06-04 03:36:07 UTC (rev 
1511)
@@ -47,31 +47,40 @@
   # wrapper for discover command that can distinguish Discover 1.x and 2.x
 
   # Ugh, Discover 1.x didn't exit with nonzero status if given an unrecongized 
option!
-  DISCOVER_TEST=$(discover --version 2> /dev/null)
-  if expr "$DISCOVER_TEST" : 'discover 2.*' > /dev/null 2>&1; then
-    # Discover 2.x
-    # XXX: this is sort of nasty
-    VENDOR_MODEL_FILE=$(tempfile)
-    SERVER_FILE=$(tempfile)
-    DRIVER_FILE=$(tempfile)
+  # Double ugh!  Discover is crashy.  People blame X when it crashes (but then,
+  # people blame X when *anything* crashes).
+  DISCOVER_ERRORFILE=$(tempfile)
+  if DISCOVER_TEST=$(discover --version 2>>"$DISCOVER_ERRORFILE"); then
+    if expr "$DISCOVER_TEST" : 'discover 2.*' > /dev/null 2>&1; then
+      # Discover 2.x
+      # XXX: this is sort of nasty
+      VENDOR_MODEL_FILE=$(tempfile)
+      SERVER_FILE=$(tempfile)
+      DRIVER_FILE=$(tempfile)
 
-    CMD="discover --type-summary display"
-    eval $CMD >>$VENDOR_MODEL_FILE || debug_report_status "$CMD" "$?"
-    CMD="discover --data-path=xfree86/server/name \
-                  --data-version=${SOURCE_VERSION%-*} display"
-    eval $CMD >>$SERVER_FILE || debug_report_status "$CMD" "$?"
-    CMD="discover --data-path=xfree86/server/device/driver \
-                  --data-version=${SOURCE_VERSION%-*} display"
-    eval $CMD >>$DRIVER_FILE || debug_report_status "$CMD" "$?"
+      CMD="discover --type-summary display"
+      eval $CMD >>$VENDOR_MODEL_FILE || debug_report_status "$CMD" "$?"
+      CMD="discover --data-path=xfree86/server/name \
+                    --data-version=${SOURCE_VERSION%-*} display"
+      eval $CMD >>$SERVER_FILE || debug_report_status "$CMD" "$?"
+      CMD="discover --data-path=xfree86/server/device/driver \
+                    --data-version=${SOURCE_VERSION%-*} display"
+      eval $CMD >>$DRIVER_FILE || debug_report_status "$CMD" "$?"
 
-    DISCOVERED_VIDEO=$(paste $VENDOR_MODEL_FILE $SERVER_FILE $DRIVER_FILE)
-    rm -f $VENDOR_MODEL_FILE $SERVER_FILE $DRIVER_FILE
+      DISCOVERED_VIDEO=$(paste $VENDOR_MODEL_FILE $SERVER_FILE $DRIVER_FILE)
+      rm -f $VENDOR_MODEL_FILE $SERVER_FILE $DRIVER_FILE
+    else
+      # must be Discover 1.x
+      DISCOVERED_VIDEO=$(discover --disable=serial,parallel \
+                                  --format="%V %M\t%S\t%D\n" video 2>/dev/null)
+    fi
+    echo "$DISCOVERED_VIDEO"
   else
-    # must be Discover 1.x
-    DISCOVERED_VIDEO=$(discover --disable=serial,parallel \
-                                --format="%V %M\t%S\t%D\n" video 2>/dev/null)
+    warn "cannot use discover; failed with error message:" \
+         "$(cat "$DISCOVER_ERRORFILE")"
   fi
-  echo "$DISCOVERED_VIDEO"
+  rm "$DISCOVER_ERRORFILE" || warn "discover error file never created, or" \
+                                   "already removed"
 }
 
 validate_string_db_input () {
@@ -459,7 +468,6 @@
 # collect information about installed video card(s), if possible
 if which discover > /dev/null 2>&1; then
   DISCOVERED_VIDEO=$(discover_video)
-
   if [ -n "$DISCOVERED_VIDEO" ]; then
     NCARDS=$(echo "$DISCOVERED_VIDEO" | wc -l)
     SERVERS=$(echo "$DISCOVERED_VIDEO" | awk 'BEGIN { FS="\t" } {print $2}' | 
grep -v unknown | sort | uniq)

Reply via email to