tag 543910 patch
thanks

On Thu, Aug 27, 2009 at 03:03:58PM +0300, Niko Tyni wrote:
> Package: perl
> Version: 5.10.0-24
> Severity: important
> 
> The CPANPLUS configuration changes introduced in 5.10.0-24 (see #533707)
> may lose local configuration on upgrades if root has done a 's save system'
> in the cpanp shell on earlier versions.
> 
> The settings used to be saved to
> /usr/share/perl/5.10/CPANPLUS/Config/System.pm but this file is shipped
> in perl-modules from 5.10.0-24 onwards, overwriting the saved settings.

Here's the patch I intend to put in 5.10.1-1. Comments welcome.

The issue is much less serious when upgrading to 5.10.1 because the local
configuration is left dangling in /usr/share/5.10.0 while everything
else moves to /usr/share/5.10.1. Nevertheless, I think it's worth fixing.

This patch should also work with a possible stable update as it doesn't
care about the package versions, just the file content.
-- 
Niko Tyni   [email protected]
>From c19913d3733430c10a69e857f95b257b984e79df Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 28 Aug 2009 21:37:38 +0300
Subject: [PATCH] Preserve local CPANPLUS configuration on upgrades

In versions older than 5.10.0-24, CPANPLUS system configuration would
be erroneously saved under /usr/share. Avoid loss of local configuration
by moving it to /etc/perl/CPANPLUS/Config/System.pm on upgrades before
the new package overwrites it. (Closes: #543910)
---
 debian/changelog            |    4 ++++
 debian/perl-modules.preinst |   16 ++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c7efac7..67ff310 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ perl (5.10.1-1) UNRELEASED; urgency=low
     (Closes: #536384, #542137)
   * Add support for abstract sockets. Thanks to Lubomir Rintel.
     (Closes: #329291, #490660)
+  * In versions older than 5.10.0-24, CPANPLUS system configuration would be
+    erroneously saved under /usr/share. Avoid loss of local configuration by
+    copying it to /etc/perl/CPANPLUS/Config/System.pm on upgrades before the
+    new package overwrites it. (Closes: #543910)
 
  -- Niko Tyni <[email protected]>  Thu, 20 Aug 2009 14:51:52 +0300
 
diff --git a/debian/perl-modules.preinst b/debian/perl-modules.preinst
index 7d4b13e..e9c3c68 100644
--- a/debian/perl-modules.preinst
+++ b/debian/perl-modules.preinst
@@ -12,4 +12,20 @@ if [ -h /usr/share/doc/perl-modules ]; then
     rm -f /usr/share/doc/perl-modules
 fi
 
+# cpanp used to save its configuration to /usr/share
+# the md5sum corresponds to the file we ship from 5.10.0-24 onwards
+if [ "$1" = upgrade ] &&
+   [ -f /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm ] &&
+   [ ! -e /etc/perl/CPANPLUS/Config/System.pm ] &&
+   [ "$(md5sum /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm)" != \
+       "a8e8f612c37f8a5d1b73ebf5bd4e4473  /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm" ]
+then
+   if [ -d /etc/perl/CPANPLUS/Config ] || mkdir -p /etc/perl/CPANPLUS/Config
+   then
+        mv /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm \
+           /etc/perl/CPANPLUS/Config/System.pm || true
+        rmdir /usr/share/perl/5.10.0/CPANPLUS/Config  || true
+   fi
+fi
+
 exit 0
-- 
1.5.6.5

Reply via email to