[Date Prev][Date Next]
(ITS#8119) ldapsearch: put empty line after result not before next result
- To: openldap-its@OpenLDAP.org
- Subject: (ITS#8119) ldapsearch: put empty line after result not before next result
- From: firstname.lastname@example.org
- Date: Wed, 29 Apr 2015 18:51:58 +0000
- Auto-submitted: auto-generated (OpenLDAP-ITS)
Full_Name: Thomas Cort
Submission from: (NULL) (22.214.171.124)
ldapsearch outputs LDAP results in a loop. The LDIF separator isn't printed
after the result is printed. It's printed before the next result is printed.
This subtlety causes a problem for a program consuming the output of a
persistent ldapsearch (-Esync=rp). It has no way of knowing the current result
has been fully output until the separator is printed (when the next result comes
in), which could take a long time if there are no changes going on.
I think the newline should be printed at the end of the for-loop (after the
result is printed), not at the beginning (when the next result is received).
I tried moving the putchar('\n') to the end of the for-loop. The output is the
same for some simple searches I tried and the test suite passes. I'm hesitant to
submit that as a patch because I think there might be some subtle edge cases I
haven't hit where an extra newline would be inserted or omitted. Any ideas from
someone who understands the code?