Mailing List Archive

'clamscan --stdout --debug' still writes to stderr
Hi,

I am currently trying to determine which database files clamscan is
actually using when no -d option is given. The only way to find out I
have uncovered so far was to run clamscan against a dummy file
(I choose /dev/null) with debug output.

So, I ran

$ clamscan --stdout --debug /dev/null > clamscan.out

But, only a portion of this output has been written to stout:

$ cat clamscan.out
ERROR: Not supported file type (/dev/null)

----------- SCAN SUMMARY -----------
Known viruses: 20752
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
I/O buffer size: 131072 bytes
Time: 0.472 sec (0 m 0 s)

while the debug output is still written to stderr:

LibClamAV debug: Loading databases from /var/lib/clamav
LibClamAV debug: Loading /var/lib/clamav/daily.cvd
# ^^^^^^^^^^^^^^^^^^^^^^^^^
LibClamAV debug: /var/lib/clamav/daily.cvd: CVD file detected
LibClamAV debug: in cli_cvdload()
LibClamAV debug: MD5(.tar.gz) = baaf7679f39372dbf66ae9e0785d7674
LibClamAV debug: Decoded signature: baaf7679f39372dbf66ae9e0785d7674
LibClamAV debug: Digital signature is correct.
LibClamAV debug: in cli_untgz()
LibClamAV debug: Unpacking /tmp/55408efc7235304c/COPYING
LibClamAV debug: Unpacking /tmp/55408efc7235304c/viruses.db2
LibClamAV debug: Loading databases from /tmp/55408efc7235304c
LibClamAV debug: Loading /tmp/55408efc7235304c/viruses.db2
LibClamAV debug: Initializing trie.
LibClamAV debug: Loading /var/lib/clamav/main.cvd
# ^^^^^^^^^^^^^^^^^^^^^^^^
LibClamAV debug: /var/lib/clamav/main.cvd: CVD file detected
LibClamAV debug: in cli_cvdload()
LibClamAV debug: MD5(.tar.gz) = 1b99fa97eec06a4e2946d2c53d63f2c1
LibClamAV debug: Decoded signature: 1b99fa97eec06a4e2946d2c53d63f2c1
LibClamAV debug: Digital signature is correct.
LibClamAV debug: in cli_untgz()
LibClamAV debug: Unpacking /tmp/0f990a3bf0b3029a/COPYING
LibClamAV debug: Unpacking /tmp/0f990a3bf0b3029a/viruses.db
LibClamAV debug: Loading databases from /tmp/0f990a3bf0b3029a
LibClamAV debug: Loading /tmp/0f990a3bf0b3029a/viruses.db

(the two comments lines beginning with # above point to the two DB
files I wanted to determine)

Thus, I'm not able to grep '/var/lib/clamav/daily.cvd' and
'/var/lib/clamav/main.cvd' out from the content directed to a pipe.

Shouldn't force the '--stdout' option to write everything to stdout?

In addition, is there a less tricky way to determine the DB files
hardcoded into clamscan?

Thanks and
best regards,
rob.
Re: 'clamscan --stdout --debug' still writes to stderr [ In reply to ]
On Tue, 6 Apr 2004 14:03:05 +0200
Robert Allerstorfer <roal@anet.at> wrote:

> while the debug output is still written to stderr:
>
> LibClamAV debug: Loading databases from /var/lib/clamav
> LibClamAV debug: Loading /var/lib/clamav/daily.cvd
> # ^^^^^^^^^^^^^^^^^^^^^^^^^

That's libclamav's output and libraries shouldn't write to stdout.

> In addition, is there a less tricky way to determine the DB files
> hardcoded into clamscan?

Something like:

#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hardcoded database directory: %s\n", cl_retdbdir());
return 0;
}

;-) (compile it with -lclamav)

--
oo ..... Tomasz Kojm <tkojm@clamav.net>
(\/)\......... http://www.ClamAV.net/gpg/tkojm.gpg
\..........._ 0DCA5A08407D5288279DB43454822DC8985A444B
//\ /\ Tue Apr 6 14:30:22 CEST 2004
Re: 'clamscan --stdout --debug' still writes to stderr [ In reply to ]
On Tue, 6 Apr 2004, 14:34 GMT+02 Tomasz Kojm wrote:

> That's libclamav's output and libraries shouldn't write to stdout.

[Robert Allerstorfer]
>> In addition, is there a less tricky way to determine the DB files
>> hardcoded into clamscan?

> Something like:

> #include <stdio.h>
> int main(int argc, char **argv)
> {
> printf("Hardcoded database directory: %s\n", cl_retdbdir());
> return 0;
> }

> ;-) (compile it with -lclamav)

I see, thanks. For now, I will use the following command to determine
clamav's hardcoded databases directory:

[root@baby root]# clamscan --debug /dev/null 2>&1 | sed q | sed -ne 's/[^/]*\(.*\)/\1/p'
/var/lib/clamav

best,
rob.