Summary:ASTERISK-15504: [patch] Console documentation not loaded from XML
Reporter:Ben Klang (bklang)Labels:
Date Opened:2010-01-24 23:52:03.000-0600Date Closed:2010-03-09 17:55:58.000-0600
Versions:Frequency of
Environment:Attachments:( 0) astsvn-16688-no-glob-brace-sun.diff
Description:On a fresh install of Asterisk I was unable to load the console documentation from the core-en_US.xml file.  This results in CLI commands such as "core show application Dial" displaying error messages.

I noticed the following log messages when starting asterisk:
I/O warning : failed to load external entity "/var/opt/asterisk/documentation{/thirdparty/,/}*-{en_US,en_??,en_US}.xml"
[Jan 25 00:21:54] ERROR[2951]: xmldoc.c:1830 ast_xmldoc_load_documentation: Could not open XML documentation at '/var/opt/asterisk/documentation{/thirdparty/,/}*-{en_US,en_??,en_US}.xml'

The first line (without the timestamp) comes from libxml2.  The second line (beginning with ERROR[2951]) is from main/xmldoc.c.

The problem appears to be that the preceding glob() call around line 1801 is not actually expanding the list of possible files.  This results in the glob string itself being passed as the filename back to libxml2 and no XML documentation is loaded.


I did confirm the files exist and are readable:

$ ls -l /var/opt/asterisk/documentation{/thirdparty/,/}*-{en_US,en_??,en_US}.xml
/var/opt/asterisk/documentation/thirdparty/*-en_US.xml: No such file or directory
/var/opt/asterisk/documentation/thirdparty/*-en_??.xml: No such file or directory
/var/opt/asterisk/documentation/thirdparty/*-en_US.xml: No such file or directory
-rw-r--r--   1 root     root      304498 Jan 24 16:37 /var/opt/asterisk/documentation/core-en_US.xml
-rw-r--r--   1 root     root      304498 Jan 24 16:37 /var/opt/asterisk/documentation/core-en_US.xml
-rw-r--r--   1 root     root      304498 Jan 24 16:37 /var/opt/asterisk/documentation/core-en_US.xml
Comments:By: Ben Klang (bklang) 2010-02-15 14:19:11.000-0600

More information from my research.

glob() on Solaris indeed does not expand curly braces.  I have experimented with multiple calls to glob() using GLOB_APPEND with some success.  Unfortunately my C skills are lacking and the code I am creating results in segfaults.

I can post my broken patch here if it is of any use to the Asterisk developers.

By: Walter Doekes (wdoekes) 2010-02-16 02:31:31.000-0600

Something like this, bklang?

(Mind you, I only compiled it to check for warnings/errors. I haven't actually tested it.)

By: Chris Walton (crjw) 2010-02-16 08:09:40.000-0600

See also: bugid ASTERISK-1522402

By: Ben Klang (bklang) 2010-02-16 11:26:55.000-0600

Thanks crjw, this is ticket in fact a duplicate of ASTERISK-14381, which has a tested patch attached.

By: Jason Parker (jparker) 2010-03-09 17:55:57.000-0600

Duplicate of ASTERISK-14381.

Please search for existing issues before creating a new one in the future.