From 909e9211186296ed6f96bb3de7ff49fb12f92dd5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 10 Nov 2015 23:23:26 +0200 Subject: [PATCH] update php-systzdata.patch: r13: adapt for upstream changes to use PHP allocator fixes segfault on php shutdown: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7a12f0a in _efree () from /usr/lib64/libphp_common-7.0.0RC6.so (gdb) bt #0 0x00007ffff7a12f0a in _efree () from /usr/lib64/libphp_common-7.0.0RC6.so #1 0x00007ffff7946277 in timelib_tzinfo_dtor () from /usr/lib64/libphp_common-7.0.0RC6.so #2 0x00007ffff7a46606 in zend_hash_destroy () from /usr/lib64/libphp_common-7.0.0RC6.so #3 0x00007ffff791c68c in zm_deactivate_date () from /usr/lib64/libphp_common-7.0.0RC6.so #4 0x00007ffff7a3c154 in zend_deactivate_modules () from /usr/lib64/libphp_common-7.0.0RC6.so #5 0x00007ffff79d56c5 in php_request_shutdown () from /usr/lib64/libphp_common-7.0.0RC6.so #6 0x0000000000405879 in ?? () #7 0x0000000000404d81 in main () (gdb) patch updated from remi repo https://github.com/remicollet/remirepo/blob/master/php/php70/php-7.0.0-systzdata-v13.patch --- php-systzdata.patch | 47 +++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/php-systzdata.patch b/php-systzdata.patch index a33ef08..5efc47d 100644 --- a/php-systzdata.patch +++ b/php-systzdata.patch @@ -2,6 +2,7 @@ Add support for use of the system timezone database, rather than embedding a copy. Discussed upstream but was not desired. History: +r13: adapt for upstream changes to use PHP allocator r12: adapt for upstream changes for new zic r11: use canonical names to avoid more case sensitivity issues round lat/long from zone.tab towards zero per builtin db @@ -20,8 +21,9 @@ r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) r2: add filesystem trawl to set up name alias index r1: initial revision ---- php-7.0.0RC1/ext/date/lib/parse_tz.c~ 2015-08-27 12:06:04.000000000 +0300 -+++ php-7.0.0RC1/ext/date/lib/parse_tz.c 2015-08-27 12:08:08.706661229 +0300 +diff -up php-7.0.0RC1/ext/date/lib/parse_tz.c.systzdata php-7.0.0RC1/ext/date/lib/parse_tz.c +--- php-7.0.0RC1/ext/date/lib/parse_tz.c.systzdata 2015-08-18 23:39:24.000000000 +0200 ++++ php-7.0.0RC1/ext/date/lib/parse_tz.c 2015-08-22 07:54:38.097258458 +0200 @@ -20,6 +20,16 @@ #include "timelib.h" @@ -39,11 +41,12 @@ r1: initial revision #include #ifdef HAVE_LOCALE_H -@@ -43,7 +43,11 @@ +@@ -32,8 +42,12 @@ + #include #endif - #define TIMELIB_SUPPORTS_V2DATA +#ifndef HAVE_SYSTEM_TZDATA + #define TIMELIB_SUPPORTS_V2DATA #include "timezonedb.h" +#endif + @@ -51,7 +54,7 @@ r1: initial revision #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) # if defined(__LITTLE_ENDIAN__) -@@ -53,6 +68,10 @@ static int read_preamble(const unsigned +@@ -55,6 +69,11 @@ static int read_preamble(const unsigned { uint32_t version; @@ -59,10 +62,11 @@ r1: initial revision + *tzf += 20; + return 0; + } ++ /* read ID */ version = (*tzf)[3] - '0'; *tzf += 4; -@@ -296,7 +315,418 @@ void timelib_dump_tzinfo(timelib_tzinfo +@@ -298,7 +317,418 @@ void timelib_dump_tzinfo(timelib_tzinfo } } @@ -100,11 +104,11 @@ r1: initial revision + const unsigned char *p = (const unsigned char *)str; + uint32_t hash = 5381; + int c; -+ ++ + while ((c = tolower(*p++)) != '\0') { + hash = (hash << 5) ^ hash ^ c; + } -+ ++ + return hash % LOCINFO_HASH_SIZE; +} + @@ -432,9 +436,9 @@ r1: initial revision +{ + if (timezonedb_system) { + timelib_tzdb_index_entry *ent, lookup; -+ ++ + lookup.id = (char *)timezone; -+ ++ + ent = bsearch(&lookup, timezonedb_system->index, + timezonedb_system->index_size, sizeof lookup, + sysdbcmp); @@ -482,7 +486,7 @@ r1: initial revision { int left = 0, right = tzdb->index_size - 1; #ifdef HAVE_SETLOCALE -@@ -335,21 +765,87 @@ static int seek_to_tz_position(const uns +@@ -337,21 +767,88 @@ static int seek_to_tz_position(const uns return 0; } @@ -499,9 +503,9 @@ r1: initial revision + return 0; + } + -+ (*tzf) = (unsigned char *)orig ; ++ (*tzf) = (unsigned char *)orig; + *map = orig; -+ return 1; ++ return 1; + } + else +#endif @@ -567,11 +571,12 @@ r1: initial revision + return stat(fname, &st) == 0 && is_valid_tzfile(&st); + } +#endif ++ + return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); } static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) -@@ -374,24 +870,54 @@ static void read_64bit_header(const unsi +@@ -376,24 +873,54 @@ static void read_64bit_header(const unsi timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) { const unsigned char *tzf; @@ -605,8 +610,8 @@ r1: initial revision + * if possible. */ + + if ((li = find_zone_info(system_location_table, timezone)) != NULL) { -+ tmp->location.comments = strdup(li->comment); -+ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.comments = timelib_strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); + tmp->location.longitude = li->longitude; + tmp->location.latitude = li->latitude; + tmp->bc = 1; @@ -614,7 +619,7 @@ r1: initial revision + else { + strcpy(tmp->location.country_code, "??"); + tmp->bc = 0; -+ tmp->location.comments = strdup(""); ++ tmp->location.comments = timelib_strdup(""); + } + + /* Now done with the mmap segment - discard it. */ @@ -622,6 +627,7 @@ r1: initial revision + } else +#endif + { ++ /* PHP-style - use the embedded info. */ + if (version == 2) { + skip_64bit_preamble(&tzf, tmp); + read_64bit_header(&tzf, tmp); @@ -629,15 +635,14 @@ r1: initial revision + skip_64bit_types(&tzf, tmp); + skip_posix_string(&tzf, tmp); + } -+ /* PHP-style - use the embedded info. */ + read_location(&tzf, tmp); + } } else { tmp = NULL; } -diff -up php-5.6.9RC1/ext/date/lib/timelib.m4.systzdata php-5.6.9RC1/ext/date/lib/timelib.m4 ---- php-5.6.9RC1/ext/date/lib/timelib.m4.systzdata 2015-04-30 00:00:18.000000000 +0200 -+++ php-5.6.9RC1/ext/date/lib/timelib.m4 2015-04-30 06:32:08.549500385 +0200 +diff -up php-7.0.0RC1/ext/date/lib/timelib.m4.systzdata php-7.0.0RC1/ext/date/lib/timelib.m4 +--- php-7.0.0RC1/ext/date/lib/timelib.m4.systzdata 2015-08-18 23:39:24.000000000 +0200 ++++ php-7.0.0RC1/ext/date/lib/timelib.m4 2015-08-22 07:47:34.854055364 +0200 @@ -78,3 +78,17 @@ stdlib.h dnl Check for strtoll, atoll -- 2.44.0