[Pkg-php-commits] r1169 - in php5/trunk/debian: . patches

Sean Finney seanius at alioth.debian.org
Thu Nov 6 07:25:13 UTC 2008


Author: seanius
Date: 2008-11-06 07:25:13 +0000 (Thu, 06 Nov 2008)
New Revision: 1169

Modified:
   php5/trunk/debian/changelog
   php5/trunk/debian/patches/use_embedded_timezonedb.patch
Log:
updated system tzdata patch

Modified: php5/trunk/debian/changelog
===================================================================
--- php5/trunk/debian/changelog	2008-10-05 11:45:43 UTC (rev 1168)
+++ php5/trunk/debian/changelog	2008-11-06 07:25:13 UTC (rev 1169)
@@ -1,3 +1,10 @@
+php5 (5.2.6-6) UNRELEASED; urgency=low
+
+  * Not released yet.
+  * Updated system tzdata patch from Joe Orton.
+
+ -- Sean Finney <seanius at debian.org>  Thu, 06 Nov 2008 08:23:12 +0100
+
 php5 (5.2.6-5) unstable; urgency=high
 
   * Update debian/copyright to document that the DFSG-unfree email

Modified: php5/trunk/debian/patches/use_embedded_timezonedb.patch
===================================================================
--- php5/trunk/debian/patches/use_embedded_timezonedb.patch	2008-10-05 11:45:43 UTC (rev 1168)
+++ php5/trunk/debian/patches/use_embedded_timezonedb.patch	2008-11-06 07:25:13 UTC (rev 1169)
@@ -1,33 +1,15 @@
-use the system-provided timezonedb data instead of php's bundled data.
-patch by Joe Orton <jorton at redhat.com> Copyright © 2008 Red Hat, Inc.
-and may be used/redistributed/modified under the terms of the rest
-of the PHP source
-Index: php5-5.2.6/ext/date/lib/timelib.m4
-===================================================================
---- php5-5.2.6.orig/ext/date/lib/timelib.m4
-+++ php5-5.2.6/ext/date/lib/timelib.m4
-@@ -78,3 +78,17 @@ stdlib.h
- 
- dnl Check for strtoll, atoll
- AC_CHECK_FUNCS(strtoll atoll strftime)
-+
-+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
-+[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
-+no, no)
-+
-+if test "$PHP_SYSTEM_TZDATA" != "no"; then
-+   AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
-+
-+   if test "$PHP_SYSTEM_TZDATA" != "yes"; then
-+      AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
-+                         [Define for location of system timezone data])
-+   fi
-+fi
-+
-Index: php5-5.2.6/ext/date/lib/parse_tz.c
-===================================================================
---- php5-5.2.6.orig/ext/date/lib/parse_tz.c
-+++ php5-5.2.6/ext/date/lib/parse_tz.c
+
+Add support for use of the system timezone database, rather
+than embedding a copy.  Discussed upstream but was not desired.
+
+History:
+r4: added "System/Localtime" tzname which uses /etc/localtime
+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-5.2.6/ext/date/lib/parse_tz.c.systzdata
++++ php-5.2.6/ext/date/lib/parse_tz.c
 @@ -20,6 +20,16 @@
  
  #include "timelib.h"
@@ -56,7 +38,7 @@
  
  #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
  # if defined(__LITTLE_ENDIAN__)
-@@ -206,6 +219,195 @@ void timelib_dump_tzinfo(timelib_tzinfo 
+@@ -206,6 +219,211 @@ void timelib_dump_tzinfo(timelib_tzinfo 
  	}
  }
  
@@ -68,6 +50,8 @@
 +#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
 +#endif
 +
++#define SYSTEM_TZFILE "/etc/localtime"
++
 +static const timelib_tzdb *timezonedb_system = NULL;
 +
 +/* Filter out some non-tzdata files and the posix/right databases, if
@@ -90,7 +74,7 @@
 +	timelib_tzdb_index_entry *db_index;
 +	char **dirstack;
 +
-+	/* LIFO stack to hold directory entres to scan; each slot is a
++	/* LIFO stack to hold directory entries to scan; each slot is a
 +	 * directory name relative to the zoneinfo prefix. */
 +	dirstack_size = 32;
 +	dirstack = malloc(dirstack_size * sizeof *dirstack);
@@ -152,7 +136,7 @@
 +			free(ents[--count]);
 +		}
 +		
-+		free(ents);
++		if (count != -1) free(ents);
 +		free(top);
 +	} while (dirstack_top);
 +
@@ -167,17 +151,24 @@
 +static char *map_tzfile(const char *timezone, size_t *length)
 +{
 +	char fname[PATH_MAX];
++	const char *fn;
 +	struct stat st;
 +	char *p;
 +	int fd;
 +	
-+	if (strstr(timezone, "..") != NULL) {
-+		return NULL;
++	if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
++		fn = SYSTEM_TZFILE;
 +	}
-+
-+	snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++	else {
++		if (strstr(timezone, "..") != NULL) {
++			return NULL;
++		}
++	    
++		snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++		fn = fname;
++	}
 +	
-+	fd = open(fname, O_RDONLY);
++	fd = open(fn, O_RDONLY);
 +	if (fd == -1) {
 +		return NULL;
 +	} else if (fstat(fd, &st) != 0 || st.st_size < 21) {
@@ -215,14 +206,21 @@
 +int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
 +{
 +	char fname[PATH_MAX];
++	const char *fn;
 +
-+	if (strstr(timezone, "..") != NULL) {
-+		return 0;
++	if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
++		fn = SYSTEM_TZFILE;
 +	}
-+	
-+	snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++	else {
++		if (strstr(timezone, "..") != NULL) {
++			return 0;
++		}
++		
++		snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++		fn = fname;
++	}
 +
-+	return access(fname, R_OK) == 0 ? 1 : 0;
++	return access(fn, R_OK) == 0 ? 1 : 0;
 +}
 +
 +timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
@@ -252,7 +250,7 @@
  static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
  {
  	int left = 0, right = tzdb->index_size - 1;
-@@ -279,6 +481,7 @@ timelib_tzinfo *timelib_parse_tzfile(cha
+@@ -279,6 +497,7 @@ timelib_tzinfo *timelib_parse_tzfile(cha
  
  	return tmp;
  }
@@ -260,3 +258,50 @@
  
  static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
  {
+--- php-5.2.6/ext/date/lib/timelib.h.systzdata
++++ php-5.2.6/ext/date/lib/timelib.h
+@@ -31,6 +31,10 @@
+ 
+ #define TIMELIB_SPECIAL_WEEKDAY  0x01
+ 
++#ifdef HAVE_SYSTEM_TZDATA
++#define TIMELIB_SYSTEM_TZID "System/Localtime"
++#endif
++
+ #ifndef LONG_MAX
+ #define LONG_MAX 2147483647L
+ #endif
+--- php-5.2.6/ext/date/lib/timelib.m4.systzdata
++++ php-5.2.6/ext/date/lib/timelib.m4
+@@ -78,3 +78,17 @@ stdlib.h
+ 
+ dnl Check for strtoll, atoll
+ AC_CHECK_FUNCS(strtoll atoll strftime)
++
++PHP_ARG_WITH(system-tzdata, for use of system timezone data,
++[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
++no, no)
++
++if test "$PHP_SYSTEM_TZDATA" != "no"; then
++   AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
++
++   if test "$PHP_SYSTEM_TZDATA" != "yes"; then
++      AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
++                         [Define for location of system timezone data])
++   fi
++fi
++
+--- php-5.2.6/ext/date/php_date.c.systzdata
++++ php-5.2.6/ext/date/php_date.c
+@@ -584,6 +584,11 @@ static char* guess_timezone(const timeli
+ 	if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
+ 		return DATEG(default_timezone);
+ 	}
++#ifdef TIMELIB_SYSTEM_TZID
++	if (timelib_timezone_id_is_valid(TIMELIB_SYSTEM_TZID, tzdb)) {
++		return TIMELIB_SYSTEM_TZID;
++	}
++#endif
+ #if HAVE_TM_ZONE
+ 	/* Try to guess timezone from system information */
+ 	{




More information about the Pkg-php-commits mailing list