The title mostly says it all on this one, but it seems that doveadm user has 
unique behaviour when a wildcard username is given, causing it to return a list 
of matching usernames in place of regular output, ignoring other command line 
options such as the -f (field) option.

For example, I had hoped to use the following command in a script to easily get 
a list of all user home locations (excluding local users):

doveadm user -f home *@*

However the results are a list of usernames, rather than a list of home 
locations as I had hoped.

I’ve tagged this thread as Bug/Enhancement as outputting a list of matched 
usernames is clearly the intended behaviour, but it could certainly be 
clarified, as could the fact that the -f option is ignored in this special case.

I think that the correct “fix” here is to clarify in the documentation that 
wildcard matching is a separate use-case of this command in which the -f (and 
possibly other?) options are ignored and the results are always given as a list 
of matching usernames. It needs to be clear that doveadm user u...@domain1.tld 
u...@domain2.tld and doveadm user *@* are not equivalent, even if those are the 
only two users, as this differs from many other unix commands where wildcards 
are permitted, e.g- using rm with a wildcard is equivalent to adding all 
matching files to the command yourself.

However, in future I’d like to see support for the -f option with wildcard 
matches as well, with -f user simply being the default. This would be much 
easier for a script inspecting user home directories, as for now my alternative 
is to use the wildcard match to get a list of names, then call dovecot user -f 
home <user> for each one to get their home location, which isn’t nearly as nice 
=)

- Haravikk

Reply via email to