1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00
Commit Graph

4366 Commits

Author SHA1 Message Date
Daniel Veillard
5fe9e9ed1c Remove risk of lockup in dictionary initialization
Reported by Petr Sumbera <petr.sumbera@oracle.com>
Two threads entering xmlInitializeDict concurently could lead
to a lockup due to multiple initializations of the lock used.
To avoid this problem move this to a new private function
called from xmlOnceInit() and deprecate the old initalizer.
Since threaded programs must call xmlInitParser() and this
will lead to dereference of private data and the call to
xmlOnceInit() guaranteed to be unique this should be safe now.
2013-04-05 23:10:41 +08:00
Daniel Veillard
bf4a8f0ea8 Fix python bindings with versions older than 2.7
Need fixing on the Capsule usage, the lack of PyBytes,
lack of io module and the way to access exception details.
2013-04-02 10:27:57 +08:00
Roumen Petrov
4d7a32959b rebuild docs:Makefile.am 2013-04-01 16:53:27 +08:00
Roumen Petrov
95850fcd75 elfgcchack.h after rebuild in doc 2013-04-01 16:52:42 +08:00
Roumen Petrov
2ff9284325 elfgcchack for buf module 2013-04-01 16:48:44 +08:00
Daniel Veillard
54ae471c14 Regenerated API, and testapi, rebuild documentation
After the previous commit adding 2 new entry points
2013-04-01 16:42:12 +08:00
Alex Bligh
28876afb4e Add xmlXPathSetContextNode and xmlXPathNodeEval
This patch adds xmlXPathSetContextNode and xmlXPathNodeEval,
which make it easier to evaluation XPath expressions with a
context node other than the document root without poking about
inside the internals of the context.

This patch is compile-tested only, and is my first libxml2
contribution, so please go easy.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
2013-04-01 16:42:12 +08:00
Daniel Veillard
87f3287d9b Fix tree iterators broken by 2to3 script 2013-04-01 13:33:42 +08:00
Daniel Veillard
2cb6bf8eb0 update all tests for Python3 and Python2 2013-03-30 22:33:06 +08:00
Daniel Veillard
6f18465189 A few more fixes for python 3 affecting libxml2.py
need a few changes to the generator and the libxml.py stub
2013-03-30 22:33:06 +08:00
Daniel Veillard
3798c4adbb Fix compilation on Python3
while still compiling on recent Python2:
  - change the handling of files, tweak the generator, get the fd
    instead of the FILE *, dup it and fdopen based on mode, add a
    Release function on Python3 and call to flush from the generated
    python stubs
  - switch to using Capsules instead of CObjects
  - fix PyString to PyBytes
  - fix PyInt to PyLong
  - tweak the module registration to compile on both versions
  - drop PyInstance check for passed xmlNodes and instead check
    attributes presence

Daniel
2013-03-30 22:33:06 +08:00
Daniel Veillard
d8a75bffa4 Converting apibuild.py to python3
not finished ....
2013-03-30 22:33:06 +08:00
Daniel Veillard
3cb1ae26ec First pass at starting porting to python3 2013-03-30 22:33:06 +08:00
Daniel Veillard
a5e513a552 Fix a uneeded and wrong extra link parameter 2013-03-30 22:33:06 +08:00
Daniel Veillard
b8e3f80da7 updated configure.in for python3 2013-03-30 22:33:05 +08:00
Daniel Veillard
0ab8ce5302 Switched comment in file to UTF-8 encoding 2013-03-30 22:33:05 +08:00
Daniel Veillard
215a729645 Extend gitignore 2013-03-30 22:33:05 +08:00
Shaun McCance
519bc6a3ab Add support for xpathRegisterVariable in Python 2013-03-27 15:55:36 +08:00
Daniel Veillard
483272f3f0 Added a regression tests from bug 694228 data
Provided by Mark Rowe <mrowe@apple.com>
2013-03-27 13:37:14 +08:00
Daniel Veillard
ab0e35044c Activate detection of encoding in external subset
https://bugzilla.gnome.org/show_bug.cgi?id=694228

the ctxt->encoding was percolated down when parsing the external
subset leading to failures
2013-03-27 13:21:38 +08:00
Daniel Veillard
113384f126 Add documentation for xmllint --xpath
https://bugzilla.gnome.org/show_bug.cgi?id=694822

this wasn't documented in the man page, and there was a typo in
xmllint help output.
2013-03-27 11:43:41 +08:00
Mikhail Titov
8e2098aef7 Fix an output buffer flushing conversion bug
for https://bugzilla.gnome.org/show_bug.cgi?id=694982
On a flush operation, everything must be converted
2013-03-27 11:00:31 +08:00
Denis Pauk
e1631e1cfc Few cleanup patches for Windows
https://bugzilla.gnome.org/show_bug.cgi?id=690878
provided by Cole <coleharrisjohnson@gmail.com>
2013-03-27 09:55:14 +08:00
Daniel Veillard
f7aeda24f6 Fix the URL of the SAX docuemntation from James
as it has moved
2013-03-23 10:31:26 +08:00
Csaba László
1f6c42cffd Fix an old bug in xmlSchemaValidateOneElement
Recently I have run into the very same problem Tiberius Duluman did back in
Wed, 13 May 2009 15:56:55 +0300 ([xml] Bug in xmlSchemaValidateOneElement
function). Now I can proof now that his problem is a valid problem. I checked
the latest available version of xmlschemas.c (2.9.0.) and the problem is still
there!
I think I have found a solution to the problem which I'd like proof with you:
My quick solution to the problem is to replace line 27849 in
xmlschemas.c
(v2.9.0.) in function xmlSchemaVDocWalk
    valRoot = xmlDocGetRootElement(vctxt->doc);
with this one:
    valRoot = vctxt->validationRoot ? vctxt->validationRoot : xmlDocGetRootElement(vctxt->doc);
Currently I'm using version 2.7.8. in Windows and this change seems to solve
the problem.
2013-03-18 15:30:00 +08:00
Daniel Veillard
cff2546f13 Cache presence of '<' in entities content
slightly modify how ent->checked is used, and use the lowest bit to
keep the information
2013-03-11 15:59:22 +08:00
Daniel Veillard
a3f1e3e571 Avoid extra processing on entities
If an entity has already been checked for correctness no
need to check it on every reference
2013-03-11 15:59:21 +08:00
Gilles Espinasse
a09890684c Fix configure cannot remove messages
this is the other way to solve ./configure cannot remove messages by
simply removing rm detection in configure.in

There is already a raw 'rm -f' at the end on configure.in
2013-03-04 22:46:21 +08:00
Daniel Veillard
c100e69c4b fix schema validation in combination with xsi:nil
Based on Thomas Gamper <icicle@cg.tuwien.ac.at> findings and
initial patch

There is no point doing a regexp validation of further
content if there actually is no further content because the
element is nilled.
2013-02-28 19:02:32 +08:00
Steve Wolf
19d785b5c7 xmlCtxtReadFile doesn't work with literal IPv6 URLs
https://bugzilla.gnome.org/show_bug.cgi?id=694185

RedHat Bug 624626 discusses the new behavior of libxml regarding brackets
around IPv6 addresses.  In earlier versions such as 2.6.27, uri.c stripped the
brackets (e.g. uri->server == "fdf2:1e39:73d1:934e::119"); in the current
version it returns IPv6 addresses with brackets intact (e.g. uri->server
== "[fdf2:1e39:73d1:934e::119]").

Thus in 2.9.0, xmlCtxtReadFile() has a problem when it is passed a URL
containing a literal IPv6 address.  xmlCtxReadFile() and its subroutines pass
uri->server unchanged to getaddrinfo(), which doesn't recognize a bracketed
IPv6 address, so the read fails.

This strips the [ and ] from IPv6 addresses allowing getaddrinfo()
to work properly with such URIs.
2013-02-28 18:22:46 +08:00
Alexey Neyman
d749528aa9 Silent the new python test on input
Just make it silent if there is no error
2013-02-27 13:11:47 +08:00
Alexey Neyman
a9016c4927 Fix a few problems with setEntityLoader
1. Setting entity loader does not increment the refcount on the Python object
passed in. This works only if the object is not deleted. For example, the
following code results in segmentation fault in Python interpreter when
attempting to process any document:

[[[
def register_entity_loader():
    def entity_loader(URL, ID, ctxt):
        ...
    libxml2.setEntityLoader(entity_loader

register_entity_loader()
]]]

2. setEntityLoader() does not verify if the passed object is callable. If it
is not, current implementation attempts to call it anyway and failing that,
silently moves on to default entity loader. Attached patch makes
setEntityLoader raise ValueError exception if non-callable object is
passed.

3. In debug mode, pythonExternalEntityLoader() outputs the result object to
stderr, while the messages before and after the object (description + newline)
go to stdout. Attached patch makes them all go to stdout.
2013-02-25 16:07:09 +08:00
Alexey Neyman
48da90bc4a Python binding for xmlRegisterInputCallback
It is possible to make xmlIO handle any protocol by means of
xmlRegisterInputCallback(). However, that function is currently only
available in C API. So, the natural solution seems to be implementing Python
bindings for the xmlRegisterInputCallback.

* python/generator.py: skip xmlPopInputCallbacks
* python/libxml.c python/libxml.py python/libxml_wrap.h: implement the
  wrappers
* python/tests/input_callback.py python/tests/Makefile.am: also add a test case
2013-02-25 15:54:25 +08:00
Alexey Neyman
e32ceb93f4 Python bindings: DOM casts everything to xmlNode
I noticed another issue with Python bindings of libxml: the access methods do
not cast the pointers to specific classes such as xmlDtd, xmlEntityDecl, etc.
For example, with the following document:

<?xml version="1.0"?>
<!DOCTYPE root [<!ELEMENT root EMPTY>]>
<root/>

the following script:

import libxml2
doc = libxml2.readFile("c.xml", None, libxml2.XML_PARSE_DTDLOAD)
print repr(doc.children)

prints:

<xmlNode (root) object at 0xb74963ec>

With properly cast nodes, it outputs the following:

<xmlDtd (root) object at 0xb746352c>

The latter object (xmlDtd) enables one to use DTD-specific methods such as
debugDumpDTD(), copyDTD(), and so on.
2013-02-21 16:00:03 +08:00
Daniel Veillard
23f05e0c33 Detect excessive entities expansion upon replacement
If entities expansion in the XML parser is asked for,
it is possble to craft relatively small input document leading
to excessive on-the-fly content generation.
This patch accounts for those replacement and stop parsing
after a given threshold. it can be bypassed as usual with the
HUGE parser option.
2013-02-19 10:21:49 +08:00
Daniel Veillard
bf058dce13 Fix the flushing out of raw buffers on encoding conversions
https://bugzilla.gnome.org/show_bug.cgi?id=692915

the new set of converting functions tried to limit the encoding
conversion of the raw buffer to the consumption one to work in
a more progressive fashion. Unfortunately this was bad for
performances and led to errors on progressive parsing when
a very large chunk was close to the end of the document. Fix
the new internal function and switch back to the old way of
converting. Fix another bug in the process.
2013-02-13 18:19:42 +08:00
Daniel Veillard
de0cc20c29 Fix some buffer conversion issues
https://bugzilla.gnome.org/show_bug.cgi?id=690202

Buffer overflow errors originating from xmlBufGetInputBase in 2.9.0
The pointers from the context input were not properly reset after
that call which can do reallocations.
2013-02-12 16:55:34 +08:00
Mark Salter
60adeea933 Fix rpmbuild --nocheck
if the %check section was omitted some of the file needed for
packaging would not be generated, move the generation to the
proper place.
2013-02-11 12:45:56 +08:00
Daniel Veillard
23922c536c When calling xmlNodeDump make sure we grow the buffer quickly
Make sure the underlying new buffer allocated use a double-it scheme
for the time of the dump.
2013-02-11 12:01:05 +08:00
Daniel Veillard
2af19f985b Cleanup of a duplicate test
in an and expression, pointed by Thomas Jarosch <thomas.jarosch@intra2net.com>
Daniel
2013-01-28 17:44:53 +01:00
Daniel Veillard
eea38159be Cleanup on duplicate test expressions
As pointed out by Thomas Jarosch <thomas.jarosch@intra2net.com>

Daniel
2013-01-28 16:55:30 +01:00
Patrick Gansterer
9c8eaabe83 Fix compiler warning after 153cf15905
Add missing cast for xmlNop to silence a compiler warning.
2013-01-04 19:48:55 +08:00
Dan Winship
cf8f0424db Fix an error in the progressive DTD parsing code
For https://bugzilla.gnome.org/show_bug.cgi?id=689958
We were looking for the wrong character in the input stream
2012-12-21 11:13:31 +08:00
Daniel Veillard
e4d16d7909 xmllint should not load DTD by default when using the reader 2012-12-21 10:58:14 +08:00
Daniel Richard
a0571ebeac Fix for win32/configure.js and WITH_THREAD_ALLOC
Building git master gives me the following error on Windows; this patch
fixes it:

	icl /EP /nologo /I..\include /D "NOLIBTOOL" /D "_REENTRANT"
libxml2.def.
src > int.msvc\libxml2.def
libxml2.def.src
Z:\...\libxml2-git8123c4f6_debug\win32\../include/libxml/xmlversion.h(105):
error: unrecognized token
  #if @WITH_THREAD_ALLOC@
      ^
Z:\...\libxml2-git8123c4f6_debug\win32\../include/libxml/xmlversion.h(105):
error: expected an expression
  #if @WITH_THREAD_ALLOC@
      ^
Z:\...\libxml2-git8123c4f6_debug\win32\../include/libxml/xmlversion.h(105):
error: unrecognized token
  #if @WITH_THREAD_ALLOC@
                        ^
NMAKE : fatal error U1077: 'icl' : return code '0x2'
Stop.
2012-12-12 17:16:00 +08:00
Petr Sumbera
6f49c73b53 Try IBM-037 when looking for EBCDIC handlers
http://en.wikipedia.org/wiki/EBCDIC_037
as it is another variat of EBCDIC
2012-12-12 15:41:30 +08:00
Daniel Veillard
8123c4f692 Fix Broken multi-arch support in xml2-config
partial revert of 87b4d6f610
coming from Fedora/RHEL/... but breaking other distros
as pointed out by Daniel Richard
2012-11-08 16:24:07 +08:00
Michael Wood
fb27e2cd20 Fix spelling of "length". 2012-10-30 10:18:49 +08:00
Tim Starling
0ad948ede2 Define LIBXML_THREAD_ALLOC_ENABLED via xmlversion.h
Otherwise, direct calls to xmlFree() etc. from the application will
use a different set of allocation functions to what was used to allocate
the memory internally.
2012-10-29 14:05:02 +08:00
Daniel Veillard
6a36fbe3b3 Fix potential out of bound access 2012-10-29 10:39:55 +08:00