1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-14 22:50:08 +03:00

4171 Commits

Author SHA1 Message Date
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 87b4d6f6105658a99b976f812223c8edf4469265
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
Daniel Veillard
4ea74a440d Fix a portability issue for GCC < 3.4.0 2012-10-29 10:27:18 +08:00
Daniel Veillard
153cf15905 Fix large parse of file from memory
https://bugzilla.redhat.com/show_bug.cgi?id=862969
The new code trying to detect excessive input lookup would
just get wrong sometimes in the case of very large file parsed
directly from memory.
2012-10-26 13:50:47 +08:00
Daniel Veillard
711b15d545 Fix a bug in the nsclean option of the parser
Raised as a side effect of:
https://bugzilla.gnome.org/show_bug.cgi?id=663844
2012-10-25 19:23:26 +08:00
Daniel Veillard
a7982ce272 Adding streaming validation to runtest checks 2012-10-25 15:39:39 +08:00
Daniel Veillard
1abd221be5 Add a --pushsmall option to xmllint
To test the push parser with small chunks or 10 bytes
2012-10-25 15:37:50 +08:00
Daniel Veillard
6c91aa384f Fix a regression in 2.9.0 breaking validation while streaming
https://bugzilla.gnome.org/show_bug.cgi?id=684774
with help from Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
2012-10-25 15:33:59 +08:00
Daniel Veillard
87b4d6f610 Spec cleanups and a fix for multiarch support 2012-10-11 14:44:22 +08:00
Daniel Veillard
7457c67fb9 Remove potential calls to exit() 2012-10-11 12:25:51 +08:00
Daniel Veillard
713434d230 Silence a clang warning
as reported by Hans Wennborg <hans@chromium.org>
2012-09-26 10:21:06 +08:00
Daniel Veillard
7e86eb5d4b Cleanup the Copyright to be pure MIT Licence wording 2012-09-20 21:46:19 +08:00
Daniel Richard
bbe194518f Windows build fixes
Building 2.9.0 on MSVC7.1 was failing

This is because HAVE_CONFIG_H is not #defined
The patch addresses the above, adds testrecurse.exe and the
standard "make check" suite of tests to the MSVC makefile, and also
fixes the following (MSVC7.1) warnings:
buf.c(674) : warning C4028: formal parameter 1 different from
declaration
libxml2\timsort.h(71) : warning C4028: formal parameter 1 different from
declaration
2012-09-18 11:15:06 +08:00
Friedrich Haubensak
3f6cfbd1d3 Fix a thread portability problem
cannot compile libxml2-2.9.0 using studio 12.1 compiler on solaris 10

I.M.O. structure initializer (as PTHREAD_ONCE_INIT) cannot be used in
a structure assignment anyway
2012-09-15 17:21:23 +08:00
Wouter Van Rooy
e7715a5963 rand_seed should be static in dict.c
For https://bugzilla.gnome.org/show_bug.cgi?id=683933
rand_seed should be a static variable in dict.c

We ran into a problem with another library that exports rand_seed as a
function. Combined with 2.7.8 this was not a problem but later versions
have this problem.
2012-09-14 14:39:42 +08:00
Jan Pokorný
81d7a8245c Fix typos in parser comments
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2012-09-13 22:40:28 +08:00
Daniel Veillard
5d04ad11a8 Downgrade autoconf requirement to 2.63
It was automatically bumped to 2.68 and that's not needed
2012-09-11 17:17:15 +08:00
Daniel Veillard
38bbd3412d Release of libxml2-2.9.0
* libxml.spec.in: update
* doc/*: updated and regenerated
* libxml2.syms testapi.c: regenerated
v2.9.0
2012-09-11 15:00:08 +08:00
Daniel Veillard
7651606f31 Various cleanups to avoid compiler warnings 2012-09-11 14:02:08 +08:00
Daniel Veillard
742a0bbbcc Keep libxml2.syms when running "make distclean" 2012-09-11 13:37:30 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Csaba Raduly
429d3a0aae Allow to set the quoting character of an xmlWriter
It's otherwise impossible to set the quoting character of
attribute values of an xmlWriter.
2012-09-11 11:52:46 +08:00
Daniel Veillard
e00778b492 Followup to LibXML2 docs/examples cleanup patch 2012-09-08 21:09:26 +08:00
Daniel Veillard
f933c89813 Keep non-significant blanks node in HTML parser
For https://bugzilla.gnome.org/show_bug.cgi?id=681822

Regardless if the option HTML_PARSE_NOBLANKS is set or not, blank nodes
are removed from a HTML document, for example:

<html>
  <head>
    <title>This is a test.</title>
  </head>
  <body>
    <p>This is a test.</p>
  </body>
</html>

is read as:

<html><head><title>This is a test.</title></head><body>
    <p>This is a test.</p>
  </body></html>

This changes the default behaviour but the old behaviour is available
as expected when using the parser flag HTML_PARSE_NOBLANKS

Based on original patch from Igor Ignatyuk <igor_ignatiouk@hotmail.com>

* HTMLparser.c: change various places in the parser where ignorable_space
  SAX callback was called without checking for the parser flag preference
* xmllint.c: make sure we use the new flag even for HTML parsing
* result/HTML/*: this modifies the output of a number of tests
v2.9.0-rc2
2012-09-07 19:32:12 +08:00
Daniel Richard
878ec9db9d Second round of cleanups for LibXML2 docs/examples
configure.am:

* Explicitly disallow --enable-rebuild-docs when builddir != srcdir, per
   what you said about needing to build docs with an in-source build

doc/Makefile.am:

* Ensure that xmlversion.h is in the source tree before running
   apibuild.py, to avoid generating an incomplete libxml2-api.xml

* Update the .PHONY target (forgot to do this earlier)

doc/devhelp/Makefile.am:

* Wrap the doc-generating rule in an "if REBUILD_DOCS" conditional so it
   doesn't cause trouble for regular users

* Added a handy-dandy "rebuild" target

doc/examples/index.py:

* NOTE: You need to run this script to regenerate the files it creates,
   and then commit the newly-updated files! The generated files currently
   in git master (e.g. doc/examples/Makefile.am) are out of date even
   before this patch!

* index.html really needs to be in EXTRA_DIST

* Wrap the doc-generating rules in an "if REBUILD_DOCS" conditional,
   because they shouldn't be active otherwise
2012-09-07 14:52:17 +08:00
Daniel Veillard
47881284ae Add a forbidden variable error number and message to XPath
Related to https://bugzilla.gnome.org/show_bug.cgi?id=680938

When the XML_XPATH_NOVAR flags is being used it means that
variables are forbidden, not that they are missing
2012-09-07 14:24:50 +08:00
Michael Stahl
55b899a23a Support long path names on WNT
so we've got this patch to libxml2 2.7.6 in the LibreOffice code base,
inherited from OOo.  it fixes a definite problem, which is that Windows
has a rather low maximum path length restriction, and there is a special
trick on NT whereby path names can be prefixed with "\\?\", in which
case the maximum length is 32k, which ought to be sufficient even for
bloated office suites :)

I'll attach the patch to the xmlCanonicPath function.  note that i
didn't write this and am by no means an expert on either Microsoftean
platforms or libxml so maybe it's not the best way to do it.
2012-09-07 12:19:25 +08:00
Daniel Veillard
1bd45d1309 Change the XPath code to percolate allocation errors
looping 1000 time on an error stating that a nodeset has
grown out of control is useless, make sure we percolate
error up to the various loops and break when errors occurs
2012-09-05 15:35:19 +08:00
Daniel Veillard
7d4c529a33 Improve HTML escaping of attribute on output
Handle special cases of &{...} constructs as hinted in the spec
  http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1
and special values as comment <!-- ... --> used for server side includes
This is limited to attribute values in HTML content.
2012-09-05 12:11:43 +08:00
Daniel Veillard
857104cd49 Remove all .cvsignore as they are not used anymore
For https://bugzilla.gnome.org/show_bug.cgi?id=682985
suggested by Adrian Bunk <bunk@stusta.de>
2012-09-04 14:25:23 +08:00
Daniel Veillard
7a2215dbcd Fix reuse of xmlInitParser
While xmlCleanupParser() should not be used unless complete control
is insured over the programe making sure libxml2 is not in use anywhere
It should still be usable, and allow a sequence of
    xmlInitParser();
    xmlCleanupParser();
calls if needed, the problem is that the thread key wasn't reallocated
on subsequent xmlinitParser() calls leading to corruption of pthread
keys used by the program.

* threads.c: make sure xmlCleanupParser() reset the pthread_once()
             global variable driving thread key allocation.
2012-09-04 12:05:17 +08:00
Daniel Veillard
510e7583f4 Fix a Timsort function helper comment 2012-09-04 11:50:36 +08:00
Daniel Veillard
28f5e1a2d6 Fix potential crash on entities errors
Related to https://bugs.launchpad.net/lxml/+bug/502959

Basically the core of the issue is that if an entity references another
entity, then in case we are replacing entities content, we should always
do so by copying the referenced content as long as the reference is
done within the entity. Otherwise, if for some reason there is a later
parsing error that entity content may be freed.

Complex scenario exposed by command:
thinkpad:~/XML/diveintopython-5.4/xml -> valgrind --db-attach=yes
../../xmllint --loaddtd --noout --noent diveintopython.xml

  Document references &a;
  a references &b;
  we references b content directly in by linking in the a content
  a has an error further down
  we free a, freeing the chunk from b
  Document references &b; after &a;
  we try to copy b content, but it was freed already => segfault

* parser.c: never reference directly entity content without copying if
  we aren't in the document main entity
2012-09-04 11:18:39 +08:00
Christian Weisgerber
3b6d7b9aee xml2-config.1 markup error
There is a spurious ".l" in the xml2-config.1 man page.  This line can
simply be removed.

$ mandoc -Tlint -Werror xml2-config.1
xml2-config.1:12:2: ERROR: skipping unknown macro: .l
2012-08-28 23:40:56 +08:00
Arfrever Frehtes Taifersar Arahesis
1f01f49ba6 Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors
For https://bugzilla.gnome.org/show_bug.cgi?id=677606
For https://bugs.gentoo.org/show_bug.cgi?id=417539

If libxml2-2.8.0 is built with --with-icu --with-python on a system that has an
older version of libxml2 installed, then during "make install", libxml2mod.so
gets relinked to the systemwide version of libxml2.so.2 instead of libxml2.so.2
from the build tree, and fails at runtime if symbol versions from the older
libxml2.so.2 are not available. This effectively makes it impossible to build a
libxml2-2.8.0 binary package on a system that does not already have
libxml2-2.8.0 installed.

Investigation by Rafał Mużyło and Arfrever Frehtes Taifersar Arahesis revealed
the cause of the problem to be that libxml2's configure was adding ICU_LIBS to
LDFLAGS instead of to LIBADD. This resulted in GNU libtool using the wrong
argument order in its relinking command that gets run during "make install".
2012-08-28 22:16:50 +08:00
Akira TAGOH
961b535c10 Bug 676544 - fails to build with --without-sax1
Added some ifdef'd LIBXML_SAX1_ENABLED to make it buildable with
--without-sax1 configure option.
2012-08-28 22:03:16 +08:00
Rob Richards
236ea1ea90 fix builds not having stdint.h 2012-08-27 11:56:07 -04:00
Rob Richards
8f2d6b575a initialize var 2012-08-27 05:08:54 -04:00
Daniel Veillard
8880170e21 Fix the XPath arity check to also check the XPath stack limits
Example xmlXPathNormalizeFunction() would do CHECK_ARITY(1)
and the expect valuePop(ctxt); to return an object, except
now valuePop() looks at the XPath stack frames and fails returning
NULL, and we end up crashing dereferencing the object.
Real solution is to exten CHECK_ARITY() and recompile all
XPath functions using it.
2012-08-27 16:20:05 +08:00
Pietro Cerutti
890faa546b Fix problem with specific and generic error handlers
It seems that setting up both xmlTextReaderSetStructuredErrorHandler and
xmlSetStructuredErrorFunc confuses the code around error.c:592 and following
This patch works with any combinations of using xmlSetStructuredErrorFunc,
xmlTextReaderSetStructuredErrorHandler, both, or none.
2012-08-27 13:24:08 +08:00
Daniel Veillard
466fcdaa33 Avoid a potential infinite recursion
Which can happen when eliminating epsilon transitions, as reported
by Pavel Madr <pmadr@opentext.com>
2012-08-27 12:03:40 +08:00
Vojtech Fried
3e031b7dae Switching XPath node sorting to Timsort
I use libxml xpath engine on quite large (and mostly "flat") xml files.
It seems that Shellsort, that is used in xmlXPathNodeSetSort is a
performance bottleneck for my case. I have read some posts about sorting
in libxml in the libxml archive, but I agree that qsort was not the way
to go. I experimented with Timsort instead and my results were good for
me. For about 10000 nodes, my test was about 5x faster with Timsort,
for 1000 nodes about 10% faster, for small data files, the difference
was not measurable.
* timsort.h: the algorithm, kept in a separate header
* xpath.c: plug in the new algorithm in xmlXPathNodeSetSort
* Makefile.am: add the header to the EXTRA_DIST
* doc/apibuild.py: avoid indexing the new header
2012-08-24 16:52:44 +08:00
Daniel Veillard
73f94c602c Small cleanup for valgrind target 2012-08-24 16:38:54 +08:00
Nick Wellnhofer
622705398a Optimizing '//' in XPath expressions
When investigating the libxslt performance problem reported in bug
#657665, I found that '//' in XPath expressions can be very slow when
working on large subtrees.

One of the reasons is the seemingly quadratic time complexity of the
duplicate checks when merging result nodes. The other is a missed
optimization for expressions of the form
'descendant-or-self::node()/axis::test'. Since '//' is expanded to
'/descendant-or-self::node()/', this type of expression is quite common.
Depending on the axis of the expression following the
'descendant-or-self' step, the following replacements can be made:

from descendant-or-self::node()/child::test
to   descendant::test

from descendant-or-self::node()/descendant::test
to   descendant::test

from descendant-or-self::node()/self::test
to   descendant-or-self::test

from descendant-or-self::node()/descendant-or-self::test
to   descendant-or-self::test

'test' can be any kind of node test.

With these replacements the possibly huge result of
'descendant-or-self::node()' doesn't have to be stored temporarily, but
can be processsed in one pass. If the resulting nodeset is small, the
duplicate checks aren't a problem.

I found that there already is a function called
xmlXPathRewriteDOSExpression which performs this optimization for a very
limited set of cases. It employs a complicated iteration scheme for
rewritten expressions. AFAICS, this can be avoided by simply changing
the axis of the expression like described above.

With the attached patch against libxml2 and the files from bug #657665 I
got the following results.

Before:

$ time xsltproc/xsltproc --noout service-names-port-numbers.xsl
service-names-port-numbers.xml
real    2m56.213s
user    2m56.123s
sys     0m0.080s

After:

$ time xsltproc/xsltproc --noout service-names-port-numbers.xsl
service-names-port-numbers.xml
real    0m3.836s
user    0m3.764s
sys     0m0.060s

I also ran the libxml2 and libxslt test suites with the patch and
couldn't detect any breakage.

Nick

>From e0f5a8261760e4f257b90410be27657e984237c8 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 19 Aug 2012 18:20:22 +0200
Subject: [PATCH] Optimizations for descendant-or-self::node()

Currently, the function xmlXPathRewriteDOSExpression optimizes expressions
of type '//child'. Instead of adding a 'rewriteType' and doing a compound
traversal, the same can be achieved simply by setting the axis of the node
test from 'child' to 'descendant'.

There are also many other cases that can be optimized similarly. This
commit augments xmlXPathRewriteDOSExpression to essentially rewrite the
following subexpressions:

- descendant-or-self::node()/child:: to descendant::
- descendant-or-self::node()/descendant:: to descendant::
- descendant-or-self::node()/self:: to descendant-or-self::
- descendant-or-self::node()/descendant-or-self:: to descendant-or-self::

Since the '//' shortcut in XPath is translated to
'/descendant-or-self::node()/', this greatly speeds up expressions using
'//' on large subtrees.
2012-08-24 12:04:25 +08:00
Daniel Veillard
c70d185a2a Fix an XSD error when generating internal automata
When generating a sequence add an extra epsilon transition
to avoid further constructs from entering via the last state
Bug reported by Johan Corveleyn <jcorvel@gmail.com>
2012-08-23 23:28:04 +08:00
Daniel Veillard
82cdfc4eb3 Expose xmlBufShrink in the public tree API
As suggested by Andrew W. Nosenko:
Proposal: expose the new xmlBufShrink() to the "public" API for
compatibility with xmlBufUse().

Reason: the following scenario:

1. Read something into  xmlParserInputBuffer (e.g. using
xmlParserInputBufferRead())
2. Extract content through xmlBufContent()
3. Extract content length through xmlBufUse().  Result have type
'size_t'.
4. Use this content
5. Now, you need to shrink the buffer.  How to do it?  Doing that
through legacy xmlBufferShrink() is unsafe because it uses 'unsigned
int' and the whole point of introducing the new API was handling the
cases, when 'unsigned int' is not enough.  Therefore, need to use the
new xmlBufShrink().  But it is "private".

Therefore, I propose to expose the new xmlBufShrink() in the same way,
as xmlBufContent() and xmlBufUse() are exposed.
2012-08-22 11:05:09 +08:00
Daniel Veillard
ff7227f2c1 Patch for portability of latin characters in C files
Coming from LibreOffice repository:
http://cgit.freedesktop.org/libreoffice/core/plain/libxml2/libxml2-latin.patch
2012-08-20 20:58:24 +08:00