doveadm expunge silently ignores multiple -u flags instead of erroring or processing all users

Robert Kretowicz via dovecot <[email protected]> Thu, 16 Apr 2026 11:20:41 +0200
Newsgroups gmane.mail.imap.dovecot
Message-ID <[email protected]>
Hello,
I would like to report what I believe is a bug in doveadm expunge 
argument handling.
Summary
When multiple -u flags are passed to doveadm expunge, for example:
doveadm expunge -u user1 -u user2 -u user3 mailbox '*' BEFORE 2015-01-01
the command exits with code 0 (success) but only processes one of the 
specified users. The remaining users are silently skipped with no 
warning or error message produced.
Why this is a bug
This is a silent failure on a destructive, irreversible operation. An 
administrator has no indication that most users were not processed. Good 
CLI tools should either:

Accept multiple -u flags and process all specified users (consistent 
with how -F file works), or
Reject the command immediately with a clear error such as: Error: -u 
flag specified multiple times. Use -F <file> for multiple users.

Silently accepting invalid input and doing something unpredictable is 
the worst possible outcome, especially for a mail expunge operation.
Environment

OS: Debian GNU/Linux 12 (Bookworm)
Dovecot version: 2.3.x (from Debian package)

doveconf -n output available on request — omitted due to containing 
internal domain names.
Workaround I am currently using
bashfor user in user1 user2 user3; do
     doveadm expunge -u "$user" mailbox '*' BEFORE 2015-01-01
done
Thank you for your time.


Robert Kretowicz

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]