[Pkg-clamav-devel] Bug#592322: Bug#592322: freshclam.conf: update moves DatabaseMirror line
Stephen Gran
sgran at debian.org
Mon Aug 9 22:10:33 UTC 2010
This one time, at band camp, Török Edwin said:
> On Mon, 9 Aug 2010 12:55:32 +0100
> Stephen Gran <sgran at debian.org> wrote:
>
> > This one time, at band camp, Török Edwin said:
> > > After updating clamav-freshclam I got this diff:
> > > --- /etc/clamav/freshclam.conf 2010-06-10 15:40:04.624888178 +0300
> > > +++ /var/lib/clamav/freshclam.conf 2010-08-09 12:03:46.265177327
> > > +0300
> >
> > I agree this is most likely a bug - we're probably not popping off the
> > list in the same order we push onto it or something.
> >
> > However:
> >
> > > -- Package-specific info:
> > > --- configuration ---
> > > Checking configuration files in /usr/local/etc
> >
> > Can you try without local versions installed, just to make sure
> > nothing funny is happening as a result?
>
> Well I can't reproduce this with an apt-get --reinstall
> clamav-freshclam.
>
> What should I do to try and reproduce this bug? Revert to older
> clamav-freshclam then upgrade again?
Just eliminating the local version, and running
dpkg-reconfigure -phigh clamav-freshclam
once or twice should do it.
Although, looking at the way the list is set up, I can see that we are
in fact setting it up wrong:
We set up the variable:
if [ -e "$CLAMAVCONF" ]; then
for variable in `egrep -v '^[[:space:]]*(#|$)' "$CLAMAVCONF" | awk '{print $1}'`; do
case "$variable" in
DatabaseMirror)
if [ -z "$DatabaseMirror" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$i $value"
done
else
continue
fi
;;
Then store that in debconf:
if [ -n "$DatabaseMirror" ]; then
if [ -e /usr/share/doc/clamav-freshclam/mirror-list.gz ]; then
if zgrep -q "$DatabaseMirror" /usr/share/doc/clamav-freshclam/mirror-list.gz;then
db_set clamav-freshclam/local_mirror `zgrep "$DatabaseMirror" /usr/share/doc/clamav-freshclam/mirror-list.gz` || true
else
db_set clamav-freshclam/local_mirror "$DatabaseMirror" || true
fi
fi
fi
Then pull it out to construct the config file:
db_metaget clamav-freshclam/local_mirror value || true
[ "$RET" = "" ] || rawmirrors="$RET"
if echo "$rawmirrors" | egrep -q '(\(|\))'; then
mirrors=`echo "$rawmirrors" | awk '{print $1}'`
else
mirrors="$rawmirrors"
fi
And then finally write out the temporary copy of the config file:
if [ -n "$mirrors" ]; then
for i in $mirrors; do
echo "DatabaseMirror $i" >> $DEBCONFILE
done
fi
if ! echo "$mirrors" | grep -q database.clamav.net; then
echo "DatabaseMirror database.clamav.net" >> $DEBCONFILE
fi
if [ -n "$DatabaseMirror" ]; then
for m in $DatabaseMirror; do
grep -q "$m" "$DEBCONFILE" || echo "DatabaseMirror $m" >> $DEBCONFILE
done
fi
So it looks like the simple fix will be to change:
value="$i $value"
to
value="$value $i"
in /var/lib/dpkg/info/clamav-freshclam.config and
/var/lib/dpkg/info/clamav-freshclam.postinst
If the naive first try of dpkg-reconfigure still does the wrong thing
for you after removing the local copy, can you try this fix and let me
know if it does the right thing? I suspect that's all that's needed,
but as you have a handy test case, it would be useful to confirm it.
My fear is that it will be a more subtle bug with the way we are using
debconf to store the data (that the template expects a single value, and
we are potentially storing a space seperated multi-value list, some of
which aren't in the debconf list of things to pick from). If the above
simple case doesn't fix it for you, I may ask you to do some more set -x
debugging to confirm that.
Cheers,
--
-----------------------------------------------------------------
| ,''`. Stephen Gran |
| : :' : sgran at debian.org |
| `. `' Debian user, admin, and developer |
| `- http://www.debian.org |
-----------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-clamav-devel/attachments/20100809/745a6574/attachment.pgp>
More information about the Pkg-clamav-devel
mailing list