components/libxml2/patches/Bug737840.patch
changeset 5070 4a5c8cc70bd0
equal deleted inserted replaced
5069:a37b52a87a63 5070:4a5c8cc70bd0
       
     1 Patch origin: upstream
       
     2 Patch status: will be part of next version
       
     3 
       
     4 https://git.gnome.org/browse/libxml2/commit/?id=ef709ce2f7b792d5fb69ed142796d743fb1eb388
       
     5 
       
     6 From ef709ce2f7b792d5fb69ed142796d743fb1eb388 Mon Sep 17 00:00:00 2001
       
     7 From: Daniel Veillard <[email protected]>
       
     8 Date: Thu, 10 Sep 2015 19:41:41 +0800
       
     9 Subject: Fix the spurious ID already defined error
       
    10 
       
    11 For https://bugzilla.gnome.org/show_bug.cgi?id=737840
       
    12 the fix for 724903 introduced a regression on external entities carrying
       
    13 IDs, revert that patch in part and add a specific test to avoid readding it
       
    14 ---
       
    15  result/valid/737840.xml         | 10 ++++++++++
       
    16  result/valid/737840.xml.err     |  0
       
    17  result/valid/737840.xml.err.rdr |  0
       
    18  test/valid/737840.xml           | 10 ++++++++++
       
    19  test/valid/dtds/737840.ent      |  1 +
       
    20  valid.c                         |  6 ++++--
       
    21  6 files changed, 25 insertions(+), 2 deletions(-)
       
    22  create mode 100644 result/valid/737840.xml
       
    23  create mode 100644 result/valid/737840.xml.err
       
    24  create mode 100644 result/valid/737840.xml.err.rdr
       
    25  create mode 100644 test/valid/737840.xml
       
    26  create mode 100644 test/valid/dtds/737840.ent
       
    27 
       
    28 diff --git a/result/valid/737840.xml b/result/valid/737840.xml
       
    29 new file mode 100644
       
    30 index 0000000..433c6d6
       
    31 --- /dev/null
       
    32 +++ b/result/valid/737840.xml
       
    33 @@ -0,0 +1,10 @@
       
    34 +<?xml version="1.0"?>
       
    35 +<!DOCTYPE root [
       
    36 +<!ELEMENT root (elem)>
       
    37 +<!ELEMENT elem (#PCDATA)>
       
    38 +<!ATTLIST elem id ID #IMPLIED>
       
    39 +<!ENTITY target SYSTEM "dtds/737840.ent">
       
    40 +]>
       
    41 +<root>
       
    42 +  &target;
       
    43 +</root>
       
    44 diff --git a/result/valid/737840.xml.err b/result/valid/737840.xml.err
       
    45 new file mode 100644
       
    46 index 0000000..e69de29
       
    47 diff --git a/result/valid/737840.xml.err.rdr b/result/valid/737840.xml.err.rdr
       
    48 new file mode 100644
       
    49 index 0000000..e69de29
       
    50 diff --git a/test/valid/737840.xml b/test/valid/737840.xml
       
    51 new file mode 100644
       
    52 index 0000000..2d27b73
       
    53 --- /dev/null
       
    54 +++ b/test/valid/737840.xml
       
    55 @@ -0,0 +1,10 @@
       
    56 +<!DOCTYPE root [
       
    57 +<!ELEMENT root (elem)>
       
    58 +<!ELEMENT elem (#PCDATA)>
       
    59 +<!ATTLIST elem id ID #IMPLIED>
       
    60 +<!ENTITY target SYSTEM "dtds/737840.ent">
       
    61 +]>
       
    62 +
       
    63 +<root>
       
    64 +  &target;
       
    65 +</root>
       
    66 diff --git a/test/valid/dtds/737840.ent b/test/valid/dtds/737840.ent
       
    67 new file mode 100644
       
    68 index 0000000..e972132
       
    69 --- /dev/null
       
    70 +++ b/test/valid/dtds/737840.ent
       
    71 @@ -0,0 +1 @@
       
    72 +<elem id="id0"/>
       
    73 \ No newline at end of file
       
    74 diff --git a/valid.c b/valid.c
       
    75 index 409aa81..45a3f70 100644
       
    76 --- a/valid.c
       
    77 +++ b/valid.c
       
    78 @@ -2634,8 +2634,10 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
       
    79  	/*
       
    80  	 * The id is already defined in this DTD.
       
    81  	 */
       
    82 -	xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
       
    83 -			"ID %s already defined\n", value, NULL, NULL);
       
    84 +	if (ctxt != NULL) {
       
    85 +	    xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
       
    86 +			    "ID %s already defined\n", value, NULL, NULL);
       
    87 +	}
       
    88  #endif /* LIBXML_VALID_ENABLED */
       
    89  	xmlFreeID(ret);
       
    90  	return(NULL);
       
    91 -- 
       
    92 cgit v0.11.2
       
    93