From: Alexander Korotkov <a.korotkov@postgrespro.ru>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Alexander Korotkov <akorotkov@postgresql.org>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Adjust string comparison in jsonpath
Date: Mon, 12 Aug 2019 06:32:19 +0300
Message-ID: <CAPpHfdvfDtXJtPojF+PrSBH4v1zRUJsMFLMH87oFY9L+Ti+H8Q@mail.gmail.com> (raw)
In-Reply-To: <CA+hUKGJ8N5nK7awwAECgJk84x6c50NHE9nD7v43UgjHTD1hFgQ@mail.gmail.com>
References: <E1hwuAz-0003Sr-SZ@gemulon.postgresql.org>
<0ed83a33-d900-466a-880a-70ef456c721f@2ndQuadrant.com>
<CA+hUKGK=CS2pb+QR8wpgKAVK3gSKD3c11=B75MQO3AJMLaOXtw@mail.gmail.com>
<CAPpHfdua_UnsKfYW129m=0_-1UdDkvDfX2yEM_=Q8C1sVfgr=g@mail.gmail.com>
<CA+hUKGJ8N5nK7awwAECgJk84x6c50NHE9nD7v43UgjHTD1hFgQ@mail.gmail.com>
пн, 12 авг. 2019 г., 3:25 Thomas Munro <thomas.munro@gmail.com>:
> On Mon, Aug 12, 2019 at 10:30 AM Alexander Korotkov
> <a.korotkov@postgrespro.ru> wrote:
> > > > This appears to have upset prion when testing on en_US.iso885915.
> > >
> > > Also lapwing's "InstallCheck-fr_FR" stage crashed on this commit, when
> > > running JSON queries, on HEAD and REL_12_STABLE:
>
> > Thank you for pointing! I hope I can investigate this shortly.
>
> Hi Alexander,
>
> I can reproduce this by running LANG="fr_FR.ISO8859-1" initdb, then
> running installcheck (on some other OSes that might be called just
> "fr_FR"). See this comment in mbutils.c:
>
> * The functions return a palloc'd, null-terminated string if conversion
> * is required. However, if no conversion is performed, the given source
> * string pointer is returned as-is.
>
> You call pfree() on the result of pg_server_to_any() without checking
> if it just returned in the input pointer (for example, it does that if
> you give it an empty string). That triggers an assertion failure
> somewhere inside pfree(). The following fixes that for me, and is
> based on code I found elsewhere in the tree.
>
> --- a/src/backend/utils/adt/jsonpath_exec.c
> +++ b/src/backend/utils/adt/jsonpath_exec.c
> @@ -2028,8 +2028,10 @@ compareStrings(const char *mbstr1, int mblen1,
> cmp = binaryCompareStrings(utf8str1, strlen(utf8str1),
>
> utf8str2, strlen(utf8str2));
>
> - pfree(utf8str1);
> - pfree(utf8str2);
> + if (mbstr1 != utf8str1)
> + pfree(utf8str1);
> + if (mbstr2 != utf8str2)
> + pfree(utf8str2);
>
> With that fixed it no longer crashes, but then the regression test
> fails due to differences in the output, which look like locale
> ordering differences.
>
Thank you for the diagnostics. Should be fixed by 251c8e39.
BTW, test failures appears to be caused not by locale differences, but by
using strlen() on non null-terminated original strings.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: a.korotkov@postgrespro.ru, thomas.munro@gmail.com, andrew.dunstan@2ndquadrant.com, akorotkov@postgresql.org
Subject: Re: pgsql: Adjust string comparison in jsonpath
In-Reply-To: <CAPpHfdvfDtXJtPojF+PrSBH4v1zRUJsMFLMH87oFY9L+Ti+H8Q@mail.gmail.com>
References: <E1hwuAz-0003Sr-SZ@gemulon.postgresql.org> <0ed83a33-d900-466a-880a-70ef456c721f@2ndQuadrant.com> <CA+hUKGK=CS2pb+QR8wpgKAVK3gSKD3c11=B75MQO3AJMLaOXtw@mail.gmail.com> <CAPpHfdua_UnsKfYW129m=0_-1UdDkvDfX2yEM_=Q8C1sVfgr=g@mail.gmail.com> <CA+hUKGJ8N5nK7awwAECgJk84x6c50NHE9nD7v43UgjHTD1hFgQ@mail.gmail.com> <CAPpHfdvfDtXJtPojF+PrSBH4v1zRUJsMFLMH87oFY9L+Ti+H8Q@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox