[php] fix buit-in web server on ppc64 (fdset usage) https://bugs.php.net/64128

Remi Collet remi at fedoraproject.org
Fri Feb 1 18:12:44 UTC 2013


commit 61028a22b2b813271ae64f9d7cc6ddc1f0d1d190
Author: Remi Collet <rcollet at redhat.com>
Date:   Fri Feb 1 19:12:36 2013 +0100

    fix buit-in web server on ppc64 (fdset usage) https://bugs.php.net/64128

 php-5.4.11-select.patch |   51 +++++++++++++++++++++++++++++++++++++++++++++++
 php.spec                |    9 +++++++-
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/php-5.4.11-select.patch b/php-5.4.11-select.patch
new file mode 100644
index 0000000..a78a287
--- /dev/null
+++ b/php-5.4.11-select.patch
@@ -0,0 +1,51 @@
+diff -up php-5.4.11/sapi/cli/php_cli_server.c.select php-5.4.11/sapi/cli/php_cli_server.c
+--- php-5.4.11/sapi/cli/php_cli_server.c.select	2013-01-16 02:10:30.000000000 -0500
++++ php-5.4.11/sapi/cli/php_cli_server.c	2013-02-01 12:12:04.650950760 -0500
+@@ -710,10 +710,9 @@ static void php_cli_server_poller_remove
+ 	if (fd == poller->max_fd) {
+ 		while (fd > 0) {
+ 			fd--;
+-			if (((unsigned int *)&poller->rfds)[fd / (8 * sizeof(unsigned int))] || ((unsigned int *)&poller->wfds)[fd / (8 * sizeof(unsigned int))]) {
++			if (PHP_SAFE_FD_ISSET(fd, &poller->rfds) || PHP_SAFE_FD_ISSET(fd, &poller->wfds)) { 
+ 				break;
+ 			}
+-			fd -= fd % (8 * sizeof(unsigned int));
+ 		}
+ 		poller->max_fd = fd;
+ 	}
+@@ -772,23 +771,20 @@ static int php_cli_server_poller_iter_on
+ 	}
+ 
+ #else
+-	php_socket_t fd = 0;
++	php_socket_t fd;
+ 	const php_socket_t max_fd = poller->max_fd;
+-	const unsigned int *pr = (unsigned int *)&poller->active.rfds,
+-	                   *pw = (unsigned int *)&poller->active.wfds,
+-	                   *e = pr + (max_fd + (8 * sizeof(unsigned int)) - 1) / (8 * sizeof(unsigned int));
+-	unsigned int mask;
+-	while (pr < e && fd <= max_fd) {
+-		for (mask = 1; mask; mask <<= 1, fd++) {
+-			int events = (*pr & mask ? POLLIN: 0) | (*pw & mask ? POLLOUT: 0);
+-			if (events) {
+-				if (SUCCESS != callback(opaque, fd, events)) {
+-					retval = FAILURE;
+-				}
+-			}
++
++	for (fd=0 ; fd<=max_fd ; fd++)  {
++		if (PHP_SAFE_FD_ISSET(fd, &poller->active.rfds)) {
++                if (SUCCESS != callback(opaque, fd, POLLIN)) {
++                    retval = FAILURE;
++                }   
++		}
++		if (PHP_SAFE_FD_ISSET(fd, &poller->active.wfds)) {
++                if (SUCCESS != callback(opaque, fd, POLLOUT)) {
++                    retval = FAILURE;
++                }   
+ 		}
+-		pr++;
+-		pw++;
+ 	}
+ #endif
+ 	return retval;
diff --git a/php.spec b/php.spec
index e073e3f..c23a5e1 100644
--- a/php.spec
+++ b/php.spec
@@ -58,7 +58,7 @@
 Summary: PHP scripting language for creating dynamic web sites
 Name: php
 Version: 5.4.12
-Release: 0.1.RC1%{?dist}
+Release: 0.2.RC1%{?dist}
 # All files licensed under PHP version 3.01, except
 # Zend is licensed under Zend
 # TSRM is licensed under BSD
@@ -86,6 +86,8 @@ Patch8: php-5.4.7-libdb.patch
 # Fixes for extension modules
 # https://bugs.php.net/63171 no odbc call during timeout
 Patch21: php-5.4.7-odbctimer.patch
+# https://bugs.php.net/64128 buit-in web server is broken on ppc64
+Patch22: php-5.4.11-select.patch
 
 # Functional changes
 Patch40: php-5.4.0-dlopen.patch
@@ -658,6 +660,7 @@ support for using the enchant library to PHP.
 %patch8 -p1 -b .libdb
 
 %patch21 -p1 -b .odbctimer
+%patch22 -p1 -b .select
 
 %patch40 -p1 -b .dlopen
 %patch41 -p1 -b .easter
@@ -1403,6 +1406,10 @@ fi
 
 
 %changelog
+* Fri Feb  1 2013 Remi Collet <rcollet at redhat.com> 5.4.12-0.2.RC1
+- fix buit-in web server on ppc64 (fdset usage)
+  https://bugs.php.net/64128
+
 * Thu Jan 31 2013 Remi Collet <rcollet at redhat.com> 5.4.12-0.1.RC1
 - update to 5.4.12RC1
 


More information about the scm-commits mailing list