pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: Daniel Verite <daniel@manitou-mail.org>
Subject: Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values
Date: Wed, 9 Aug 2017 20:45:53 -0400
Message-ID: <b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.com> (raw)
In-Reply-To: <df438697-08b2-008c-eb55-4db730b76337@2ndquadrant.com>
References: <57860965-169f-461b-81f0-60d398894938@manitou-mail.org>
	<10186.1501989988@sss.pgh.pa.us>
	<9397.1502049651@sss.pgh.pa.us>
	<CAH2-Wz=YoR-u247-k--TRpsTffRydpPGKbp9z_HDtLGQi00uKA@mail.gmail.com>
	<11062.1502052420@sss.pgh.pa.us>
	<CAH2-WznihUrKBLWcb4KUA9Q4wWED54vdEmuAAwbLpGwH85xNAA@mail.gmail.com>
	<686574df-66c0-600f-6c62-3f2560ce92a3@2ndquadrant.com>
	<63891260-a3a4-65ba-57c7-fcf5b15b2082@2ndquadrant.com>
	<31926.1502126346@sss.pgh.pa.us>
	<1018.1502128299@sss.pgh.pa.us>
	<df438697-08b2-008c-eb55-4db730b76337@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 8/7/17 14:42, Peter Eisentraut wrote:
> On 8/7/17 13:51, Tom Lane wrote:
>> At this point I'm thinking that really what we ought to do is deprecate
>> using any pre-53 ICU release for Postgres.  It is very clear that those
>> versions are an entirely different beast from 53-and-up, and that they
>> are now abandonware so far as ICU upstream is concerned.
> 
> Maybe a note in the documentation to that effect would be useful.
> 
> I don't think we should prevent the use of older ICU versions in the
> code.  That would probably annoy people who are forced to develop or
> test their applications on older platforms.

I propose the attached patches for fixing the crash.  This just disables
the use of the problematic function for versions before ICU 53.

(The 0001 patch is just something I found that was needed while
experimenting with different ICU versions.  The 0002 patch is the real fix.)

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments: download all (2 files, .tar.gz)

0001-Fix-order-of-ICU_CFLAGS.patch (text/plain, 852B) download From 001292f212d3fd246733212770ae67576e3d1360 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Wed, 9 Aug 2017 20:28:49 -0400 Subject: [PATCH 1/2] Fix order of ICU_CFLAGS It must be before CPPFLAGS so that an ICU installation in a nonstandard path can take precedence over one in the system path. --- src/Makefile.global.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 0d3f8ca950..a26075c06e 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -232,7 +232,7 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -override CPPFLAGS := $(CPPFLAGS) $(ICU_CFLAGS) +override CPPFLAGS := $(ICU_CFLAGS) $(CPPFLAGS) ifdef PGXS override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS) -- 2.14.0
0002-Reject-use-of-ucol_strcollUTF8-before-ICU-53.patch (text/plain, 4.8K) download From c3f5ae91dccae7bb08f0519e2737f737856e384f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Wed, 9 Aug 2017 20:34:51 -0400 Subject: [PATCH 2/2] Reject use of ucol_strcollUTF8() before ICU 53 Various bugs can cause crashes, so don't use that function before ICU 53. It will fall back to the code path used for other encodings. Since we now tie the function availability to an ICU version, we don't need the configure test anymore. That also resolves the issue that the test result was previously hardcoded for Windows. researched by Daniel Verite <daniel@manitou-mail.org>, Peter Geoghegan <pg@bowt.ie>, Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org --- configure | 38 -------------------------------------- configure.in | 16 ---------------- src/include/pg_config.h.in | 3 --- src/include/pg_config.h.win32 | 3 --- src/include/utils/pg_locale.h | 13 +++++++++++++ 5 files changed, 13 insertions(+), 60 deletions(-) diff --git a/configure b/configure index 7218a31407..cc6471bba6 100755 --- a/configure +++ b/configure @@ -13923,44 +13923,6 @@ fi - # ucol_strcollUTF8() appeared in ICU 50, so check if we have it. - # ICU functions are macros, so we need to do this the long way. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucol_strcollUTF8" >&5 -$as_echo_n "checking for ucol_strcollUTF8... " >&6; } -if ${pgac_cv_func_ucol_strcollUTF8+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_LIBS=$LIBS -LIBS="$ICU_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <unicode/ucol.h> - -int -main () -{ -ucol_strcollUTF8(NULL, NULL, 0, NULL, 0, NULL); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pgac_cv_func_ucol_strcollUTF8=yes -else - pgac_cv_func_ucol_strcollUTF8=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_ucol_strcollUTF8" >&5 -$as_echo "$pgac_cv_func_ucol_strcollUTF8" >&6; } - if test "$pgac_cv_func_ucol_strcollUTF8" = yes ; then - -$as_echo "#define HAVE_UCOL_STRCOLLUTF8 1" >>confdefs.h - - fi - CPPFLAGS=$ac_save_CPPFLAGS fi diff --git a/configure.in b/configure.in index 44987cdc1e..5c036e7f42 100644 --- a/configure.in +++ b/configure.in @@ -1662,22 +1662,6 @@ if test "$with_icu" = yes; then AC_CHECK_HEADER(unicode/ucol.h, [], [AC_MSG_ERROR([header file <unicode/ucol.h> is required for ICU])]) - # ucol_strcollUTF8() appeared in ICU 50, so check if we have it. - # ICU functions are macros, so we need to do this the long way. - AC_CACHE_CHECK([for ucol_strcollUTF8], [pgac_cv_func_ucol_strcollUTF8], -[ac_save_LIBS=$LIBS -LIBS="$ICU_LIBS $LIBS" -AC_LINK_IFELSE([AC_LANG_PROGRAM( -[#include <unicode/ucol.h> -], -[ucol_strcollUTF8(NULL, NULL, 0, NULL, 0, NULL);])], -[pgac_cv_func_ucol_strcollUTF8=yes], -[pgac_cv_func_ucol_strcollUTF8=no]) -LIBS=$ac_save_LIBS]) - if test "$pgac_cv_func_ucol_strcollUTF8" = yes ; then - AC_DEFINE([HAVE_UCOL_STRCOLLUTF8], 1, [Define to 1 if you have the `ucol_strcollUTF8' function.]) - fi - CPPFLAGS=$ac_save_CPPFLAGS fi diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 7a05c7e5b8..dcb7a1a320 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -606,9 +606,6 @@ /* Define to 1 if you have the external array `tzname'. */ #undef HAVE_TZNAME -/* Define to 1 if you have the `ucol_strcollUTF8' function. */ -#undef HAVE_UCOL_STRCOLLUTF8 - /* Define to 1 if you have the <ucred.h> header file. */ #undef HAVE_UCRED_H diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 9d3021ced8..7f60670fa6 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -457,9 +457,6 @@ /* Define to 1 if you have the external array `tzname'. */ /* #undef HAVE_TZNAME */ -/* Define to 1 if you have the `ucol_strcollUTF8' function. */ -#define HAVE_UCOL_STRCOLLUTF8 1 - /* Define to 1 if the system has the type `uint64'. */ /* #undef HAVE_UINT64 */ diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index a02d27ba26..f3e04d4d8c 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -21,6 +21,19 @@ #include "utils/guc.h" +#ifdef USE_ICU +/* + * ucol_strcollUTF8() was introduced in ICU 50, but it is buggy before ICU 53. + * (see + * <https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org>) + */ +#if U_ICU_VERSION_MAJOR_NUM >= 53 +#define HAVE_UCOL_STRCOLLUTF8 1 +#else +#undef HAVE_UCOL_STRCOLLUTF8 +#endif +#endif + /* GUC settings */ extern char *locale_messages; -- 2.14.0

view thread (85+ messages)  latest in thread

Message-ID: <b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.com>
Permalink:  ../b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.com/
Also on:    postgresql.org/message-id/b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.com

 ·  · 

reply

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-bugs@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us, pg@bowt.ie, daniel@manitou-mail.org
  Subject: Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values
  In-Reply-To: <b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.com>
  References: <57860965-169f-461b-81f0-60d398894938@manitou-mail.org> <10186.1501989988@sss.pgh.pa.us> <9397.1502049651@sss.pgh.pa.us> <CAH2-Wz=YoR-u247-k--TRpsTffRydpPGKbp9z_HDtLGQi00uKA@mail.gmail.com> <11062.1502052420@sss.pgh.pa.us> <CAH2-WznihUrKBLWcb4KUA9Q4wWED54vdEmuAAwbLpGwH85xNAA@mail.gmail.com> <686574df-66c0-600f-6c62-3f2560ce92a3@2ndquadrant.com> <63891260-a3a4-65ba-57c7-fcf5b15b2082@2ndquadrant.com> <31926.1502126346@sss.pgh.pa.us> <1018.1502128299@sss.pgh.pa.us> <df438697-08b2-008c-eb55-4db730b76337@2ndquadrant.com> <b56e0c77-d4d6-82d8-caa2-0594bfa23c74@2ndquadrant.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