Bug#592322: [Pkg-clamav-devel] Bug#592322: Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-13 Thread Török Edwin
On Thu, 12 Aug 2010 19:10:13 +0100
Stephen Gran sg...@debian.org wrote:

 This one time, at band camp, Török Edwin said:
  Changing order here does something wrong with newlines, I get:
  DatabaseMirror db.ro.clamav.net
   │ DatabaseMirror db.local.clamav.net DatabaseMirror
  db.local.clamav.net │ DatabaseMirror database.clamav.net
  DatabaseMirror database.clamav.net │   DatabaseMirror
  db.ro.clamav.net 
 
 Sorry for being slow, busy week at work.
 
 That is truely bizarre.

Sorry for not updating this bug, I think I told you on #clamav that it
wasn't a newline issue after all (I just selected a different way to
view diffs).
Its just that value=$value $i and value=$i $value still produce the
same results.

  I'll have time this weekend (hopefully!) to
 get a look at that.  At first glance, I don't see a reason for it.

Sure, np.

Best regards,
--Edwin



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#592322: [Pkg-clamav-devel] Bug#592322: Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-12 Thread Stephen Gran
This one time, at band camp, Török Edwin said:
 Changing order here does something wrong with newlines, I get:
 DatabaseMirror db.ro.clamav.net
  │ DatabaseMirror db.local.clamav.net DatabaseMirror
 db.local.clamav.net │ DatabaseMirror database.clamav.net DatabaseMirror
 database.clamav.net │   DatabaseMirror db.ro.clamav.net 

Sorry for being slow, busy week at work.

That is truely bizarre.  I'll have time this weekend (hopefully!) to get
a look at that.  At first glance, I don't see a reason for it.

Cheers,
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :sg...@debian.org |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#592322: [Pkg-clamav-devel] Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-11 Thread Török Edwin
On Mon, 9 Aug 2010 23:10:33 +0100
Stephen Gran sg...@debian.org wrote:

 This one time, at band camp, Török Edwin said:
  On Mon, 9 Aug 2010 12:55:32 +0100
  Stephen Gran sg...@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.

OK, so testcase:
Make /etc/clamav/freshclam.conf have these entries:
DatabaseMirror db.local.clamav.net
DatabaseMirror database.clamav.net

dpkg-reconfigure -phigh clamav-freshclam
dpkg-reconfigure -phigh clamav-freshclam

Now add db.ro.clamav.net as first like this:
DatabaseMirror db.ro.clamav.net
DatabaseMirror db.local.clamav.net
DatabaseMirror database.clamav.net

dpkg-reconfigure -phigh clamav-freshclam

Popup with diff showing it in wrong place.

 
 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

Changing order here does something wrong with newlines, I get:
DatabaseMirror db.ro.clamav.net
 │ DatabaseMirror db.local.clamav.net DatabaseMirror
db.local.clamav.net │ DatabaseMirror database.clamav.net DatabaseMirror
database.clamav.net │   DatabaseMirror db.ro.clamav.net 



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-09 Thread Török Edwin
Package: clamav-freshclam
Version: 0.96.1+dfsg-3
Severity: normal

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
@@ -23,7 +23,7 @@
 Bytecode true
 # Check for new database 24 times a day
 Checks 24
-DatabaseMirror db.ro.clamav.net
 DatabaseMirror db.local.clamav.net
 DatabaseMirror database.clamav.net
+DatabaseMirror db.ro.clamav.net
 SubmitDetectionStats /usr/local/etc/clamd.conf

That is not right, it moves my manually set mirror (db.ro.clamav.net) to the
end, effectively disabling it, since mirrors are tried in the order specified in
freshclam.conf.

-- Package-specific info:
--- configuration ---
Checking configuration files in /usr/local/etc

Config file: clamd.conf
---

Config file: freshclam.conf
---
LogFileMaxSize = 2097152
LogTime = yes
LogSyslog = yes
LogFacility = LOG_LOCAL6
LogVerbose disabled
PidFile disabled
DatabaseDirectory = /usr/local/share/clamav
Foreground disabled
Debug disabled
AllowSupplementaryGroups disabled
UpdateLogFile = /var/tmp/freshclam-dev.log
DatabaseOwner = clamav
Checks = 288
DNSDatabaseInfo = current.cvd.clamav.net
DatabaseMirror = db.ro.clamav.net
MaxAttempts = 3
ScriptedUpdates = yes
TestDatabases = yes
CompressLocalDatabase = yes
ExtraDatabase disabled
HTTPProxyServer disabled
HTTPProxyPort disabled
HTTPProxyUsername disabled
HTTPProxyPassword disabled
HTTPUserAgent = ClamAV/0.96
NotifyClamd = /usr/local/etc/clamd.conf
OnUpdateExecute disabled
OnErrorExecute disabled
OnOutdatedExecute disabled
LocalIPAddress disabled
ConnectTimeout = 30
ReceiveTimeout = 30
SubmitDetectionStats = /usr/local/etc/clamd.conf
DetectionStatsCountry disabled
DetectionStatsHostID = 1834CA1A60ABEAD9B92E52FC0A7A1430
SafeBrowsing = yes
Bytecode = yes

Config file: clamav-milter.conf
---
LogFile = /tmp/clamav-milter.log
LogFileUnlock disabled
LogFileMaxSize = 1048576
LogTime = yes
LogSyslog disabled
LogFacility = LOG_LOCAL6
LogVerbose = yes
PidFile disabled
TemporaryDirectory disabled
FixStaleSocket = yes
MaxThreads = 10
ReadTimeout = 120
Foreground disabled
User disabled
AllowSupplementaryGroups disabled
MaxFileSize = 26214400
ClamdSocket = tcp:127.0.0.1:3310
MilterSocket = local:/var/spool/postfix/clamav/clamav-milter.socket
MilterSocketGroup disabled
MilterSocketMode disabled
LocalNet disabled
OnClean = Accept
OnInfected = Quarantine
OnFail = Defer
RejectMsg disabled
AddHeader = Yes
ReportHostname disabled
VirusAction disabled
Chroot disabled
Whitelist disabled
SkipAuthenticated disabled
LogInfected = Full

Software settings
-
Version: devel-debian/0.95+dfsg-1-6217-g5925b3d
WARNING: Version mismatch: libclamav=devel-debian/0.95+dfsg-1-6217-g5925b3d, 
clamconf=0.96.1
Optional features supported: MEMPOOL IPv6 CLAMUKO AUTOIT_EA06 BZIP2 RAR JIT
Database directory: /usr/local/share/clamav
WARNING: freshclam.conf and clamd.conf point to different database directories
main.cvd: version 52, sigs: 704727, built on Mon Feb 15 16:54:51 2010
daily.cld: version 11465, sigs: 108855, built on Fri Jul 30 14:43:50 2010
safebrowsing.cvd: version 22733, sigs: 652021, built on Fri Jul 30 17:45:37 2010
bytecode.cvd: version 32, sigs: 8, built on Wed Jul 21 20:29:22 2010

Platform information

uname: Linux 2.6.35 #86 SMP PREEMPT Mon Aug 2 09:28:05 EEST 2010 x86_64
OS: linux-gnu, ARCH: x86_64, CPU: x86_64
Full OS version: Debian GNU/Linux unstable (sid)
zlib version: 1.2.5 (1.2.5), compile flags: a9

Build information
-
GNU C: 4.5.1 20100419 (prerelease) (4.5.1)
GNU C++: 4.4.4 (4.4.4)
CPPFLAGS: 
CFLAGS: -g -O2 -fno-strict-aliasing
CXXFLAGS: 
LDFLAGS: 
Configure: 'CC=gcc-4.5' 'CXX=g++-4.5'

--- data dir ---
total 52276
-rw-r--r-- 1 clamav clamav81920 Jul 21 20:36 bytecode.cld
-rw-r--r-- 1 clamav clamav  1144450 May 12 10:30 
clamav-0f0a4f37c629bd698b5496275820d228
-rw-r--r-- 1 clamav clamav  1305730 May 12 10:30 
clamav-1f17ed2cdedc0937fb7fe976c5ba787e
-rw-r--r-- 1 clamav clamav  9788770 May 12 10:30 
clamav-2513f3e32b00f8b939519cba62edae9e
-rw-r--r-- 1 clamav clamav   335872 May 12 10:30 
clamav-5c0271fb289e43c101da2b9f8be65933
-rw-r--r-- 1 clamav clamav  1560610 May 12 10:30 
clamav-9f04afe919251c743736ae892053279a
-rw-r--r-- 1 clamav clamav  9708736 May 12 10:30 
clamav-ab3318f3a5413b3d43ff71726196d3a5
-rw-r--r-- 1 clamav clamav  6669312 Aug  9 08:34 daily.cld
-rw-r--r-- 1 root   root782 Aug  9 12:03 freshclam.conf
-rw-r--r-- 1 clamav clamav 22906487 May 12 22:05 main.cvd
-rw--- 1 clamav clamav  988 Aug  9 11:03 mirrors.dat
-rw--- 1 clamav clamav  512 Jun 10 15:42 stats.dat

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, 

Bug#592322: [Pkg-clamav-devel] Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-09 Thread Stephen Gran
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?

Cheers,
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :sg...@debian.org |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#592322: [Pkg-clamav-devel] Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-09 Thread Török Edwin
On Mon, 9 Aug 2010 12:55:32 +0100
Stephen Gran sg...@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?

Best regards,
--Edwin



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#592322: [Pkg-clamav-devel] Bug#592322: freshclam.conf: update moves DatabaseMirror line

2010-08-09 Thread Stephen Gran
This one time, at band camp, Török Edwin said:
 On Mon, 9 Aug 2010 12:55:32 +0100
 Stephen Gran sg...@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 |
|  : :' :sg...@debian.org |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature