On Thu, 19 Jun 2003 [EMAIL PROTECTED] wrote:

Hi,

(hope you do not get it twice - something ate the first mail :(( )

> > There will be at least one problem with
> >         xercesc_2_3::XMLTransService::makeNewTranscoderFor
>
> There have been numerous commits since 1.5 was released, and a fix for this
> was one of them, although it really should be fixed in Xerces-C.  I haven't
> tried with the absolute latest Xerces-C cvs code, but the latest Xalan-C
> should be compatible.  If I get a chance today, I will update to the latest
> Xerces-C and check.

both cvs trees have fixes for this now :-)


> It would be great if we could get these changes in for the next release.
> If there's anything I can do, please let me know.

I still do have a problem with the FreeBSD port. Apart from an install
target and some fixes to (run)configure[1] I included some patches
from
CVS and it seems to work fine on at least FreeBSD 5.1 now.

[1] will mail those within the next days.


For 4-STABLE using 'gcc version 2.95.4 20020320 [FreeBSD]' I do have
following Problem (which might be worth a bug report). Please note
that line numbers may be wrong because of debugging output fprintfs.

It all starts in
        XalanTransformer/XalanTransformer.cpp
--- cut ---
void
XalanTransformer::initialize()
{
        // Initialize Xalan.
        try {
                s_emptyInputSource = new XSLTInputSource; // seems ok
                s_xsltInit = new XSLTInit;
        } catch (...) {
                fprintf(stderr, "[%s:%s:%d] caught Exception\n\n",
__FILE__, __func__, __LINE__);
        }
...
--- cut ---

I will say something about the catch(...) in a minute.


in XSLT/XSLTInit a numer of member variables need to be initialized:

--- cut ---
        const PlatformSupportInit       m_platformSupportInit; // OK

        const DOMSupportInit            m_domSupportInit; // XXX

        const XMLSupportInit            m_xmlSupportInit;

        const XalanSourceTreeInit       m_xalanSourceTreeInit;

        const XPathInit                 m_xpathInit;
--- cut ---


this resp. DOMSupportInit after PlatformSupportInit gets us to

[xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp:PlatformSupportInit:79]
 s_initCounter=0
[xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp:initialize:106]
[xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp:PlatformSupportInit:79]
 s_initCounter=1

[xml-xalan/c/src/DOMSupport/DOMSupportInit.cpp:DOMSupportInit:80] 
s_initCounter=0
[xml-xalan/c/src/DOMSupport/DOMSupportInit.cpp:initialize:107]
[xml-xalan/c/src/DOMSupport/DOMServices.cpp:initialize:149]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:XalanDOMString:134]

and then leads us to

[xml-xalan/c/src/DOMSupport/DOMServices.cpp:initialize:149]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:XalanDOMString:134]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:append:417]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:length:834]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscode:383]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscode:385]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscode:399]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:TranscodeFromLocalCodePage:1294]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1126] 
going to crash soon...
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1127] 
theSourceString = xml
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1130]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1133]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1171]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1173]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1183]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1185]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1192]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1195]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1197]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1200]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1202]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1207]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscodeFromLocalCodePage:1211]
[xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:doTranscode:402]
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:68]
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:69] 
this=0xbfbff398
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:70] code=202
[xml-xalan/c/src/XalanDOM/XalanDOMString.hpp:TranscodingError:711]
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:79]
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:80] 
this=0x8055290
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:81] code=202
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:89]
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:90] 
this=0xbfbff398
[xml-xalan/c/src/XalanDOM/XalanDOMException.cpp:XalanDOMException:91] code=202
[xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp:initialize:212] caught 
Exception <----

this is where my catch(...) prevents us from what had ended
in a Core dump.


So what happens in doTranscodeFromLocalCodePage ? Here is the path:

        typedef XalanDOMString::size_type       size_type;
        XalanArrayAutoPtr<char>         tempString;
        if (theSourceStringIsNullTerminated == true)
        { } else {
                tempString.reset(new char[theSourceStringLength + 1]);
                strncpy(tempString.get(), theSourceString, 
theSourceStringLength);
                tempString[theSourceStringLength] = '\0';
                theSourceString = tempString.get(); // XXX ???
        }
            // See how many chars we need to transcode.
        const size_t    theTargetLength =
                        mbstowcs(0, theSourceString, 
size_t(theSourceStringLength)); // returns -1;
        if (theTargetLength == ~size_t(0))
        {
                return false;
        }


this 'return false;' brings us back to the else path of
        doTranscode(...) where the exception will be thrown
which would never be caught.


The great questions are:
a) why does mbstowcs(..) fail on 4-STABLE bu not on 5.1 ?
b) [more important] how to correctly recover from this error path ?
        I do not ocnsider it a FreeBSD specific problem but simply an
        unhandled error path in xalan.


If we can fix this ( and I will not find any more of those)
I will be happy to release some testing ports for FreeBSD
for xerces-c 2.3 and xalan-1.5 (which work on 5.1 already).



PS: expect more of those as I can still make it dump Core though
        this may simply be the result of incorrect handling of
        the error.  This time it is:
        'theSourceString = XalanDOMException caught.  The code is'
        but it is too late for today to also debug this.

-- 
Greetings

Bjoern A. Zeeb                          bzeeb at Zabbadoz dot NeT
56 69 73 69 74                          http://www.zabbadoz.net/

Reply via email to