#531 loading an entry from the database should use str2entry_fast
Closed: wontfix None Opened 9 years ago by lkrispen.

When loading an entry from the backend it is known to be well formed and str2entry_fast() could be used, but always str2entry_dupcheck() is called.
The reason is that id2entry() sets the flag SLAPI_STR2ENTRY_NO_ENTRYDN and this flag is not contained in the set of flags known to be handled by str2entry_fast() although it does have code for this flag

A good catch, Ludwig. It's a bug. Thank you for finding it out!

Fix Description: This patch is adding flags SLAPI_STR2ENTRY_
which is used to determine the string formatted entry can be
processed by str2entry_fast or not. Also, this patch defines
a macro str2entry_can_use_fast to increase the code readability.

Reviewed by Mark (Thank you!!!).

Pushed to master: commit 7af4fc1

Would prefer that macros are in ALL CAPS to distinguish them from regular functions.

Also, the logic looks strange:
+ if (str2entry_can_use_fast(flags))
+ {
e= str2entry_dupcheck( NULL/dn/, s, flags, read_stateinfo );
- }
- else
- {
+ }
+ else
+ {
e= str2entry_fast( NULL/dn/, s, flags, read_stateinfo );
- }

It looks like if (str2entry_can_use_fast(flags)) then do not call str2entry_fast, call str2entry_dupcheck instead - is this as intended?

Description: Based upon the comments by Rich Megginson (Thanks!!),
changing the newly introduced macro to all upper case. Plus, it
was pointed out that the meaning of the macro name was opposite.
Fixing these 2 issues, this patch replaces the macro str2entry_
can_use_fast with STR2ENTRY_CANNOT_USE_FAST.

Thanks to Rich for his reviews and comments!!

Pushed to master: commit b3a0ab7

Rich Megginson wrote:

And if we know that all teh entries will be read from disk, we should ensure that their version is not exposed to #531 and str2entry_fast is used.
I don't think that fix is in 1.2.11 - I suppose we could consider a backport to 6.5

This patch is in 1.3.0 and newer, but not in 1.2.11.

I set to milestone.

Pushed to 389-ds-base-1.2.11: commit b5dc3db

Note: 389-ds-base-1.3.0 was branched after this patch is pushed to master. Thus, 389-ds-base-1.3.0 as well as 1.3.1 include this fix.

Metadata Update from @rmeggins:
- Issue assigned to nhosoi
- Issue set to the milestone:

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/531

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

2 years ago

Login to comment on this ticket.