Hello
In order to fix #691338 [1], I've made a minimal change to libconfig-model-perl
2.021. The modification adds a call to notification-change when an empty
checklist is replaced with a default one.
This patch also features non-regression tests.
I cannot upload to unstable as libconfig-model-perl is already at a later v
ersion there.
You find the debdiff at the end of this message.
Is uploading libconfig-model-perl 2.021-4 to wheezy fine with you ?
All the best
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=691338
Dominique
diff -Nru libconfig-model-perl-2.021/debian/changelog libconfig-model-perl-2.021/debian/changelog
--- libconfig-model-perl-2.021/debian/changelog 2012-07-13 14:46:28.000000000 +0200
+++ libconfig-model-perl-2.021/debian/changelog 2012-10-27 19:11:28.000000000 +0200
@@ -1,3 +1,11 @@
+libconfig-model-perl (2.021-4) wheezy; urgency=low
+
+ * added patch to fix problem with writing checklist
+ default values (which broke openssh demo).
+ (Closes: #691338)
+
+ -- Dominique Dumont <dod@debian.org> Sat, 27 Oct 2012 19:05:23 +0200
+
libconfig-model-perl (2.021-3) unstable; urgency=low
* use patch from upstream to fix unsaved changes (Closes: #681353)
diff -Nru libconfig-model-perl-2.021/debian/patches/fix-checklist-default libconfig-model-perl-2.021/debian/patches/fix-
checklist-default
--- libconfig-model-perl-2.021/debian/patches/fix-checklist-default 1970-01-01 01:00:00.000000000 +0100
+++ libconfig-model-perl-2.021/debian/patches/fix-checklist-default 2012-10-27 19:11:28.000000000 +0200
@@ -0,0 +1,89 @@
+--- a/lib/Config/Model/CheckList.pm
++++ b/lib/Config/Model/CheckList.pm
+@@ -12,10 +12,12 @@
+ $Config::Model::CheckList::VERSION = '2.021';
+ }
+ use Any::Moose ;
++use 5.010 ;
+
+ use Config::Model::Exception ;
+ use Config::Model::IdElementReference ;
+ use Config::Model::Warper ;
++use List::MoreUtils qw/any none/;
+ use Carp;
+ use Log::Log4perl qw(get_logger :levels);
+ use Storable qw/dclone/;
+@@ -459,7 +461,17 @@
+ my $ud = $self->{upstream_default_data} ;
+
+ # copy hash and return it
+- my %std = (%h, %$ud, %$lay, %$def, %$pre ) ;
++ my %predef = (%h, %$def, %$pre ) ;
++ my %std = (%h, %$ud, %$lay, %$def, %$pre ) ;
++
++ # use _std_backup if all data values are null (no checked items by user)
++ my %old_dat = (none { $_ ;} values %$dat) ? %{$self->{_std_backup} || {}} : %$dat ;
++
++ if (not $mode and any {$_;} values %predef and none { $_ ;} values %old_dat) {
++ # changed from nothing to default checked list that must be written
++ $self->{_std_backup} = \%predef ;
++ $self->notify_change(note => "use default checklist") ;
++ }
+
+ # custom test must compare the whole list at once, not just one item at a time.
+ my %result
+@@ -469,7 +481,7 @@
+ : $mode eq 'upstream_default' ? (%h, %$ud)
+ : $mode eq 'default' ? (%h, %$def )
+ : $mode eq 'standard' ? %std
+- : (%h, %$def, %$pre, %$dat );
++ : (%predef, %$dat );
+
+ return wantarray ? %result : \%result;
+ }
+--- a/t/check_list.t
++++ b/t/check_list.t
+@@ -10,7 +10,7 @@
+ use Data::Dumper;
+ use Log::Log4perl qw(:easy :levels) ;
+
+-BEGIN { plan tests => 87; }
++BEGIN { plan tests => 91; }
+
+ use strict;
+
+@@ -418,18 +418,23 @@
+ "test upstream_default of choice_list_with_upstream_default" );
+
+ # test check list with upstream_default *and* default (should override)
++$inst->clear_changes ;
+ my $wudad =
+ $root->fetch_element("choice_list_with_default_and_upstream_default");
++is($inst->needs_save,0,"check needs_save after reading a default value") ;
+ @got = $wudad->get_checked_list('default');
+ is_deeply( \@got, [qw/A C/],
+ "test default of choice_list_with_default_and_upstream_default" );
++is($inst->needs_save,0,"check needs_save after reading a default value") ;
+
+ @got = $wudad->get_checked_list();
+ is_deeply( \@got, [qw/A C/],
+ "test choice_list_with_default_and_upstream_default" );
++is($inst->needs_save,1,"check needs_save after reading a default value") ;
+
+ is_deeply( $wudad->fetch(), 'A,C',
+ "test fetch choice_list_with_default_and_upstream_default" );
++is($inst->needs_save,1,"check needs_save after reading a default value") ;
+
+ ### test preset feature
+
+--- a/lib/Config/Model/Node.pm
++++ b/lib/Config/Model/Node.pm
+@@ -1083,7 +1083,7 @@
+ sub migrate {
+ my $self = shift ;
+ $self->init ;
+- Config::Model::Dumper->new->dump_tree(node => $self, mode => 'custom', @_) ;
++ Config::Model::Dumper->new->dump_tree(node => $self, mode => 'full', @_) ;
+
+ return $self->needs_save ;
+ }
diff -Nru libconfig-model-perl-2.021/debian/patches/series libconfig-model-perl-2.021/debian/patches/series
--- libconfig-model-perl-2.021/debian/patches/series 2012-07-13 14:46:28.000000000 +0200
+++ libconfig-model-perl-2.021/debian/patches/series 2012-10-27 19:11:28.000000000 +0200
@@ -1,3 +1,4 @@
+fix-checklist-default
fix-race-condition-dependency-check
add_dh_config
fix-unsaved-changes
Attachment:
signature.asc
Description: This is a digitally signed message part.