Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2EUU-0004nu-WE for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2019 12:20:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2EUT-0007c8-Hv for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2019 12:20:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2EUT-0007bC-6X for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2019 12:20:41 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2EUL-0001hA-Uv for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2019 12:20:39 +0000 Received: by mail-qt1-x841.google.com with SMTP id p25so20924838qtb.3 for ; Fri, 08 Mar 2019 04:20:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=klPcp1XiQ/JjSc8Szvq+VdokVU+jD6KExsCvOem88l4=; b=n/NV7K8Mfj+OSPUDMqR5WPPaABvw5GH+uJeROTYq08w8TXu665ayBxreq+yP4sVQ3Q FYnn13HJOGOZsFz8BqESg683nJt6WrtBCX7XsGKLFQcwi7igpUfWgo620qLRqwp25JHa VdpfBOqFNXMUdn9sUBQAfqcH3xYYEk14RAvlxn3FZsJTiqpV0tIjgwpKL7t8GbQtI5yv ZbrbG1nvtQkuF4jK/14o/3viCAPB2zahplsK7SBo2AK2uTuNHS7Kva5Y1WaJOrca7BaF pNUYuLB5dvOfKo86gE50iEU8eJyk4sLW6IjtjuAJFRyQuYQTTp1XZTXi9YYwYGJUIkTQ hWaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=klPcp1XiQ/JjSc8Szvq+VdokVU+jD6KExsCvOem88l4=; b=HvELJOSzaBGC8TYEH942HpNu8oKld0kvimS+8JZB3x1bgAvwFOyUDyAOpbRwpdbmkh wNc/0n3wCLmT9OS+drZnUnllTCCtHUvGCGVInxv/tjvgoP7LbeoteS7sf35r8FEycq5y 9H9Vf2CKI0ccegNEQhF7mUkXP03w9hMMYw7Sth8y+HwESEVcO9+xU5iQPl5XDIrlotOy DxnBCl4ucQiQbD77ZyhkpHcPEOiEHUVW7M1XE+uVWGZjd1FEjWxE1K2i3A09ewh4Fke2 gcb8iIUiFQ14+/LXdFOcsZq/1p7jf39VdjcmKy6OrlvM5csKs2RRxASur8pVOMy3gAcz aRmA== X-Gm-Message-State: APjAAAUmyAtwPGRFMQ4J/Kjw73AI8cCHm0AQSgmuEquXPqU/W6iWD/Hl VIJ4qV9m1bGUEGeFbLPJh1+uQw== X-Google-Smtp-Source: APXvYqw7odF90Jxtr8x3SIYWZU5TMTu8USfMP1WK6i828Us7Ck+2E8qADF8H9Vq/JW5Wxdqmr31wFA== X-Received: by 2002:ac8:1789:: with SMTP id o9mr14710423qtj.234.1552047632882; Fri, 08 Mar 2019 04:20:32 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id g20sm1859026qtg.4.2019.03.08.04.20.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 04:20:32 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 1E3B41208DC; Fri, 8 Mar 2019 09:20:30 -0300 (-03) Date: Fri, 8 Mar 2019 09:20:30 -0300 From: Alvaro Herrera To: Pavel Stehule Cc: Chapman Flack , Markus Winand , PostgreSQL Hackers Subject: Re: PostgreSQL vs SQL/XML Standards Message-ID: <20190308122030.GA8440@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Mar-08, Pavel Stehule wrote: > looks like error in xmlXPathCompiledEval function, that produce little bit > broken result for XML_DOCUMENT_NODE type. I hadn't this problem with > libxml2 2.7.6 64bit, but I seen this issue on same version on 32bit. > > Currently I had not fresh 32 bit system to check it. > > I found a workaround - in this case copy (and release xmlNode) is not > necessary. > > please, apply attached patch. Wow :-( At this point I'm wondering if this should be put in back branches as well ... I mean, distill part of commit 251cf2e27bec that doesn't affect the behavior of text nodes, and put it on all branches together with your fix? Another thought: should we refuse to work on known-broken libxml2 versions? Seems like this bug could affect other parts of code too -- I see that xmlXPathCompiledEval() is called in file places (including two in contrib/xml2). Third thought: an alternative might be to create a wrapper for xmlXPathCompiledEval that detects NULL content and fills in a pointer that xmlFreeNode can free. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services