#35 Log not clear enough on schema errors
Closed: wontfix None Opened 12 years ago by mkosek.

https://bugzilla.redhat.com/show_bug.cgi?id=733349

When a schema file has an error, the log file is not clear enough and may give
the impression the error is in dse.ldif

Example:
[25/Aug/2011:09:53:47 -0400] dse - parsing dse entry [attributeTypes]
[25/Aug/2011:09:53:47 -0400] dse - Please edit the file to correct the reported
problems and then restart the server.


Expected behaviour:
The server specifies in which file (and possible line number) the error was
encountered.

If we switch to using the openldap schema parser, not sure if we will be able to get this information. Otherwise, if we do not switch, we can fix this easily.

Fix description: Cryptic error message:
dse - parsing dse entry [attributeTypes]
is now replaced with:
dse - Parsing entry in file /path/to/schema/03bad.ldif failed.
dse - Invalid section [attributeTypes: <the rest of the invalid section up to 256 characters> ...]

Full sample log:
[] - str2entry_dupcheck: entry has no dn
[] dse - Parsing entry in file /etc/dirsrv/slapd-ID/schema/03bad.ldif failed.
[] dse - Invalid section [# attributes
attributeTypes: ( 2.16.840.1.113730.3.1.5 NAME 'changeNumber' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Changelog Internet Draft' )
attributeTypes: ( 2.16.840.1.113730.3.1.6 NAME 'targetDn' DESC 'Changelog ...]
[] dse - Please edit the file to correct the reported problems and then restart the server.

The file which failed to parse is now in the error log. The previous error "entry has no dn" explains the cause of the failure.

ok - is there any way we can get file/line number information?

Replying to [comment:7 rmeggins]:

ok - is there any way we can get file/line number information?

If you count '\n' in "entrystr" and accumulate them, yes, we can do it. ;)
while (( entrystr = dse_read_next_entry( buf, &lastp )) != NULL )

Improved the error message to print the line number.
Fix description: Cryptic error message:
dse - parsing dse entry [attributeTypes]
is replaced with:
dse_read_one_file - Parsing entry in file
/path/to/schema/03bad.ldif failed . (lineno: ##)
dse_read_one_file - Invalid section [attributeTypes:
<the rest of the invalid section up to 256 characters> ...]

Sample log:
[] - str2entry_dupcheck: entry has no dn
[] dse_read_one_file - Parsing entry in file /path/to/schema/03bad.ldif failed. (lineno: 13)
[] dse_read_one_file - Invalid section [#
attributeTypes: ( 2.16.840.1.113730.3.1.10 NAME 'deleteOldRdn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 X-ORIGIN 'Changelog Internet Draft' )
attributeTypes: ( 2.16.840.1.113730.3.1.11 NAME 'newSuperior' DESC 'Changelog attrib ...]

test schema file to cause parsing error.
03bad.ldif

Reviewed by Nathan and Rich (Thank you!!!)

Pushed to master.

$ git merge trac35
Updating 04dd396..d66a37b
Fast-forward
ldap/servers/slapd/dse.c | 45 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 37 insertions(+), 8 deletions(-)

$ git push
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.29 KiB, done.
Total 6 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
04dd396..d66a37b master -> master

Added initial screened field value.

Metadata Update from @nhosoi:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.2.10.rc1

7 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/35

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)

3 years ago

Login to comment on this ticket.

Metadata