Cisco-Talos / clamav

ClamAV - Documentation is here: https://docs.clamav.net
https://www.clamav.net/
GNU General Public License v2.0
4.43k stars 706 forks source link

`fresclam --quiet` is not quiet anymore #1302

Open rma-x opened 4 months ago

rma-x commented 4 months ago

Commit https://github.com/Cisco-Talos/clamav/commit/a21cc6dcd7f93ad7418ea6c2f1e01612e23fc36e broke freshclam --quiet. It now prints out the same messages as if it was called without that switch:

$ sudo freshclam --quiet
ClamAV update process started at Mon Jul  8 15:28:32 2024
daily.cld database is up-to-date (version: 27330, sigs: 2064003, f-level: 90, builder: raynman)
main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
bytecode.cld database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)

I investigated this some more and found that there seem to be two mechanisms for implementing --quiet switches in place. One uses mprintf() and the mprintf_quiet global variable, the other uses the msg_callback() function pointer and the respective cli_*msg() frontends that call the callback to pass the message on to logg(), if applicable. freshclam initializes this callback mechanism, but then calls logg() directly and hence --quiet does not filter out anything.