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

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



Author: branden
Date: 2003-10-22 23:04:38 -0500 (Wed, 22 Oct 2003)
New Revision: 700

Modified:
   trunk/debian/changelog
   trunk/debian/xserver-common.preinst.in
   trunk/debian/xserver-xfree86.preinst.in
Log:
Fix migration of configuration files from "debconf-managed" to
conffile-style management, in that the Xwrapper.config and XF86Config-4
files were marked as locally changed even if there were no changes outside
the "debconf markers".  Detect this case by searching for lines outside
that range which contain anything other than whitespace or comments, and
if none are found, treat the config file as handled by the package
("automatic update mode").  This should eliminate some overly aggressive
migrations to manual update mode, though people who made changes only
within the debconf markers and didn't follow instructions may still be
incorrectly placed in automatic mode (that's why copies of the old config
files are made when migration is done).  Thanks to John R. Daily for
bringing this scenario to my attention.  (Closes: #214604)

- debian/xserver-common.preinst.in
- debian/xserver-xfree86.preinst.in


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2003-10-23 03:40:42 UTC (rev 699)
+++ trunk/debian/changelog	2003-10-23 04:04:38 UTC (rev 700)
@@ -153,8 +153,23 @@
       abnormally?
     - debian/local/FAQ
 
- -- Branden Robinson <branden@debian.org>  Wed, 22 Oct 2003 15:21:34 -0500
+  * Fix migration of configuration files from "debconf-managed" to
+    conffile-style management, in that the Xwrapper.config and XF86Config-4
+    files were marked as locally changed even if there were no changes outside
+    the "debconf markers".  Detect this case by searching for lines outside
+    that range which contain anything other than whitespace or comments, and
+    if none are found, treat the config file as handled by the package
+    ("automatic update mode").  This should eliminate some overly aggressive
+    migrations to manual update mode, though people who made changes only
+    within the debconf markers and didn't follow instructions may still be
+    incorrectly placed in automatic mode (that's why copies of the old config
+    files are made when migration is done).  Thanks to John R. Daily for
+    bringing this scenario to my attention.  (Closes: #214604)
+    - debian/xserver-common.preinst.in
+    - debian/xserver-xfree86.preinst.in
 
+ -- Branden Robinson <branden@debian.org>  Wed, 22 Oct 2003 22:55:43 -0500
+
 xfree86 (4.2.1-12.1) unstable; urgency=low
 
   * Fix typo in xlibs preinst.  Closes: #213774, #213776

Modified: trunk/debian/xserver-common.preinst.in
===================================================================
--- trunk/debian/xserver-common.preinst.in	2003-10-23 03:40:42 UTC (rev 699)
+++ trunk/debian/xserver-common.preinst.in	2003-10-23 04:04:38 UTC (rev 700)
@@ -66,16 +66,23 @@
               # removed, the user didn't want the file molested
               if egrep -q '^### BEGIN DEBCONF SECTION' "$XWRAPPER_CONFIG" &&
                  egrep -q '^### END DEBCONF SECTION' "$XWRAPPER_CONFIG"; then
-                # finally, people were letting debconf "manage" the config file
-                # even though they complained when it did so and did not follow
-                # the instructions that would make the maintainer scripts ignore
-                # it, so store a backup so they can rescue themselves from their
-                # own ignorance
-                observe "migrating $XWRAPPER_CONFIG away from management by" \
-                        "debconf; backup stored in $XWRAPPER_CONFIG.dpkg-old" \
-                        "and checksum stored in $XWRAPPER_CONFIG_CHECKSUM"
-                md5sum "$XWRAPPER_CONFIG" > "$XWRAPPER_CONFIG_CHECKSUM"
-                cp "$XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-old"
+                # has the user left the file untouched (except for blank lines
+                # and comments) outside the debconf-marked area?
+                if ! [ -n "$(sed -n '1,/^### BEGIN DEBCONF SECTION/p' \
+                           < "$XWRAPPER_CONFIG" | grep -v '^[[:space:]]*#' \
+                           | grep -v '^[[:space:]]*$')" -o -n \
+                           "$(sed -n '/^### END DEBCONF SECTION/,$p' \
+                           < "$XWRAPPER_CONFIG" | grep -v '^[[:space:]]*#' \
+                           | grep -v '^[[:space:]]*$')" ]; then
+                  observe "migrating $XWRAPPER_CONFIG away from management by" \
+                          "debconf; backup stored in $XWRAPPER_CONFIG.dpkg-old" \
+                          "and checksum stored in $XWRAPPER_CONFIG_CHECKSUM"
+                  cp "$XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-old"
+                  # if all of the above tests succeeded, treat the file
+                  # similarly to an unmodified conffile (automatically updated
+                  # by package)
+                  md5sum "$XWRAPPER_CONFIG" > "$XWRAPPER_CONFIG_CHECKSUM"
+                fi
               fi
             fi
           fi

Modified: trunk/debian/xserver-xfree86.preinst.in
===================================================================
--- trunk/debian/xserver-xfree86.preinst.in	2003-10-23 03:40:42 UTC (rev 699)
+++ trunk/debian/xserver-xfree86.preinst.in	2003-10-23 04:04:38 UTC (rev 700)
@@ -78,9 +78,12 @@
                 observe "migrating $SERVER_SYMLINK away from management by" \
                         "debconf; backup stored in $SERVER_SYMLINK.dpkg-old" \
                         "and checksum stored in $SERVER_SYMLINK_CHECKSUM"
+                ln -s "$CURRENT_SYMLINK_TARGET" "$SERVER_SYMLINK.dpkg-old"
+                # if all of the above tests succeeded, treat the file
+                # similarly to an unmodified conffile (automatically updated
+                # by package)
                 echo "$CURRENT_SYMLINK_TARGET" | md5sum > \
                      "$SERVER_SYMLINK_CHECKSUM"
-                ln -s "$CURRENT_SYMLINK_TARGET" "$SERVER_SYMLINK.dpkg-old"
               fi
             fi
           fi
@@ -96,16 +99,23 @@
               # been removed, the user didn't want the file molested
               if egrep -q '^### BEGIN DEBCONF SECTION' "$XF86CONFIG" &&
                  egrep -q '^### END DEBCONF SECTION' "$XF86CONFIG"; then
-                # finally, people were letting debconf "manage" the config
-                # file even though they complained when it did so and did not
-                # follow the instructions that would make the maintainer
-                # scripts ignore it, so store a backup so they can rescue
-                # themselves from their own ignorance
-                observe "migrating $XF86CONFIG away from management by" \
-                        "debconf; backup stored in $XF86CONFIG.dpkg-old and" \
-                        "checksum stored in $XF86CONFIG_CHECKSUM"
-                md5sum "$XF86CONFIG" > "$XF86CONFIG_CHECKSUM"
-                cp "$XF86CONFIG" "$XF86CONFIG.dpkg-old"
+                # has the user left the file untouched (except for blank lines
+                # and comments) outside the debconf-marked area?
+                if ! [ -n "$(sed -n '1,/^### BEGIN DEBCONF SECTION/p' \
+                           < "$XF86CONFIG" | grep -v '^[[:space:]]*#' \
+                           | grep -v '^[[:space:]]*$')" -o -n \
+                           "$(sed -n '/^### END DEBCONF SECTION/,$p' \
+                           < "$XF86CONFIG" | grep -v '^[[:space:]]*#' \
+                           | grep -v '^[[:space:]]*$')" ]; then
+                  observe "migrating $XF86CONFIG away from management by" \
+                          "debconf; backup stored in $XF86CONFIG.dpkg-old and" \
+                          "checksum stored in $XF86CONFIG_CHECKSUM"
+                  cp "$XF86CONFIG" "$XF86CONFIG.dpkg-old"
+                  # if all of the above tests succeeded, treat the file
+                  # similarly to an unmodified conffile (automatically updated
+                  # by package)
+                  md5sum "$XF86CONFIG" > "$XF86CONFIG_CHECKSUM"
+                fi
               fi
             fi
           fi



Reply to: