Subject: Re: Bug#319177: some patchs

From: Joey Hess <[email-masked]>
Date: Fri, 22 Jul 2005 10:52:58 -0400

[email-masked] 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