[Home]

Summary:ASTERISK-07369: logger.conf parse errors incorrectly reported
Reporter:Thomas Equeter (waba)Labels:
Date Opened:2006-07-20 14:33:40Date Closed:2006-09-06 22:41:30
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If a parsing error occurs in logger.conf (for example, the [logfiles] header is missing), it is handled as a I/O error:

 Unable to open logger.conf: Bad file descriptor

This is the result of some glitches:

- ast_log() reports of the actual parsing errors go to the bit bucket, as there is no logger configuration yet (even though there is special code for when logchannels==NULL, weird)
- init_logger_chain() assumes that all ast_config_load() errors are I/O related or otherwise explainable through errno
- errno is not reset before such usage, therefore leading to misleading error messages (sidenote: This is very confusing to * newbies, in particular when their platform doesn't provide efficient debugging tools like strace ;-)

A possible fix would be to:
- figure out why ast_log() doesn't log when logchannels==NULL
- init errno to 0 before calling ast_config_load() in init_logger_chain() - or even inside ast_config_load() itself
- if errno is still 0 after a failed attempt to load logger.conf, then output something more like "Unable to parse logger.conf: %s"

Sorry for not including a patch, but I don't have the necessary time to learn enough of the asterisk codebase than to validate and test the above solution.
Comments:By: Steve Murphy (murf) 2006-09-06 22:40:28

Fixed in 1.2: 42200
Fixed in trunk: 42208

I think I messed up the bug number in the commit log. Thought the changes
in 1.2 would slide nicely into trunk, but I was sorely mistaken. Enough
has changed that 3 of 4 chunks of the diff failed. But it tested OK and runs
the same as the 1.2 version. And, since the file path changed between trunk and 1.2, there was no automatic way to do the job, so I resorted to svn diff and patch.

By: Steve Murphy (murf) 2006-09-06 22:41:29

Hmmm. Seems like the right thing to do. With it being fixed and committed and all, I mean!