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 1h7nk8-0001Le-Lq for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Mar 2019 20:59:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h7nk7-0000ma-Cr for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Mar 2019 20:59:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h7nk7-0000ld-5n for pgsql-hackers@lists.postgresql.org; Sat, 23 Mar 2019 20:59:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h7nk5-0001ry-1A for pgsql-hackers@postgresql.org; Sat, 23 Mar 2019 20:59:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x2NKx4N5012136; Sat, 23 Mar 2019 16:59:04 -0400 From: Tom Lane To: Chapman Flack cc: Ryan Lambert , pgsql-hackers@postgresql.org Subject: Re: Fix XML handling with DOCTYPE In-reply-to: <5C8FD4EE.7090107@anastigmatix.net> References: <5C8D5D16.7090206@anastigmatix.net> <23319.1552769738@sss.pgh.pa.us> <5C8D6681.4070504@anastigmatix.net> <24203.1552771272@sss.pgh.pa.us> <5C8D79AF.7010204@anastigmatix.net> <5146.1552837534@sss.pgh.pa.us> <5C8E7FC0.8040401@anastigmatix.net> <31664.1552842991@sss.pgh.pa.us> <5C8E8E2F.9050600@anastigmatix.net> <25228.1552849567@sss.pgh.pa.us> <5C8ECAA4.3090301@anastigmatix.net> <5C8FD4EE.7090107@anastigmatix.net> Comments: In-reply-to Chapman Flack message dated "Mon, 18 Mar 2019 13:27:10 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12134.1553374744.1@sss.pgh.pa.us> Date: Sat, 23 Mar 2019 16:59:04 -0400 Message-ID: <12135.1553374744@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Chapman Flack writes: > I decided, for a first point of reference, to wear the green eyeshade and > write a pre-check that exactly implements the applicable rules. That gives > a starting point for simplifications that are probably safe. > For example, a bunch of lines at the end have to do with verifying the > content inside of a processing-instruction, after finding where it ends. > We could reasonably decide that, for the purpose of skipping it, knowing > where it ends is enough, as libxml will parse it next and report any errors > anyway. Yeah, I did not like that code too much, particularly not all the magic Unicode-code-point numbers. I removed that, made some other changes to bring the patch more in line with PG coding style, and pushed it. > That made me just want to try it now, and--surprise!--the messages from > libxml are not the same. So maybe I would lean to keeping the green-eyeshade > rules in the test, if you can stomach them, but I would understand taking > them out. I doubt anyone will care too much about whether error messages for bad XML input are exactly like what they were before; and even if someone does, I doubt that these extra tests would be enough to ensure that the messages don't change. You're not really validating that the input is something that libxml would accept, unless its processing of XML PIs is far stupider than I would expect it to be. regards, tom lane