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

X Strike Force XFree86 SVN commit: rev 829 - trunk/debian



Author: branden
Date: 2003-12-06 22:47:26 -0500 (Sat, 06 Dec 2003)
New Revision: 829

Modified:
   trunk/debian/changelog
   trunk/debian/xdm.config.in
   trunk/debian/xdm.postinst.in
   trunk/debian/xdm.prerm.in
   trunk/debian/xserver-common.config.in
   trunk/debian/xserver-common.postinst.in
Log:
Change maintainer scripts to never use safe_debconf() with db_get or
db_metaget.  Instead, check the exit status of these commands normally
with an if statement and only take the appropriate actions of the command
succeeds.  For extra paranoia (in the event code is changed to live inside
a loop in the future), clear variables we'll be filling with db_get or
db_metaget output before using them.  (Closes: #217605)


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/changelog	2003-12-07 03:47:26 UTC (rev 829)
@@ -8,8 +8,20 @@
     (Closes: #223038)
     - debian/xdm.config.in
 
- -- Branden Robinson <branden@debian.org>  Sat,  6 Dec 2003 20:50:48 -0500
+  * Change maintainer scripts to never use safe_debconf() with db_get or
+    db_metaget.  Instead, check the exit status of these commands normally
+    with an if statement and only take the appropriate actions of the command
+    succeeds.  For extra paranoia (in the event code is changed to live inside
+    a loop in the future), clear variables we'll be filling with db_get or
+    db_metaget output before using them.  (Closes: #217605)
+    - debian/xdm.config.in
+    - debian/xdm.postinst.in
+    - debian/xdm.prerm.in
+    - debian/xserver-common.config.in
+    - debian/xserver-common.postinst.in
 
+ -- Branden Robinson <branden@debian.org>  Sat,  6 Dec 2003 21:36:03 -0500
+
 xfree86 (4.2.1-14) unstable; urgency=medium
 
   * Urgency due to fix for FTBFS triggered by linux-kernel-headers package.

Modified: trunk/debian/xdm.config.in
===================================================================
--- trunk/debian/xdm.config.in	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/xdm.config.in	2003-12-07 03:47:26 UTC (rev 829)
@@ -19,11 +19,16 @@
 # set default display manager
 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
 
-safe_debconf db_metaget shared/default-x-display-manager owners
-OWNERS="$RET"
-safe_debconf db_metaget shared/default-x-display-manager choices
-CHOICES="$RET"
+OWNERS=
+if db_metaget shared/default-x-display-manager owners; then
+  OWNERS="$RET"
+fi
 
+CHOICES=
+if db_metaget shared/default-x-display-manager choices; then
+  CHOICES="$RET"
+fi
+
 if [ -n "$OWNERS" -a -n "$CHOICES" ]; then
   if [ "$OWNERS" != "$CHOICES" ]; then
     safe_debconf db_subst shared/default-x-display-manager choices "$OWNERS"
@@ -45,8 +50,10 @@
       safe_debconf db_set shared/default-x-display-manager "$CURRENT_DEFAULT"
     fi
   else
-    safe_debconf db_get shared/default-x-display-manager
-    CURRENT_DEFAULT="$RET"
+    CURRENT_DEFAULT=
+    if db_get shared/default-x-display-manager; then
+      CURRENT_DEFAULT="$RET"
+    fi
   fi
 
   safe_debconf db_input high shared/default-x-display-manager
@@ -54,8 +61,10 @@
 fi
 
 # using this display manager?
-safe_debconf db_get shared/default-x-display-manager
-NEW_DEFAULT="$RET"
+NEW_DEFAULT=
+if db_get shared/default-x-display-manager; then
+  NEW_DEFAULT="$RET"
+fi
 
 # move the default display manager file if we're going to change it
 if [ -n "$NEW_DEFAULT" ]; then

Modified: trunk/debian/xdm.postinst.in
===================================================================
--- trunk/debian/xdm.postinst.in	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/xdm.postinst.in	2003-12-07 03:47:26 UTC (rev 829)
@@ -33,11 +33,15 @@
 # does not exist
 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
 if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
-  safe_debconf db_get shared/default-x-display-manager
-  DEFAULT_DISPLAY_MANAGER="$RET"
+  DEFAULT_DISPLAY_MANAGER=
+  if db_get shared/default-x-display-manager; then
+    DEFAULT_DISPLAY_MANAGER="$RET"
+  fi
   if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
-    safe_debconf db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name
-    DAEMON_NAME="$RET"
+    DAEMON_NAME=
+    if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
+      DAEMON_NAME="$RET"
+    fi
     if [ ! -n "$DAEMON_NAME" ]; then
       # if we were unable to determine the name of the selected daemon (for
       # instance, if the selected default display manager doesn't provide a

Modified: trunk/debian/xdm.prerm.in
===================================================================
--- trunk/debian/xdm.prerm.in	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/xdm.prerm.in	2003-12-07 03:47:26 UTC (rev 829)
@@ -57,8 +57,10 @@
           safe_debconf db_input high xdm/stop_running_server_with_children
           safe_debconf db_go
           # what did the user say?
-          safe_debconf db_get xdm/stop_running_server_with_children
-          ANSWER="$RET"
+          ANSWER=
+          if db_get xdm/stop_running_server_with_children; then
+            ANSWER="$RET"
+          fi
           if [ "$ANSWER" = "true" ]; then
             STOP=yes
           fi
@@ -89,20 +91,24 @@
     safe_debconf db_unregister shared/default-x-display-manager
     # does the question still exist?
     if db_get shared/default-x-display-manager; then
-      safe_debconf db_metaget shared/default-x-display-manager owners
-      safe_debconf db_subst shared/default-x-display-manager choices "$RET"
-      safe_debconf db_get shared/default-x-display-manager
-      DEFAULT_DISPLAY_MANAGER="$RET"
+      if db_metaget shared/default-x-display-manager owners; then
+        safe_debconf db_subst shared/default-x-display-manager choices "$RET"
+      fi
+      DEFAULT_DISPLAY_MANAGER=
+      if db_get shared/default-x-display-manager; then
+        DEFAULT_DISPLAY_MANAGER="$RET"
+      fi
       # are we removing the currently selected display manager?
       if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
         if [ "$THIS_PACKAGE" = "$DEFAULT_DISPLAY_MANAGER" ]; then
           if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
-            safe_debconf db_get "$DEFAULT_DISPLAY_MANAGER/daemon_name"
-            # does the display manager file reference the current default?  if
-            # so, remove it because it will now be wrong
-            if [ -n "$RET" ]; then
-              if [ "$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")" = "$RET" ]; then
-                rm "$DEFAULT_DISPLAY_MANAGER_FILE"
+            if db_get "$DEFAULT_DISPLAY_MANAGER/daemon_name"; then
+              # does the display manager file reference the current default?  if
+              # so, remove it because it will now be wrong
+              if [ -n "$RET" ]; then
+                if [ "$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")" = "$RET" ]; then
+                  rm "$DEFAULT_DISPLAY_MANAGER_FILE"
+                fi
               fi
             fi
           fi
@@ -113,14 +119,18 @@
           # if the default display manager file doesn't exist, write it with
           # the path to the new default display manager
           if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
-            safe_debconf db_get shared/default-x-display-manager
-            DEFAULT_DISPLAY_MANAGER="$RET"
+            DEFAULT_DISPLAY_MANAGER=
+            if db_get shared/default-x-display-manager; then
+              DEFAULT_DISPLAY_MANAGER="$RET"
+            fi
             if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
               warn "new default display manager has been selected; please be" \
                    "sure to run \"dpkg-reconfigure $RET\" to ensure that it" \
                    "is configured"
-              safe_debconf db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name
-              DAEMON_NAME="$RET"
+              DAEMON_NAME=
+              if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
+                DAEMON_NAME="$RET"
+              fi
               if [ ! -n "$DAEMON_NAME" ]; then
                 # if we were unable to determine the name of the selected daemon (for
                 # instance, if the selected default display manager doesn't provide a

Modified: trunk/debian/xserver-common.config.in
===================================================================
--- trunk/debian/xserver-common.config.in	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/xserver-common.config.in	2003-12-07 03:47:26 UTC (rev 829)
@@ -136,21 +136,27 @@
 safe_debconf db_input low xserver-common/xwrapper/allowed_users
 safe_debconf db_go
 
-safe_debconf db_get xserver-common/xwrapper/allowed_users
-if [ -n "$RET" ]; then
-  safe_debconf db_set xserver-common/xwrapper/actual_allowed_users \
-                      $(allowed_users_english_to_actual "$RET")
+RET=
+if db_get xserver-common/xwrapper/allowed_users; then
+  if [ -n "$RET" ]; then
+    safe_debconf db_set xserver-common/xwrapper/actual_allowed_users \
+                        $(allowed_users_english_to_actual "$RET")
+  fi
 fi
 
-# next question requires input validation
-# save valid value already present (possibly the template default)
-safe_debconf db_get xserver-common/xwrapper/nice_value
-SAFE="$RET"
+# next question requires input validation; assume safe valid value already
+# present (possibly the template default)
+SAFE=
+if db_get xserver-common/xwrapper/nice_value; then
+  SAFE="$RET"
+fi
+
 # make sure it's really safe; if not, use the default
 if ! validate_nice_value "$RET"; then
   SAFE="$NICE_DEFAULT"
   safe_debconf db_set xserver-common/xwrapper/nice_value "$SAFE"
 fi
+
 set +e
 while :; do
   safe_debconf db_input low xserver-common/xwrapper/nice_value
@@ -159,20 +165,22 @@
     break # no; bail out of validation loop
   fi
   safe_debconf db_go
-  safe_debconf db_get xserver-common/xwrapper/nice_value
-  # string, needs input validation
-  if validate_nice_value "$RET"; then
-    # valid input from user
-    break
-  else
-    # the input was invalid; restore the known good value in case we are
-    # interrupted before the user provides a valid one
-    safe_debconf db_set xserver-common/xwrapper/nice_value "$SAFE"
-    safe_debconf db_fset xserver-common/xwrapper/nice_value seen false
-    # now display the error message
-    safe_debconf db_fset xserver-common/xwrapper/nice_value/error seen false
-    safe_debconf db_input critical xserver-common/xwrapper/nice_value/error
-    safe_debconf db_go
+  RET=
+  if db_get xserver-common/xwrapper/nice_value; then
+    # string, needs input validation
+    if validate_nice_value "$RET"; then
+      # valid input from user
+      break
+    else
+      # the input was invalid; restore the known good value in case we are
+      # interrupted before the user provides a valid one
+      safe_debconf db_set xserver-common/xwrapper/nice_value "$SAFE"
+      safe_debconf db_fset xserver-common/xwrapper/nice_value seen false
+      # now display the error message
+      safe_debconf db_fset xserver-common/xwrapper/nice_value/error seen false
+      safe_debconf db_input critical xserver-common/xwrapper/nice_value/error
+      safe_debconf db_go
+    fi
   fi
 done
 set -e

Modified: trunk/debian/xserver-common.postinst.in
===================================================================
--- trunk/debian/xserver-common.postinst.in	2003-12-07 03:30:14 UTC (rev 828)
+++ trunk/debian/xserver-common.postinst.in	2003-12-07 03:47:26 UTC (rev 829)
@@ -52,10 +52,14 @@
       if [ "$(md5sum "$XWRAPPER_CONFIG")" = \
            "$(cat "$XWRAPPER_CONFIG_CHECKSUM")" ]; then
         # they match; prepare a new version of the config file
-        safe_debconf db_get xserver-common/xwrapper/actual_allowed_users
-        ALLOWED_USERS="$RET"
-        safe_debconf db_get xserver-common/xwrapper/nice_value
-        NICE_VALUE="$RET"
+        ALLOWED_USERS=
+        if db_get xserver-common/xwrapper/actual_allowed_users; then
+          ALLOWED_USERS="$RET"
+        fi
+        NICE_VALUE=
+        if db_get xserver-common/xwrapper/nice_value; then
+          NICE_VALUE="$RET"
+        fi
         if [ -n "$ALLOWED_USERS" -a -n "$NICE_VALUE" ]; then
           NEW_XWRAPPER_CONFIG=$(tempfile)
           cat > "$NEW_XWRAPPER_CONFIG" << EOF



Reply to: