On Mon, Feb 29, 2016 at 11:22:00AM +0100, Pavel Březina wrote:
On 02/26/2016 01:47 PM, Jakub Hrozek wrote:
>On Wed, Feb 24, 2016 at 12:41:24PM +0100, Pavel Březina wrote:
>>>> From f61d0192b8254247802167ea385b52f65d4e175d Mon Sep 17 00:00:00 2001
>>>>From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina(a)redhat.com>
>>>>Date: Thu, 18 Feb 2016 14:25:18 +0100
>>>>Subject: [PATCH 07/12] sysdb: reset ldb errors
>>>>
>>>>After ldb connect ldb context contains the following error:
>>>>"NULL Base DN invalid for a base search"
>>>>
>>>>This comes from internal ldb function ldb_set_default_dns() which
>>>>runs base search on NULL dn to discover records similar to what
>>>>rootDSE provides. However, tdb backend considers this an error
>>>>and sets the message above.
>>>>
>>>>This may break memory leak checks in tests when we do push/pop on
>>>>test_ctx which is a indirect parent of ldb_context. The error message
>>>>is allocated when push is called but it is freed by other ldb queries
>>>>and therefore not preset during the push phase and thus the leak check
>>>>fails.
>>>
>>>I know this fixed an error for you, but I wonder if it wouldn't be
>>>better to work around the issue or use this only in the test itself. The
>>>reason being that the function is only part of ldb_modules.h so it feels
>>>a bit hacky to use it outside an ldb module..
>>
>>I am not aware of other simple way to reset the error. But maybe we can
>>run some simple ldb query that ought to be successful thus we can remove
>>ldb_module.h?
>>
>>We can move it to the test (or to test domain setup) if you want.
>
>It feels a bit cleaner to me to rely on a function that we're not
>supposed to call only in tests and not in the deamon code.
I'm sorry, I can't process those two negatives :-) Does it mean I should
move it to tests or to leave the patch as is?
I would prefer to move the function to tests, yes. What I meant to say
is that using a function that is supposed to be called in modules feels
like a bit of a hack to me and I feel more comfortable with hacks in
tests rather than hacks in the daemon.