[SSSD] Make return codes of basic sysdb operations consistent

Lukas Slebodnik lslebodn at redhat.com
Tue Apr 22 10:31:36 UTC 2014


On (22/04/14 11:39), Jakub Hrozek wrote:
>On Tue, Apr 22, 2014 at 11:31:31AM +0200, Pavel Reichl wrote:
>> Hello,
>> 
>> I recently started working on ticket #1991.
>> https://fedorahosted.org/sssd/ticket/1991
>> 
>> "The return codes of various sysdb operations differ. Some search
>> operations would return ENOENT if they don't find a matching object some
>> would return EOK but an empty result list."
>> 
>> I think that the core of the problem is the expectation that ldb_search
>> returns LDB_ERR_NO_SUCH_OBJECT in case no results were found. But it
>> instead returns LDB_SUCCESS and sets result->count to 0.
>> 
>> I think it would be best for sysdb functions in case that no results
>> were found to return both ENOENT value and 'properly' empty list. 
>> 
>> Thanks for opinions.
>> 
>> Pavel Reichl
>
>I agree with returning an error code rather than an empty list. The
>empty list has bitten us in the past already, the return code would make
>sure the programmer has to explicitly handle it.
>
>I wonder if we could go even further and introduce a new error code
New error code will make sense if you want more precise expression of error.

>(ERR_NO_SUCH_OBJECT). ENOENT is used quite a bit in the code, so the
What will be difference between ENOENT and ERR_NO_SUCH_OBJECT?
    for example: ERR_MISSING_CONF

>new error code might be harder to convert to:
>    $ git grep ENOENT | wc -l
>    756

LS



More information about the sssd-devel mailing list