asserts and manadatory build instructions (was ITS#8240)
by Michael Ströder
hyc(a)symas.com wrote in ITS#8240:
> Our patch response was too hasty. There is no OpenLDAP bug here, the real
> issue is production binaries being built with asserts enabled instead of
> compiling with -DNDEBUG. That's an issue for packagers and distros to resolve.
> Closing this ITS, not an OpenLDAP bug.
Maybe I missed something. But this is the first time I've heard about -DNDEBUG
being mandatory when compiling binary packages for production use. Does it
have other effects?
And what are general rules for assert statements in OpenLDAP code?
In my own (Python) code assert statements are supposed to be only triggered if
something goes wrong *internally* (type issues etc.). If somebody manages to
trigger an assert statement with invalid input from "outside" I always
consider this to be a serious bug revealing insufficient error handling even
though e.g. web2ldap just logs the exception but won't crash. YMMV, but please
clarify.
I also wonder whether there are more mandatory rules for building packages and
where I can find them.
Please don't get me wrong: My inquiry is in good faith to avoid unnecessary
ITS based on misunderstanding.
Ciao, Michael.
1 year, 6 months
Curious "missing parent" check in mdb_idscopes(), how may this occur?
by Konstantin Andreev
Hi,
I am contemplating the mdb search mechanics, and puzzled by "missing parent" check in mdb_idscopes():
| /* If we didn't advance, some parent is missing */
| if ( id == prev )
| return MDB_NOTFOUND;
where "id" and "prev" are parent and child ids that come from the same "UP" ( child -> parent ) record of "dn2id" table. Here is a source code approximation for easier reading:
| MDB_val key = { sizeof(ID), & id }, data;
| mdb_cursor_get( "dn2id", key, data, MDB_SET );
| // reading last sizeof(ID) bytes of data.mv_data
| ID prev = *(ID *)(data.mv_data + data.mv_size - sizeof(ID));
IIUC, there is no records in "dn2id" where parent and child ids are the same. There is no by construction, except "super-root", where both ids are zeros, but zero id doesn't follow this execution path.
So, how may [id == prev] occur? Could you, please, explain?
The check came from 5a08b661 and 437f21b commits (ITS#7705,#7800 fix ...), I have read both, but they haven't helped either.
Regard, Konstantin.
3 years, 7 months