[ python-Bugs-1295808 ] expat symbols should be namespaced in pyexpat

SourceForge.net noreply at sourceforge.net
Sun Mar 19 01:25:32 CET 2006


Bugs item #1295808, was opened at 2005-09-19 21:44
Message generated for change (Comment added) made by tmick
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1295808&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Trent Mick (tmick)
Assigned to: Martin v. Löwis (loewis)
Summary: expat symbols should be namespaced in pyexpat

Initial Comment:
The Problem:
- you embed Python in some app
- the app dynamically loads libexpat of version X
- the embedded Python imports pyexpat (which was built
against
  libexpat version X+n)
--> pyexpat gets the expat symbols from the already
loaded and *older*
    libexpat: crash (Specifically the crash we observed
was in
    getting an old XML_ErrorString (from xmlparse.c)
and then calling
    it with newer values in the XML_Error enum:

      // pyexpat.c, line 1970
      ...
      // Added in Expat 1.95.7.
      MYCONST(XML_ERROR_UNBOUND_PREFIX);
      ...


The Solution:
Prefix all a exported symbols with "PyExpat_". This is
similar to
what Mozilla does for some common libs:
http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115


I'll attach the gdb backtrace that we were getting and
a patch.

----------------------------------------------------------------------

>Comment By: Trent Mick (tmick)
Date: 2006-03-19 00:25

Message:
Logged In: YES 
user_id=34892

As well, *possibly* the same should be done for Python's
bz2.so, although the only relevant exported symbol is
Util_UnivNewlineRead

  nm bz2.so \
    | grep -v " [a-zBUA] " \
    | grep -v "_fini\|_init\|initbz2"



----------------------------------------------------------------------

Comment By: Trent Mick (tmick)
Date: 2006-03-18 23:58

Message:
Logged In: YES 
user_id=34892

Attempted summary to get this patch into Python 2.5:

As Neal points out this is a duplicate of
<http://python.org/sf/1075984>. The patch on *that* bug
fixes the specific issue, but does not solve the general
problem (as  'mwh' pointed out in the comments there).

I think we should 
1. apply this patch
2. then perhaps update our expat version (see
http://python.org/sf/1433435,
http://mail.python.org/pipermail/python-dev/2006-March/062287.html),
3. then update Modules/expat/pyexpatns.h (that this patch
adds) for any new symbols in the new version of Expat.

Neal, Martin, Michael, what do you think?


----------------------------------------------------------------------

Comment By: Trent Mick (tmick)
Date: 2006-01-24 23:34

Message:
Logged In: YES 
user_id=34892

> This seems to be a duplicate of bug #1075984. 

You are right.

> Trent, is this patch sufficient to meet your embedding
> needs so that nothing else needs to be done?

Yes.

> I do not think this patch can be applied to 2.4.

That's fine. Getting this into Python >=2.5 would be good
enough.

Martin,
Have you had a chance to review this?

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-30 06:01

Message:
Logged In: YES 
user_id=33168

This seems to be a duplicate of bug #1075984.  I like this
patch better, but perhaps both patches (the one here and the
other bug report) should be implemented?

I think Martin helps maintain pyexpat.  Maybe he has some
ideas about either or both of these bugs/patches.  Martin,
do you think these are safe to apply?  I can apply the
patch(es) if you think it's safe.

Trent, is this patch sufficient to meet your embedding needs
so that nothing else needs to be done?

I do not think this patch can be applied to 2.4.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1295808&group_id=5470


More information about the Python-bugs-list mailing list