Bug 511766

Summary: when monitoring clamd with clamdtop, kmail virus-scan does not use clamd
Product: [Applications] kmail2 Reporter: Ernst Bachmann <kde+bugs>
Component: miscAssignee: kdepim bugs <pim-bugs-null>
Status: REPORTED ---    
Severity: minor CC: winter
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ernst Bachmann 2025-11-07 11:29:13 UTC
SUMMARY

The anti-virus filter provided by Kmail calls the shell-script kmail_clamav for the scan.

This shell script tries to find out if clamd is running, and if it is, uses clamdscan.
If the check for a running clamd fails, it uses clamscan, which is much slower.

Problem is, the check is performed by a simple `ps -axo comm|grep clamd` = "clamd"

Now, if a second virus scan with clamdscan is running in parallel, or if you try to monitor clamd activity with clamdtop, the "grep" will pick up multiple processes, causing the script to fall back to the slower scan, even if it's not neccessary.

STEPS TO REPRODUCE
1. set up clamd and the anti virus filters in kmail
2. monitor clamd activity using clamdtop
3. have kmail scan mails

OBSERVED RESULT
None of the virus scans performed by kmail show up in clamdtop.
If you stop clamdtop, but instead monitor CPU usage using "top", clamd gets CPU usage spikes for each mail scanned, so it is used then..

EXPECTED RESULT
kmail_clamav should use clamd if it is running, regardless of other tasks with "clamd" in their names.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 13
KDE Plasma Version: 6.3.6
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2
Kernel Version: 6.12.48+deb13-amd64 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

Sorry if this bug should be filed against kmail directly instad of kontact->kmail component. This is where the bug reporting link from the help menu led me to.