[Dovecot] 'Doveadm user' could use better error codes

dovecot dovecot at vosslamber.nl
Tue Dec 28 16:34:12 EET 2010


On 28-12-10 15:23, dovecot wrote:
> On 28-12-10 14:39, Thomas Leuxner wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> - -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> The error codes for' doveadm user' should be improved to avoid error 
>> handling workarounds when scripting commands:
>>
>> $ doveadm user
>> doveadm user [-a<userdb socket path>] [-x<auth info>]<user mask>  […]
>> $ echo $?
>> 1
>> $ doveadm user foo
>> userdb lookup: user foo doesn't exist
>> $ echo $?
>> 0
>>
>> Please compare to ID output:
>>
>> $ id foo
>> id: foo: No such user
>> $ echo $?
>> 1
>>
>> Regards
>> Thomas
>>
>> - -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
>>
>> iEYEARECAAYFAk0Z6FkACgkQ+meF/S97aXgxnQCfWk1ECdMoCewbr1O6lAkdksoH
>> 324AoLCTg0dFmFhumEkM936irpcG7YF5
>> =wuwz
>> - -----END PGP SIGNATURE-----
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
>>
>> iEYEARECAAYFAk0Z6HQACgkQ+meF/S97aXgGdACfawa02hZxk71CjIsj64sW0xXv
>> CW8AoJRQZLFi4QwbvcDg6rzqzUv/3mE8
>> =Rt1O
>> -----END PGP SIGNATURE-----
>>
>
> It behaves just as 'man doveadm' promisses.....
>
> EXIT STATUS
>        doveadm will exit with one of the following values:
>
>        0   Selected command was executed successful.
>
> >0  Command failed in some way.
>
> So, this seems to be correct!
>
>

SYNOPSIS
        doveadm [-Dv] user [-a userdb_socket_path] [-x auth_info] user ...


if you do a
$ doveadm user
$ echo $?
1

This is because you missed one needed parameter ('<user>')

$ doveadm user dovecot
userdb: dovecot
   system_groups_user: dovecot
   uid       : 114
   gid       : 114
   home      : /usr/local/lib/dovecot
$ echo $?
0

Now its informing you of the uid and gid for the user 'dovecot', and 
because of that returning 0.




More information about the dovecot mailing list