Package: debconf
* Sylvain Ferriol
- set the type of the template in Template::new because if we don't
use Template::load, it do not appear in template instance
- modify debconf.schema because extendedDescription attribute has an
inappropriate matching rule => slapd (2.2.23-8) failed
- call Cache::shutdown in File::shutdown to synchronize data between
cache and file. see
Test::Debconf::DbDriver::CommonTest::test_shutdown
- call Cache::shutdown in LDAP::shutdown to synchronize data between
cache and ldap. see
Test::Debconf::DbDriver::CommonTest::test_shutdown
- add unit tests to validate debconf_copydb.
- add Test::CopyDBTest::test_201431. Closes: #201431
-------------------------------------------------
envoyé via Webmail/IMAG !
> - call Cache::shutdown in File::shutdown to synchronize data between
> cache and file.
I've applied the other patches, but it seems that this part of the patch
has a bug. Consider saving a file, when nothing in the cache is dirty.
With your patch, DbDriver::File::shutdown opens the file for write, then
calls the DDriver::Cache::shutdown. This loops over removed and dirty
items and calls the remove and save methods for them.
But at no point does it re-save clean items back to the file, so the
file ends up containing only items that were dirtied in the cache during
this run. The rest are deleted.
I'm also interested to know whether you found an actual problem that
your change above fixes.
--
see shy jo
Surlignage Joey Hess <[email protected]>:
> > - call Cache::shutdown in File::shutdown to synchronize data between
> > cache and file.
>
> I've applied the other patches, but it seems that this part of the patch
> has a bug.
True
> I'm also interested to know whether you found an actual problem that
> your change above fixes.
>
The problem is that all drivers use Cache::shutdown except File driver.
And after a shutdown, all items are not dirty except using File driver.
It is not a bug, but if we re-init the driver after a shutdown, there will be
items in dirty state but they should not be.
So if we don't use Cache:shutdown, we have to reset the dirty flag in
File::shutdown by adding this line in File.pm:
foreach my $item (sort keys %{$this->{cache}}) {
next unless defined $this->{cache}->{item}; # skip deleted
$this->{format}->write($fh, $this->{cache}->{$item}, item);
+ $this->{dirty}->{$item}=0 if defined $this->{dirty}->{$item};
}
and the unit tests will work ;) :
./test_debconf.pl Test::Debconf::DbDriver::FileTest
.....
OK (5 tests)
> --
> see shy jo
>
-------------------------------------------------
envoyé via Webmail/IMAG !
[email protected] wrote:
> The problem is that all drivers use Cache::shutdown except File driver.
> And after a shutdown, all items are not dirty except using File driver.
>
> It is not a bug, but if we re-init the driver after a shutdown, there will be
> items in dirty state but they should not be.
>
> So if we don't use Cache:shutdown, we have to reset the dirty flag in
> File::shutdown by adding this line in File.pm:
>
> foreach my $item (sort keys %{$this->{cache}}) {
> next unless defined $this->{cache}->{item}; # skip deleted
> $this->{format}->write($fh, $this->{cache}->{$item}, item);
> + $this->{dirty}->{$item}=0 if defined $this->{dirty}->{$item};
> }
>
> and the unit tests will work ;) :
> ./test_debconf.pl Test::Debconf::DbDriver::FileTest
> .....
> OK (5 tests)
Ok, I can do that; an alternative approach might be to call shutdown but
have dummy save/remove methods that do nothing.
This is all a bit ugly, the best fix would be a new interface in the
cache dbdriver that lets file dbdriver avoid needing to touch its
internals.
--
see shy jo