Bug 511766 - when monitoring clamd with clamdtop, kmail virus-scan does not use clamd
Summary: when monitoring clamd with clamdtop, kmail virus-scan does not use clamd
Status: REPORTED
Alias: None
Product: kmail2
Classification: Applications
Component: misc (other bugs)
Version First Reported In: unspecified
Platform: Debian stable Linux
: NOR minor
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-07 11:29 UTC by Ernst Bachmann
Modified: 2025-11-07 12:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.