diff options
author | Remi Collet <fedora@famillecollet.com> | 2012-11-17 07:18:22 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2012-11-17 07:18:22 +0100 |
commit | 158ceac655218cac0bb8c87c328453862f315254 (patch) | |
tree | 1b56c0e879e2a7cddbdfd2c549962101835e627f | |
parent | 63b4c5113a0e771efc03a9edd08211723d5c6c59 (diff) |
mod_wsgi: backport
-rw-r--r-- | mod_wsgi-3.3-httpd24.patch | 203 | ||||
-rw-r--r-- | mod_wsgi-3.4-connsbh.patch | 16 | ||||
-rw-r--r-- | mod_wsgi-3.4-coredump.patch | 42 | ||||
-rw-r--r-- | mod_wsgi-3.4-procexit.patch | 23 | ||||
-rw-r--r-- | mod_wsgi.spec | 38 |
5 files changed, 112 insertions, 210 deletions
diff --git a/mod_wsgi-3.3-httpd24.patch b/mod_wsgi-3.3-httpd24.patch deleted file mode 100644 index f0f3a2f..0000000 --- a/mod_wsgi-3.3-httpd24.patch +++ /dev/null @@ -1,203 +0,0 @@ - -http://code.google.com/p/modwsgi/source/detail?r=8906fb52b6b23455320c848216f6120c979e57f5 -http://code.google.com/p/modwsgi/source/detail?r=25deb4b94536c96d63505b2a6d4dfb5be1b38195 - -diff -r 21f4dac5959a -r 8906fb52b6b2 mod_wsgi/mod_wsgi.c ---- mod_wsgi-3.3/mod_wsgi.c.httpd24 -+++ mod_wsgi-3.3/mod_wsgi.c -@@ -193,6 +193,9 @@ static PyTypeObject Auth_Type; - #endif - #if AP_MODULE_MAGIC_AT_LEAST(20060110,0) - #define MOD_WSGI_WITH_AUTHZ_PROVIDER 1 -+#if AP_MODULE_MAGIC_AT_LEAST(20100919,0) -+#define MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED 1 -+#endif - #endif - #endif - -@@ -5637,7 +5640,7 @@ static void wsgi_python_version(void) - } - } - --static apr_status_t wsgi_python_term() -+static apr_status_t wsgi_python_term(void) - { - PyInterpreterState *interp = NULL; - PyThreadState *tstate = NULL; -@@ -7851,6 +7854,7 @@ static const char *wsgi_set_auth_group_s - return NULL; - } - -+#if !defined(MOD_WSGI_WITH_AUTHN_PROVIDER) - static const char *wsgi_set_user_authoritative(cmd_parms *cmd, void *mconfig, - const char *f) - { -@@ -7866,6 +7870,7 @@ static const char *wsgi_set_user_authori - - return NULL; - } -+#endif - - static const char *wsgi_set_group_authoritative(cmd_parms *cmd, void *mconfig, - const char *f) -@@ -10092,6 +10097,17 @@ static void wsgi_process_socket(apr_pool - } - apr_sockaddr_ip_get(&c->local_ip, c->local_addr); - -+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) -+ if ((rv = apr_socket_addr_get(&c->client_addr, APR_REMOTE, sock)) -+ != APR_SUCCESS) { -+ ap_log_error(APLOG_MARK, APLOG_INFO, rv, wsgi_server, -+ "mod_wsgi (pid=%d): Failed call " -+ "apr_socket_addr_get(APR_REMOTE).", getpid()); -+ apr_socket_close(sock); -+ return; -+ } -+ apr_sockaddr_ip_get(&c->client_ip, c->client_addr); -+#else - if ((rv = apr_socket_addr_get(&c->remote_addr, APR_REMOTE, sock)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, WSGI_LOG_INFO(rv), wsgi_server, -@@ -10101,6 +10117,7 @@ static void wsgi_process_socket(apr_pool - return; - } - apr_sockaddr_ip_get(&c->remote_ip, c->remote_addr); -+#endif - - c->base_server = daemon->group->server; - -@@ -10183,7 +10200,7 @@ static apr_status_t wsgi_worker_acquire( - } - } - --static apr_status_t wsgi_worker_release() -+static apr_status_t wsgi_worker_release(void) - { - WSGIThreadStack *stack = wsgi_worker_stack; - -@@ -10232,7 +10249,7 @@ static apr_status_t wsgi_worker_release( - } - } - --static apr_status_t wsgi_worker_shutdown() -+static apr_status_t wsgi_worker_shutdown(void) - { - int i; - apr_status_t rv; -@@ -11008,8 +11025,9 @@ static int wsgi_start_process(apr_pool_t - * shared memory segments or memory mapped files not - * available to code in daemon processes. - */ -- -+#if !AP_MODULE_MAGIC_AT_LEAST(20071023, 0) - ap_cleanup_scoreboard(0); -+#endif - - /* - * Wipe out random value used in magic token so that not -@@ -12739,8 +12757,13 @@ static int wsgi_hook_daemon_handler(conn - * file for the host. - */ - -+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) -+ r->connection->client_ip = (char *)apr_table_get(r->subprocess_env, -+ "REMOTE_ADDR"); -+#else - r->connection->remote_ip = (char *)apr_table_get(r->subprocess_env, - "REMOTE_ADDR"); -+#endif - - key = apr_psprintf(p, "%s|%s", - apr_table_get(r->subprocess_env, -@@ -13259,6 +13282,18 @@ static PyObject *Auth_environ(AuthObject - Py_DECREF(object); - } - -+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) -+ if (r->useragent_ip) { -+ value = r->useragent_ip; -+#if PY_MAJOR_VERSION >= 3 -+ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL); -+#else -+ object = PyString_FromString(value); -+#endif -+ PyDict_SetItemString(vars, "REMOTE_ADDR", object); -+ Py_DECREF(object); -+ } -+#else - if (c->remote_ip) { - value = c->remote_ip; - #if PY_MAJOR_VERSION >= 3 -@@ -13269,6 +13304,7 @@ static PyObject *Auth_environ(AuthObject - PyDict_SetItemString(vars, "REMOTE_ADDR", object); - Py_DECREF(object); - } -+#endif - - #if PY_MAJOR_VERSION >= 3 - value = ap_document_root(r); -@@ -13292,6 +13328,17 @@ static PyObject *Auth_environ(AuthObject - Py_DECREF(object); - } - -+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) -+ rport = c->client_addr->port; -+ value = apr_itoa(r->pool, rport); -+#if PY_MAJOR_VERSION >= 3 -+ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL); -+#else -+ object = PyString_FromString(value); -+#endif -+ PyDict_SetItemString(vars, "REMOTE_PORT", object); -+ Py_DECREF(object); -+#else - rport = c->remote_addr->port; - value = apr_itoa(r->pool, rport); - #if PY_MAJOR_VERSION >= 3 -@@ -13301,6 +13348,7 @@ static PyObject *Auth_environ(AuthObject - #endif - PyDict_SetItemString(vars, "REMOTE_PORT", object); - Py_DECREF(object); -+#endif - - value = r->protocol; - #if PY_MAJOR_VERSION >= 3 -@@ -14391,8 +14439,13 @@ static int wsgi_hook_access_checker(requ - host = ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_HOST, NULL); - -+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) -+ if (!host) -+ host = r->useragent_ip; -+#else - if (!host) - host = r->connection->remote_ip; -+#endif - - allow = wsgi_allow_access(r, config, host); - -@@ -14645,8 +14698,14 @@ static int wsgi_hook_check_user_id(reque - - #if defined(MOD_WSGI_WITH_AUTHZ_PROVIDER) - -+#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED -+static authz_status wsgi_check_authorization(request_rec *r, -+ const char *require_args, -+ const void *parsed_require_line) -+#else - static authz_status wsgi_check_authorization(request_rec *r, - const char *require_args) -+#endif - { - WSGIRequestConfig *config; - -@@ -14695,6 +14754,9 @@ static authz_status wsgi_check_authoriza - static const authz_provider wsgi_authz_provider = - { - &wsgi_check_authorization, -+#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED -+ NULL, -+#endif - }; - - #else diff --git a/mod_wsgi-3.4-connsbh.patch b/mod_wsgi-3.4-connsbh.patch new file mode 100644 index 0000000..a7c5925 --- /dev/null +++ b/mod_wsgi-3.4-connsbh.patch @@ -0,0 +1,16 @@ +--- mod_wsgi-3.4/mod_wsgi.c.connsbh ++++ mod_wsgi-3.4/mod_wsgi.c +@@ -10600,7 +10600,13 @@ static void wsgi_process_socket(apr_pool + * will add their own input/output filters to the chain. + */ + ++#if AP_MODULE_MAGIC_AT_LEAST(20110619,0) ++ /* For 2.4 a NULL sbh pointer should work. */ ++ sbh = NULL; ++#else ++ /* For 2.2 a dummy sbh pointer is needed. */ + ap_create_sb_handle(&sbh, p, -1, 0); ++#endif + + c = (conn_rec *)apr_pcalloc(p, sizeof(conn_rec)); + diff --git a/mod_wsgi-3.4-coredump.patch b/mod_wsgi-3.4-coredump.patch new file mode 100644 index 0000000..58b67e4 --- /dev/null +++ b/mod_wsgi-3.4-coredump.patch @@ -0,0 +1,42 @@ +--- mod_wsgi-3.4/configure.ac.dumpcore ++++ mod_wsgi-3.4/configure.ac +@@ -39,6 +39,8 @@ fi + + AC_SUBST(APXS) + ++AC_CHECK_FUNCS(prctl) ++ + AC_MSG_CHECKING(Apache version) + HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`" + HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`" +--- mod_wsgi-3.4/mod_wsgi.c.coredump ++++ mod_wsgi-3.4/mod_wsgi.c +@@ -139,6 +139,10 @@ typedef regmatch_t ap_regmatch_t; + #include <pwd.h> + #endif + ++#ifdef HAVE_SYS_PRCTL_H ++#include <sys/prctl.h> ++#endif ++ + #include "Python.h" + + #if !defined(PY_VERSION_HEX) +@@ -10485,6 +10489,17 @@ static void wsgi_setup_access(WSGIDaemon + "mod_wsgi (pid=%d): Unable to change to uid=%ld.", + getpid(), (long)daemon->group->uid); + } ++ ++#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) ++ /* this applies to Linux 2.4+ */ ++ if (ap_coredumpdir_configured) { ++ if (prctl(PR_SET_DUMPABLE, 1)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_ALERT(errno), wsgi_server, ++ "mod_wsgi (pid=%d): set dumpable failed - this child will not coredump" ++ " after software errors", getpid()); ++ } ++ } ++#endif + } + + static int wsgi_setup_socket(WSGIProcessGroup *process) diff --git a/mod_wsgi-3.4-procexit.patch b/mod_wsgi-3.4-procexit.patch new file mode 100644 index 0000000..fc23c96 --- /dev/null +++ b/mod_wsgi-3.4-procexit.patch @@ -0,0 +1,23 @@ +--- mod_wsgi-3.3/mod_wsgi.c.procexit ++++ mod_wsgi-3.3/mod_wsgi.c +@@ -9845,6 +9845,20 @@ static void wsgi_manage_process(int reas + wsgi_server, "mod_wsgi (pid=%d): " + "Process '%s' has died, restarting.", + daemon->process.pid, daemon->group->name); ++ if (WIFEXITED(status)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), ++ wsgi_server, "mod_wsgi (pid=%d): " ++ "Process '%s' terminated normally, exit code %d", ++ daemon->process.pid, daemon->group->name, ++ WEXITSTATUS(status)); ++ } ++ else if (WIFSIGNALED(status)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), ++ wsgi_server, "mod_wsgi (pid=%d): " ++ "Process '%s' terminated by signal %d", ++ daemon->process.pid, daemon->group->name, ++ WTERMSIG(status)); ++ } + + wsgi_start_process(wsgi_parent_pool, daemon); + } diff --git a/mod_wsgi.spec b/mod_wsgi.spec index 6c217df..486bfe4 100644 --- a/mod_wsgi.spec +++ b/mod_wsgi.spec @@ -5,8 +5,8 @@ %{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} Name: mod_wsgi -Version: 3.3 -Release: 6%{?dist} +Version: 3.4 +Release: 4%{?dist} Summary: A WSGI interface for Python web applications in Apache Group: System Environment/Libraries @@ -14,11 +14,12 @@ License: ASL 2.0 URL: http://modwsgi.org Source0: http://modwsgi.googlecode.com/files/%{name}-%{version}.tar.gz Source1: wsgi.conf -Patch0: mod_wsgi-3.3-httpd24.patch +Patch0: mod_wsgi-3.4-connsbh.patch +Patch1: mod_wsgi-3.4-procexit.patch +Patch2: mod_wsgi-3.4-coredump.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: httpd-devel -BuildRequires: python-devel +BuildRequires: httpd-devel, python-devel, autoconf Requires: httpd-mmn = %{_httpd_mmn} %description @@ -31,11 +32,15 @@ existing WSGI adapters for mod_python or CGI. %prep %setup -q -%patch0 -p1 -b .httpd24 +%patch0 -p1 -b .connsbh +%patch1 -p1 -b .procexit +%patch2 -p1 -b .coredump %build +autoconf +export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}" %configure --enable-shared --with-apxs=%{_httpd_apxs} -make LDFLAGS="-L%{_libdir}" %{?_smp_mflags} +make %{?_smp_mflags} %install @@ -62,6 +67,25 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Nov 17 2012 Remi Collet <RPMS@FamilleCollet.com> - 3.4-4 +- sync with rawhide, rebuild for remi repo + +* Wed Oct 17 2012 Joe Orton <jorton@redhat.com> - 3.4-4 +- enable PR_SET_DUMPABLE in daemon process to enable core dumps + +* Wed Oct 17 2012 Joe Orton <jorton@redhat.com> - 3.4-3 +- use a NULL c->sbh pointer with httpd 2.4 (possible fix for #867276) +- add logging for unexpected daemon process loss + +* Wed Oct 17 2012 Matthias Runge <mrunge@redhat.com> - 3.4-2 +- also use RPM_LD_FLAGS for build bz. #867137 + +* Mon Oct 15 2012 Matthias Runge <mrunge@redhat.com> - 3.4-1 +- update to upstream release 3.4 + +* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Wed Jun 13 2012 Remi Collet <RPMS@FamilleCollet.com> - 3.3-6 - sync with rawhide, rebuild for remi repo |