Hello community,

here is the log from the commit of package uwsgi for openSUSE:Factory checked 
in at 2016-05-23 16:39:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/uwsgi (Old)
 and      /work/SRC/openSUSE:Factory/.uwsgi.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "uwsgi"

Changes:
--------
--- /work/SRC/openSUSE:Factory/uwsgi/uwsgi.changes      2016-02-17 
12:25:58.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.uwsgi.new/uwsgi.changes 2016-05-23 
16:39:09.000000000 +0200
@@ -1,0 +2,21 @@
+Thu May 12 04:43:00 UTC 2016 - [email protected]
+
+- Update to 2.0.13:
+  *  Fix compilation with GCC 6
+  *  Remote rpc fixes (Darvame)
+  *  Musl support! (Natanael Copa, Matt Dainty, Riccardo Magliocchetti)
+  *  Create the spooler directory if it does not exist (Alexandre Bonnetain)
+  *  Fix compilation on big endian linux (Riccardo Magliocchetti)
+  *  A ton of cache fixes (Darvame)
+  *  Make it easier to compile plugins on a different directory (Jakub
+     Jirutka)
+  *  Add wheel package machinery (Matt Robenolt)
+  *  Use EPOLLEXCLUSIVE for reading, helps with the thundering herd problem
+     (on linux 4.5+) (INADA Naoki)
+  *  Fix apache 2.4 integration with unix sockets (Alexandre Rossi)
+  *  Add HTTP/2 support to apache 2 proxy (Michael Fladischer, OGAWA Hirofumi)
+  *  Fix apache mod proxy compilation with apache 2.4.20 (Mathieu Arnold)
+  *  Default to clang as default compiler on MacOS X (Riccardo Magliocchetti)
+  *  Added --cgi-close-stdin-on-eof (Roberto De Ioris)
+
+-------------------------------------------------------------------

Old:
----
  uwsgi-2.0.12.tar.gz

New:
----
  uwsgi-2.0.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ uwsgi.spec ++++++
--- /var/tmp/diff_new_pack.hJpCc8/_old  2016-05-23 16:39:10.000000000 +0200
+++ /var/tmp/diff_new_pack.hJpCc8/_new  2016-05-23 16:39:10.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           uwsgi
-Version:        2.0.12
+Version:        2.0.13
 Release:        0
 Summary:        Application Container Server for Networked/Clustered Web 
Applications
 License:        GPL-2.0-with-GCC-exception

++++++ uwsgi-1.9.17-plugin_build_path.patch ++++++
--- /var/tmp/diff_new_pack.hJpCc8/_old  2016-05-23 16:39:10.000000000 +0200
+++ /var/tmp/diff_new_pack.hJpCc8/_new  2016-05-23 16:39:10.000000000 +0200
@@ -1,11 +1,13 @@
---- a/uwsgiconfig.py
-+++ b/uwsgiconfig.py
-@@ -1192,10 +1192,7 @@ def build_plugin(path, uc, cflags, ldfla
+Index: uwsgi-2.0.13/uwsgiconfig.py
+===================================================================
+--- uwsgi-2.0.13.orig/uwsgiconfig.py
++++ uwsgi-2.0.13/uwsgiconfig.py
+@@ -1420,10 +1420,7 @@ def build_plugin(path, uc, cflags, ldfla
      except:
          pass
  
 -    if uc:
--        plugin_dest = uc.get('plugin_dir') + '/' + name + '_plugin'
+-        plugin_dest = uc.get('plugin_build_dir', uc.get('plugin_dir')) + '/' 
+ name + '_plugin'
 -    else:
 -        plugin_dest = name + '_plugin'
 +    plugin_dest = name + '_plugin'

++++++ uwsgi-2.0.12-no-LD_RUN_PATH.patch ++++++
--- /var/tmp/diff_new_pack.hJpCc8/_old  2016-05-23 16:39:10.000000000 +0200
+++ /var/tmp/diff_new_pack.hJpCc8/_new  2016-05-23 16:39:10.000000000 +0200
@@ -1,5 +1,7 @@
---- a/plugins/jvm/uwsgiplugin.py       2015-12-30 10:08:49.000000000 +0100
-+++ b/plugins/jvm/uwsgiplugin.py       2016-01-07 14:35:31.212291749 +0100
+Index: uwsgi-2.0.13/plugins/jvm/uwsgiplugin.py
+===================================================================
+--- uwsgi-2.0.13.orig/plugins/jvm/uwsgiplugin.py
++++ uwsgi-2.0.13/plugins/jvm/uwsgiplugin.py
 @@ -65,11 +65,6 @@ if "-framework JavaVM" in JVM_LIBPATH:
  
  GCC_LIST = ['jvm_plugin']
@@ -12,8 +14,10 @@
  def post_build(config):
      if os.system("javac %s/plugins/jvm/uwsgi.java" % os.getcwd()) != 0:
          os._exit(1)
---- a/plugins/php/uwsgiplugin.py       2015-12-30 10:08:49.000000000 +0100
-+++ b/plugins/php/uwsgiplugin.py       2016-01-07 14:36:47.403974902 +0100
+Index: uwsgi-2.0.13/plugins/php/uwsgiplugin.py
+===================================================================
+--- uwsgi-2.0.13.orig/plugins/php/uwsgiplugin.py
++++ uwsgi-2.0.13/plugins/php/uwsgiplugin.py
 @@ -19,7 +19,6 @@ LDFLAGS = os.popen(PHPPATH + ' --ldflags
  
  if ld_run_path:
@@ -22,19 +26,23 @@
  
  LIBS = [os.popen(PHPPATH + ' --libs').read().rstrip(), '-lphp' + php_version]
  
---- a/plugins/python/uwsgiplugin.py    2015-12-30 10:08:49.000000000 +0100
-+++ b/plugins/python/uwsgiplugin.py    2016-01-07 14:39:06.071398672 +0100
+Index: uwsgi-2.0.13/plugins/python/uwsgiplugin.py
+===================================================================
+--- uwsgi-2.0.13.orig/plugins/python/uwsgiplugin.py
++++ uwsgi-2.0.13/plugins/python/uwsgiplugin.py
 @@ -58,8 +58,6 @@ if not 'UWSGI_PYTHON_NOLIB' in os.enviro
          LDFLAGS.append("-L%s" % libdir)
-         LDFLAGS.append("-Wl,-rpath=%s" % libdir)
+         LDFLAGS.append("-Wl,-rpath,%s" % libdir)
  
 -        os.environ['LD_RUN_PATH'] = "%s" % libdir
 -
          LIBS.append('-lpython%s' % get_python_version())
  else:
      LIBS = []
---- a/plugins/rack/uwsgiplugin.py      2015-12-30 10:08:49.000000000 +0100
-+++ b/plugins/rack/uwsgiplugin.py      2016-01-07 14:40:18.623097398 +0100
+Index: uwsgi-2.0.13/plugins/rack/uwsgiplugin.py
+===================================================================
+--- uwsgi-2.0.13.orig/plugins/rack/uwsgiplugin.py
++++ uwsgi-2.0.13/plugins/rack/uwsgiplugin.py
 @@ -46,7 +46,6 @@ LIBS = os.popen(RUBYPATH + " -e \"requir
  
  if has_shared == 'yes':
@@ -43,8 +51,10 @@
      LIBS.append(os.popen(RUBYPATH + " -e \"require 'rbconfig';print '-l' + 
%s::CONFIG['RUBY_SO_NAME']\"" % rbconfig).read().rstrip())
  else:
      rubylibdir = os.popen(RUBYPATH + " -e \"require 'rbconfig';print 
RbConfig::CONFIG['rubylibdir']\"").read().rstrip()
---- a/plugins/ruby19/uwsgiplugin.py    2015-12-30 10:08:49.000000000 +0100
-+++ b/plugins/ruby19/uwsgiplugin.py    2016-01-07 14:40:51.614960446 +0100
+Index: uwsgi-2.0.13/plugins/ruby19/uwsgiplugin.py
+===================================================================
+--- uwsgi-2.0.13.orig/plugins/ruby19/uwsgiplugin.py
++++ uwsgi-2.0.13/plugins/ruby19/uwsgiplugin.py
 @@ -40,6 +40,5 @@ LDFLAGS = os.popen(RUBYPATH + " -e \"req
  
  libpath = os.popen(RUBYPATH + " -e \"require 'rbconfig';print 
%s::CONFIG['libdir']\"" % rbconfig).read().rstrip()

++++++ uwsgi-2.0.12.tar.gz -> uwsgi-2.0.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/apache2/mod_proxy_uwsgi.c 
new/uwsgi-2.0.13/apache2/mod_proxy_uwsgi.c
--- old/uwsgi-2.0.12/apache2/mod_proxy_uwsgi.c  2015-12-30 10:08:49.000000000 
+0100
+++ new/uwsgi-2.0.13/apache2/mod_proxy_uwsgi.c  2016-05-10 11:17:48.000000000 
+0200
@@ -67,20 +67,18 @@
     }
     url += sizeof(UWSGI_SCHEME); /* Keep slashes */
 
-    // is it a unix socket ?
-    if (strlen(url) == 2) {
-       *sport = 0;
-    }
-    else {
-        err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
-        if (err) {
-            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "error parsing URL %s: %s", url, err);
-            return HTTP_BAD_REQUEST;
-        }
-       apr_snprintf(sport, sizeof(sport), ":%u", port);
+    err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
+    if (err) {
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                    "error parsing URL %s: %s", url, err);
+        return HTTP_BAD_REQUEST;
     }
 
+    if (port != UWSGI_DEFAULT_PORT)
+        apr_snprintf(sport, sizeof(sport), ":%u", port);
+    else
+        sport[0] = '\0';
+
     if (ap_strchr(host, ':')) { /* if literal IPv6 address */
         host = apr_pstrcat(r->pool, "[", host, "]", NULL);
     }
@@ -259,7 +257,7 @@
     return rp;
 }
 
-static apr_status_t ap_proxy_buckets_lifetime_transform(request_rec *r,
+apr_status_t ap_proxy_buckets_lifetime_transform(request_rec *r,
         apr_bucket_brigade *from, apr_bucket_brigade *to)
 {
     apr_bucket *e;
@@ -328,42 +326,52 @@
 
        backend->worker->s->read += len;
 
-       if (!apr_date_checkmask(buffer, "HTTP/#.# ###*") || len >= 
sizeof(buffer)-1) {
+       if (len >= sizeof(buffer)-1) {
                // oops
                return HTTP_INTERNAL_SERVER_ERROR;
        }
+       /* Position of http status code */
+       int status_start;
+       if (apr_date_checkmask(buffer, "HTTP/#.# ###*")) {
+               status_start = 9;
+       } else if (apr_date_checkmask(buffer, "HTTP/# ###*")) {
+               status_start = 7;
+       } else {
+               // oops
+               return HTTP_INTERNAL_SERVER_ERROR;
+       }
+       int status_end = status_start + 3;
 
-        char keepchar = buffer[12];
-        buffer[12] = '\0';
-        r->status = atoi(&buffer[9]);
-
-        if (keepchar != '\0') {
-                buffer[12] = keepchar;
-        } else {
-                /* 2616 requires the space in Status-Line; the origin
-                 * server may have sent one but ap_rgetline_core will
-                 * have stripped it. */
-                buffer[12] = ' ';
-                buffer[13] = '\0';
-            }
-        r->status_line = apr_pstrdup(r->pool, &buffer[9]);
-
-               // start parsing headers;
-               while ((len = ap_getline(buffer, sizeof(buffer), rp, 1)) > 0) {
-                       value = strchr(buffer, ':');
-                       // invalid header skip
-                       if (!value) continue;
-                       *value = '\0';
-                       ++value;
-                       while (apr_isspace(*value)) ++value; 
-                       for (end = &value[strlen(value)-1]; end > value && 
apr_isspace(*end); --end) *end = '\0';
-                       apr_table_add(r->headers_out, buffer, value);
-               }
+       char keepchar = buffer[status_end];
+       buffer[status_end] = '\0';
+       r->status = atoi(&buffer[status_start]);
+
+       if (keepchar != '\0') {
+               buffer[status_end] = keepchar;
+       } else {
+               /* 2616 requires the space in Status-Line; the origin
+               * server may have sent one but ap_rgetline_core will
+               * have stripped it. */
+               buffer[status_end] = ' ';
+               buffer[status_end+1] = '\0';
+       }
+       r->status_line = apr_pstrdup(r->pool, &buffer[status_start]);
 
+       // start parsing headers;
+       while ((len = ap_getline(buffer, sizeof(buffer), rp, 1)) > 0) {
+               value = strchr(buffer, ':');
+               // invalid header skip
+               if (!value) continue;
+               *value = '\0';
+               ++value;
+               while (apr_isspace(*value)) ++value; 
+               for (end = &value[strlen(value)-1]; end > value && 
apr_isspace(*end); --end) *end = '\0';
+               apr_table_add(r->headers_out, buffer, value);
+       }
 
        if ((buf = apr_table_get(r->headers_out, "Content-Type"))) {
-                ap_set_content_type(r, apr_pstrdup(r->pool, buf));
-            }
+               ap_set_content_type(r, apr_pstrdup(r->pool, buf));
+       }
        
        int finish = 0;
        while(!finish) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/async.c 
new/uwsgi-2.0.13/core/async.c
--- old/uwsgi-2.0.12/core/async.c       2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/async.c       2016-05-10 11:17:48.000000000 +0200
@@ -549,6 +549,8 @@
                                        else if (proto_parser_status < 0) {
                                                
uwsgi.async_proto_fd_table[interesting_fd] = NULL;
                                                close(interesting_fd);
+                                               uwsgi.async_queue_unused_ptr++;
+                                               
uwsgi.async_queue_unused[uwsgi.async_queue_unused_ptr] = uwsgi.wsgi_req;
                                                continue;
                                        }
                                        // re-add timer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/cache.c 
new/uwsgi-2.0.13/core/cache.c
--- old/uwsgi-2.0.12/core/cache.c       2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/cache.c       2016-05-10 11:17:48.000000000 +0200
@@ -26,7 +26,7 @@
 
 static void cache_full(struct uwsgi_cache *uc) {
        uint64_t i;
-       int force_clear = 0;
+       int clear_cache = uc->clear_on_full;
 
        if (!uc->ignore_full) {
                if (uc->purge_lru)
@@ -46,21 +46,21 @@
                uint64_t now = (uint64_t) uwsgi_now();
                if (uc->next_scan <= now) {
                        uc->next_scan = now + uc->sweep_on_full;
-                       for (i = 1; i < uc->max_items; i++) {
+                       for (i = 1; i < uc->max_items; i++) {
                                struct uwsgi_cache_item *uci = cache_item(i);
                                if (uci->expires > 0 && uci->expires <= now) {
-                                       if (!uwsgi_cache_del2(uc, NULL, 0, i, 
0)) {
+                                       if (!uwsgi_cache_del2(uc, NULL, 0, i, 
0)) {
                                                removed++;
                                        }
                                }
                        }
-                       if (removed == 0) {
-                               force_clear = 1;
-                       }
-                }
+               }
+               if (removed) {
+                       clear_cache = 0;
+               }
        }
 
-       if (uc->clear_on_full || force_clear) {
+       if (clear_cache) {
                 for (i = 1; i < uc->max_items; i++) {
                        uwsgi_cache_del2(uc, NULL, 0, i, 0);
                 }
@@ -249,7 +249,6 @@
                                 goto next;
                         }
                         key = space+1;
-                        key_len = usl->len - ((space-usl->value)+1);
                 }
                char *value = strchr(key, '=');
                if (!value) {
@@ -723,6 +722,7 @@
 
        uint64_t i;
        unsigned long long restored = 0;
+       uint64_t next_scan = 0;
 
        // reset unused blocks
        uc->unused_blocks_stack_ptr = 0;
@@ -734,8 +734,11 @@
                        if (!uci->prev) {
                                // put value in hash_table
                                uc->hashtable[uci->hash % uc->hashsize] = i;
-                               restored++;
                        }
+                       if (uci->expires && (!next_scan || next_scan > 
uci->expires)) {
+                               next_scan = uci->expires;
+                       }
+                       restored++;
                }
                else {
                        // put this record in unused stack
@@ -744,6 +747,7 @@
                }
        }
 
+       uc->next_scan = next_scan;
        uc->n_items = restored;
        uwsgi_log("[uwsgi-cache] restored %llu items\n", uc->n_items);
 }
@@ -1735,6 +1739,7 @@
                }
 
                // now the magic, we dereference the internal buffer and return 
it to the caller
+               close(fd);
                char *value = ub->buf;
                ub->buf = NULL;
                uwsgi_buffer_destroy(ub);
@@ -1811,6 +1816,8 @@
                        return 0;
                 }
 
+               close(fd);
+               uwsgi_buffer_destroy(ub);
                return 1;
         }
 
@@ -1884,6 +1891,7 @@
                         return -1;
                 }
 
+               close(fd);
                uwsgi_buffer_destroy(ub);
                return 0;
 
@@ -1956,6 +1964,8 @@
                         return -1;
                 }
 
+               close(fd);
+               uwsgi_buffer_destroy(ub);
                 return 0;
         }
 
@@ -2029,6 +2039,8 @@
                         return -1;
                 }
 
+               close(fd);
+               uwsgi_buffer_destroy(ub);
                 return 0;
         }
 
@@ -2049,7 +2061,7 @@
 
                struct uwsgi_buffer *ub = uwsgi_buffer_new(uwsgi.page_size + 
uc->filesize);
                ub->pos = 4;
-               if (uwsgi_buffer_append(ub, uc->name, uc->name_len)) {
+               if (uc->name && uwsgi_buffer_append(ub, uc->name, 
uc->name_len)) {
                        uwsgi_buffer_destroy(ub);
                        close(fd);
                        goto next;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/emperor.c 
new/uwsgi-2.0.13/core/emperor.c
--- old/uwsgi-2.0.12/core/emperor.c     2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/emperor.c     2016-05-10 11:17:48.000000000 +0200
@@ -1634,13 +1634,15 @@
 static void emperor_wakeup(int sn) {
 }
 
-static void emperor_cleanup() {
-       uwsgi_log_verbose("[uwsgi-emperor] cleaning up blacklist ...\n");
-       struct uwsgi_instance *ui_current = ui;
-       while (ui_current->ui_next) {
-               uwsgi_emperor_blacklist_remove(ui_current->name);
-               ui_current = ui_current->ui_next;
+static void emperor_cleanup(int signum) {
+       uwsgi_log_verbose("[emperor] cleaning up blacklist ...\n");
+       struct uwsgi_emperor_blacklist_item *uebi = emperor_blacklist;
+       while (uebi) {
+               struct uwsgi_emperor_blacklist_item *next = uebi->next;
+               free(uebi);
+               uebi = next;
        }
+       emperor_blacklist = NULL;
 }
 
 void emperor_loop() {
@@ -1689,6 +1691,7 @@
        uwsgi.max_fd = rl.rlim_cur;
 
        emperor_throttle_level = uwsgi.emperor_throttle;
+       emperor_throttle = 0;
 
        // the queue must be initialized before adding scanners
        uwsgi.emperor_queue = event_queue_init();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/event.c 
new/uwsgi-2.0.13/core/event.c
--- old/uwsgi-2.0.12/core/event.c       2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/event.c       2016-05-10 11:17:48.000000000 +0200
@@ -169,7 +169,7 @@
         uwsgi_poll_queue_rebuild(upe);
         int ret = poll(upe->poll, upe->nevents, timeout * 1000);
        int cnt = 0;
-        if (ret > 0) {
+       if (ret > 0) {
                 int i;
                 for(i=0;i<upe->nevents;i++) {
                         if (upe->poll[i].revents) {
@@ -493,11 +493,17 @@
 #define UWSGI_EVENT_IN EPOLLIN
 #define UWSGI_EVENT_OUT EPOLLOUT
 
+// EPOLLEXCLUSIVE is introduced in linux 4.5.
+// When using backported kernel, <sys/epoll.h> doesn't have this flag.  So we 
decrare it here.
+// Linux older than 4.5, this flag is just ignored.
+#ifndef EPOLLEXCLUSIVE
+#define EPOLLEXCLUSIVE  (1 << 28)
+#endif
+
 int event_queue_init() {
 
        int epfd;
 
-
        epfd = epoll_create(256);
 
        if (epfd < 0) {
@@ -514,7 +520,7 @@
        struct epoll_event ee;
 
        memset(&ee, 0, sizeof(struct epoll_event));
-       ee.events = EPOLLIN;
+       ee.events = EPOLLIN | EPOLLEXCLUSIVE;
        ee.data.fd = fd;
 
        if (epoll_ctl(eq, EPOLL_CTL_ADD, fd, &ee)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/lock.c new/uwsgi-2.0.13/core/lock.c
--- old/uwsgi-2.0.12/core/lock.c        2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/lock.c        2016-05-10 11:17:48.000000000 +0200
@@ -94,12 +94,22 @@
 #ifndef PTHREAD_MUTEX_ROBUST
 #define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP
 #endif
-       if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT)) {
-               uwsgi_log("unable to set PTHREAD_PRIO_INHERIT\n");
-               exit(1);
-       }
        if (uwsgi_pthread_robust_mutexes_enabled) {
-               if (pthread_mutexattr_setrobust_np(&attr, 
PTHREAD_MUTEX_ROBUST)) {
+               int ret;
+               if ((ret = pthread_mutexattr_setprotocol(&attr, 
PTHREAD_PRIO_INHERIT)) != 0) {
+                       switch (ret) {
+                       case ENOTSUP:
+                               // PTHREAD_PRIO_INHERIT will only prevent
+                               // priority inversion when SCHED_FIFO or
+                               // SCHED_RR is used, so this is non-fatal and
+                               // also currently unsupported on musl.
+                               break;
+                       default:
+                               uwsgi_log("unable to set 
PTHREAD_PRIO_INHERIT\n");
+                               exit(1);
+                       }
+               }
+               if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST)) {
                        uwsgi_log("unable to make the mutex 'robust'\n");
                        exit(1);
                }
@@ -161,7 +171,7 @@
 #ifdef EOWNERDEAD
        if (pthread_mutex_lock((pthread_mutex_t *) uli->lock_ptr) == 
EOWNERDEAD) {
                uwsgi_log("[deadlock-detector] a process holding a robust mutex 
died. recovering...\n");
-               pthread_mutex_consistent_np((pthread_mutex_t *) uli->lock_ptr);
+               pthread_mutex_consistent((pthread_mutex_t *) uli->lock_ptr);
        }
 #else
        pthread_mutex_lock((pthread_mutex_t *) uli->lock_ptr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/routing.c 
new/uwsgi-2.0.13/core/routing.c
--- old/uwsgi-2.0.12/core/routing.c     2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/routing.c     2016-05-10 11:17:48.000000000 +0200
@@ -808,6 +808,16 @@
         return 0;
 }
 
+// do not offload !!!
+static int uwsgi_router_donotoffload_func(struct wsgi_request *wsgi_req, 
struct uwsgi_route *ur) {
+       wsgi_req->socket->can_offload = 0;
+       return UWSGI_ROUTE_NEXT;
+}
+static int uwsgi_router_donotoffload(struct uwsgi_route *ur, char *arg) {
+        ur->func = uwsgi_router_donotoffload_func;
+        return 0;
+}
+
 // logvar route
 static int uwsgi_router_logvar_func(struct wsgi_request *wsgi_req, struct 
uwsgi_route *ur) {
 
@@ -1878,6 +1888,7 @@
        uwsgi_register_router("break-with-status", uwsgi_router_return);
         uwsgi_register_router("log", uwsgi_router_log);
         uwsgi_register_router("donotlog", uwsgi_router_donotlog);
+        uwsgi_register_router("donotoffload", uwsgi_router_donotoffload);
         uwsgi_register_router("logvar", uwsgi_router_logvar);
         uwsgi_register_router("goto", uwsgi_router_goto);
         uwsgi_register_router("addvar", uwsgi_router_addvar);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/rpc.c new/uwsgi-2.0.13/core/rpc.c
--- old/uwsgi-2.0.12/core/rpc.c 2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/rpc.c 2016-05-10 11:17:48.000000000 +0200
@@ -128,19 +128,24 @@
        }
 
        // prepare a uwsgi array
-       uint16_t buffer_size = 2 + strlen(func);
+       size_t buffer_size = 2 + strlen(func);
 
        for (i = 0; i < argc; i++) {
                buffer_size += 2 + argvs[i];
        }
 
+       if (buffer_size > 0xffff) {
+               uwsgi_log("RPC packet length overflow!!! Must be less than or 
equal to 65535, have %llu\n", buffer_size);
+               return NULL;
+       }
+
        // allocate the whole buffer
        buffer = uwsgi_malloc(4+buffer_size);
 
        // set the uwsgi header
        uh = (struct uwsgi_header *) buffer;
        uh->modifier1 = 173;
-       uh->pktsize = buffer_size;
+       uh->pktsize = (uint16_t) buffer_size;
        uh->modifier2 = 0;
 
        // add func to the array
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/spooler.c 
new/uwsgi-2.0.13/core/spooler.c
--- old/uwsgi-2.0.12/core/spooler.c     2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/spooler.c     2016-05-10 11:17:48.000000000 +0200
@@ -21,7 +21,8 @@
        int i;
        struct uwsgi_spooler *us;
 
-       if (access(directory, R_OK | W_OK | X_OK)) {
+       if (access(directory, R_OK | W_OK | X_OK) &&
+           mkdir(directory, S_IRWXU | S_IXGRP | S_IRGRP)) {
                uwsgi_error("[spooler directory] access()");
                exit(1);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/core/uwsgi.c 
new/uwsgi-2.0.13/core/uwsgi.c
--- old/uwsgi-2.0.12/core/uwsgi.c       2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/core/uwsgi.c       2016-05-10 11:17:48.000000000 +0200
@@ -2,7 +2,7 @@
 
  *** uWSGI ***
 
- Copyright (C) 2009-2015 Unbit S.a.s. <[email protected]>
+ Copyright (C) 2009-2016 Unbit S.a.s. <[email protected]>
 
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
@@ -1781,7 +1781,7 @@
 
 void uwsgi_backtrace(int depth) {
 
-#if defined(__linux__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || 
defined(UWSGI_HAS_EXECINFO)
+#if defined(__GLIBC__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || 
defined(UWSGI_HAS_EXECINFO)
 
 #include <execinfo.h>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/cgi/cgi_plugin.c 
new/uwsgi-2.0.13/plugins/cgi/cgi_plugin.c
--- old/uwsgi-2.0.12/plugins/cgi/cgi_plugin.c   2015-12-30 10:08:49.000000000 
+0100
+++ new/uwsgi-2.0.13/plugins/cgi/cgi_plugin.c   2016-05-10 11:17:48.000000000 
+0200
@@ -20,6 +20,7 @@
        int path_info;
        int do_not_kill_on_error;
        int async_max_attempts;
+       int close_stdin_on_eof;
 } uc ;
 
 static void uwsgi_opt_add_cgi(char *opt, char *value, void *foobar) {
@@ -69,6 +70,8 @@
         {"cgi-do-not-kill-on-error", no_argument, 0, "do not send SIGKILL to 
cgi script on errors", uwsgi_opt_true, &uc.do_not_kill_on_error, 0},
         {"cgi-async-max-attempts", no_argument, 0, "max waitpid() attempts in 
cgi async mode (default 10)", uwsgi_opt_set_int, &uc.async_max_attempts, 0},
 
+        {"cgi-close-stdin-on-eof", no_argument, 0, "close STDIN on input EOF", 
uwsgi_opt_true, &uc.close_stdin_on_eof, 0},
+
         {0, 0, 0, 0, 0, 0, 0},
 
 };
@@ -639,6 +642,7 @@
        char **argv;
 
        char *command = full_path;
+       int stdin_closed = 0;
 
        if (is_a_file) {
                 command = docroot;
@@ -691,6 +695,11 @@
                        remains -= rlen;
                }
 
+               if (uc.close_stdin_on_eof) {
+                       close(post_pipe[1]);
+                       stdin_closed = 1;
+               }
+
                // wait for data
                char *buf = uwsgi_malloc(uc.buffer_size);
 
@@ -727,7 +736,8 @@
                free(buf);
 clear2:
                close(cgi_pipe[0]);
-               close(post_pipe[1]);
+               if (!stdin_closed)
+                       close(post_pipe[1]);
 
                // now wait for process exit/death
                // in async mode we need a trick...
@@ -763,12 +773,11 @@
        }
 
        // fill cgi env
-       for(i=0;i<wsgi_req->var_cnt;i++) {
+       for(i=0;i<wsgi_req->var_cnt;i+=2) {
                // no need to free the putenv() memory
                if (putenv(uwsgi_concat3n(wsgi_req->hvec[i].iov_base, 
wsgi_req->hvec[i].iov_len, "=", 1, wsgi_req->hvec[i+1].iov_base, 
wsgi_req->hvec[i+1].iov_len))) {
                        uwsgi_error("putenv()");
                }
-               i++;
        }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/corerouter/cr_map.c 
new/uwsgi-2.0.13/plugins/corerouter/cr_map.c
--- old/uwsgi-2.0.12/plugins/corerouter/cr_map.c        2015-12-30 
10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/corerouter/cr_map.c        2016-05-10 
11:17:48.000000000 +0200
@@ -12,14 +12,16 @@
        uint64_t hits = 0;
        uwsgi_rlock(ucr->cache->lock);
        char *value = uwsgi_cache_get4(ucr->cache, peer->key, peer->key_len, 
&peer->instance_address_len, &hits);
-       if (!value) goto end;
+       if (!value)
+               goto end;
        peer->tmp_socket_name = uwsgi_concat2n(value, 
peer->instance_address_len, "", 0);
        size_t nodes = uwsgi_str_occurence(peer->tmp_socket_name, 
peer->instance_address_len, '|');
        if (nodes > 0) {
-               size_t choosen_node = hits % (nodes+1);
+               size_t choosen_node = hits % (nodes + 1);
                size_t choosen_node_len = 0;
                peer->instance_address = 
uwsgi_str_split_nget(peer->tmp_socket_name, peer->instance_address_len, '|', 
choosen_node, &choosen_node_len);
-               if (!peer->instance_address) goto end;
+               if (!peer->instance_address)
+                       goto end;
                peer->instance_address_len = choosen_node_len;
        }
        else {
@@ -70,13 +72,14 @@
        int count = 5;
 
 split:
-       if (!count) return 0;
+       if (!count)
+               return 0;
 #ifdef UWSGI_DEBUG
        uwsgi_log("trying with %.*s\n", name_len, name);
 #endif
-        peer->un = uwsgi_get_subscribe_node(ucr->subscriptions, name, 
name_len);
+       peer->un = uwsgi_get_subscribe_node(ucr->subscriptions, name, name_len);
        if (!peer->un) {
-               char *next = memchr(name+1, '.', name_len-1);
+               char *next = memchr(name + 1, '.', name_len - 1);
                if (next) {
                        name_len -= next - name;
                        name = next;
@@ -85,17 +88,17 @@
                }
        }
 
-        if (peer->un && peer->un->len) {
-                peer->instance_address = peer->un->name;
-                peer->instance_address_len = peer->un->len;
-                peer->modifier1 = peer->un->modifier1;
-                peer->modifier2 = peer->un->modifier2;
-        }
-        else if (ucr->cheap && !ucr->i_am_cheap && 
uwsgi_no_subscriptions(ucr->subscriptions)) {
-                uwsgi_gateway_go_cheap(ucr->name, ucr->queue, 
&ucr->i_am_cheap);
-        }
+       if (peer->un && peer->un->len) {
+               peer->instance_address = peer->un->name;
+               peer->instance_address_len = peer->un->len;
+               peer->modifier1 = peer->un->modifier1;
+               peer->modifier2 = peer->un->modifier2;
+       }
+       else if (ucr->cheap && !ucr->i_am_cheap && 
uwsgi_no_subscriptions(ucr->subscriptions)) {
+               uwsgi_gateway_go_cheap(ucr->name, ucr->queue, &ucr->i_am_cheap);
+       }
 
-        return 0;
+       return 0;
 }
 
 
@@ -106,7 +109,7 @@
        peer->tmp_socket_name = uwsgi_concat2nn(ucr->base, ucr->base_len, 
peer->key, peer->key_len, &tmp_socket_name_len);
        peer->instance_address_len = tmp_socket_name_len;
        peer->instance_address = peer->tmp_socket_name;
-       
+
        return 0;
 }
 
@@ -135,56 +138,56 @@
 }
 
 int uwsgi_cr_map_use_static_nodes(struct uwsgi_corerouter *ucr, struct 
corerouter_peer *peer) {
-               if (!ucr->current_static_node) {
-                       ucr->current_static_node = ucr->static_nodes;
-               }
+       if (!ucr->current_static_node) {
+               ucr->current_static_node = ucr->static_nodes;
+       }
 
-               peer->static_node = ucr->current_static_node;
+       peer->static_node = ucr->current_static_node;
 
-               // is it a dead node ?
-               if (peer->static_node->custom > 0) {
+       // is it a dead node ?
+       if (peer->static_node->custom > 0) {
 
-                       // gracetime passed ?
-                       if (peer->static_node->custom + 
ucr->static_node_gracetime <= (uint64_t) uwsgi_now()) {
-                               peer->static_node->custom = 0;
-                       }
-                       else {
-                               struct uwsgi_string_list *tmp_node = 
peer->static_node;
-                               struct uwsgi_string_list *next_node = 
peer->static_node->next;
-                               peer->static_node = NULL;
-                               // needed for 1-node only setups
-                               if (!next_node)
+               // gracetime passed ?
+               if (peer->static_node->custom + ucr->static_node_gracetime <= 
(uint64_t) uwsgi_now()) {
+                       peer->static_node->custom = 0;
+               }
+               else {
+                       struct uwsgi_string_list *tmp_node = peer->static_node;
+                       struct uwsgi_string_list *next_node = 
peer->static_node->next;
+                       peer->static_node = NULL;
+                       // needed for 1-node only setups
+                       if (!next_node)
+                               next_node = ucr->static_nodes;
+
+                       while (tmp_node != next_node) {
+                               if (!next_node) {
                                        next_node = ucr->static_nodes;
+                               }
 
-                                       while (tmp_node != next_node) {
-                                               if (!next_node) {
-                                                       next_node = 
ucr->static_nodes;
-                                               }
-
-                                               if (tmp_node == next_node)
-                                                       break;
-
-                                               if (next_node->custom == 0) {
-                                                       peer->static_node = 
next_node;
-                                                       break;
-                                               }
-                                               next_node = next_node->next;
-                                       }
+                               if (tmp_node == next_node)
+                                       break;
+
+                               if (next_node->custom == 0) {
+                                       peer->static_node = next_node;
+                                       break;
                                }
+                               next_node = next_node->next;
                        }
+               }
+       }
 
-                       if (peer->static_node) {
+       if (peer->static_node) {
+
+               peer->instance_address = peer->static_node->value;
+               peer->instance_address_len = peer->static_node->len;
+               // set the next one
+               ucr->current_static_node = peer->static_node->next;
+       }
+       else {
+               // set the next one
+               ucr->current_static_node = ucr->current_static_node->next;
+       }
 
-                               peer->instance_address = 
peer->static_node->value;
-                               peer->instance_address_len = 
peer->static_node->len;
-                               // set the next one
-                               ucr->current_static_node = 
peer->static_node->next;
-                       }
-                       else {
-                               // set the next one
-                               ucr->current_static_node = 
ucr->current_static_node->next;
-                       }
-       
        return 0;
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/gccgo/gccgo_plugin.c 
new/uwsgi-2.0.13/plugins/gccgo/gccgo_plugin.c
--- old/uwsgi-2.0.12/plugins/gccgo/gccgo_plugin.c       2015-12-30 
10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/gccgo/gccgo_plugin.c       2016-05-10 
11:17:48.000000000 +0200
@@ -233,9 +233,8 @@
 
        wsgi_req->async_environ = uwsgigo_env(wsgi_req);
        int i;
-        for(i=0;i<wsgi_req->var_cnt;i++) {
+        for(i=0;i<wsgi_req->var_cnt;i+=2) {
                 uwsgigo_env_add(wsgi_req->async_environ, 
wsgi_req->hvec[i].iov_base,  wsgi_req->hvec[i].iov_len, 
wsgi_req->hvec[i+1].iov_base, wsgi_req->hvec[i+1].iov_len);
-                i++;
         }
        uwsgigo_request(wsgi_req->async_environ, wsgi_req);
 end:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/jwsgi/jwsgi_plugin.c 
new/uwsgi-2.0.13/plugins/jwsgi/jwsgi_plugin.c
--- old/uwsgi-2.0.12/plugins/jwsgi/jwsgi_plugin.c       2015-12-30 
10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/jwsgi/jwsgi_plugin.c       2016-05-10 
11:17:48.000000000 +0200
@@ -71,13 +71,12 @@
        if (!hm) return -1;
 
        int i;
-       for(i=0;i<wsgi_req->var_cnt;i++) {
+       for(i=0;i<wsgi_req->var_cnt;i+=2) {
                 char *hk = wsgi_req->hvec[i].iov_base;
                 uint16_t hk_l = wsgi_req->hvec[i].iov_len;
                 char *hv = wsgi_req->hvec[i+1].iov_base;
                 uint16_t hv_l = wsgi_req->hvec[i+1].iov_len;
                if (uwsgi_jwsgi_add_request_item(hm, hk, hk_l, hv, hv_l)) goto 
end;
-               i++;
        }
 
        if (uwsgi_jwsgi_add_request_input(hm, "jwsgi.input", 11)) goto end;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/lua/lua_plugin.c 
new/uwsgi-2.0.13/plugins/lua/lua_plugin.c
--- old/uwsgi-2.0.12/plugins/lua/lua_plugin.c   2015-12-30 10:08:49.000000000 
+0100
+++ new/uwsgi-2.0.13/plugins/lua/lua_plugin.c   2016-05-10 11:17:48.000000000 
+0200
@@ -764,13 +764,12 @@
        lua_newtable(L);
        lua_pushstring(L, "");
        lua_setfield(L, -2, "CONTENT_TYPE");
-       for(i=0;i<wsgi_req->var_cnt;i++) {
+       for(i=0;i<wsgi_req->var_cnt;i+=2) {
                lua_pushlstring(L, (char *)wsgi_req->hvec[i+1].iov_base, 
wsgi_req->hvec[i+1].iov_len);
                // transform it in a valid c string TODO this is ugly
                ptrbuf = wsgi_req->hvec[i].iov_base+wsgi_req->hvec[i].iov_len;
                *ptrbuf = 0;
                lua_setfield(L, -2, (char *)wsgi_req->hvec[i].iov_base);
-               i++;
        }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/php/uwsgiplugin.py 
new/uwsgi-2.0.13/plugins/php/uwsgiplugin.py
--- old/uwsgi-2.0.12/plugins/php/uwsgiplugin.py 2015-12-30 10:08:49.000000000 
+0100
+++ new/uwsgi-2.0.13/plugins/php/uwsgiplugin.py 2016-05-10 11:17:48.000000000 
+0200
@@ -25,6 +25,6 @@
 
 phplibdir = os.environ.get('UWSGICONFIG_PHPLIBDIR')
 if phplibdir:
-    LIBS.append('-Wl,-rpath=%s' % phplibdir)
+    LIBS.append('-Wl,-rpath,%s' % phplibdir)
 
 GCC_LIST = ['php_plugin', 'session']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/plugins/python/uwsgiplugin.py 
new/uwsgi-2.0.13/plugins/python/uwsgiplugin.py
--- old/uwsgi-2.0.12/plugins/python/uwsgiplugin.py      2015-12-30 
10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/python/uwsgiplugin.py      2016-05-10 
11:17:48.000000000 +0200
@@ -56,7 +56,7 @@
             libdir = "%s/lib" % sysconfig.PREFIX
 
         LDFLAGS.append("-L%s" % libdir)
-        LDFLAGS.append("-Wl,-rpath=%s" % libdir)
+        LDFLAGS.append("-Wl,-rpath,%s" % libdir)
 
         os.environ['LD_RUN_PATH'] = "%s" % libdir
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/uwsgi-2.0.12/plugins/router_basicauth/router_basicauth.c 
new/uwsgi-2.0.13/plugins/router_basicauth/router_basicauth.c
--- old/uwsgi-2.0.12/plugins/router_basicauth/router_basicauth.c        
2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/router_basicauth/router_basicauth.c        
2016-05-10 11:17:48.000000000 +0200
@@ -2,7 +2,7 @@
 
 #ifdef UWSGI_ROUTING
 
-#if defined(__linux__) && !defined(__UCLIBC__)
+#if defined(__GLIBC__)
 #include <crypt.h>
 #elif defined(__CYGWIN__)
 #include <crypt.h>
@@ -66,7 +66,7 @@
 
                if (clen > 13) cpwd[13] = 0;
 
-#if defined(__linux__) && !defined(__UCLIBC__)
+#if defined(__GLIBC__)
                struct crypt_data cd;
                cd.initialized = 0;
                // we do as nginx here
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/uwsgi-2.0.12/plugins/stats_pusher_mongodb/uwsgiplugin.py 
new/uwsgi-2.0.13/plugins/stats_pusher_mongodb/uwsgiplugin.py
--- old/uwsgi-2.0.12/plugins/stats_pusher_mongodb/uwsgiplugin.py        
2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/plugins/stats_pusher_mongodb/uwsgiplugin.py        
2016-05-10 11:17:48.000000000 +0200
@@ -1,8 +1,13 @@
 import os
 
-NAME='stats_pusher_mongodb'
+NAME = 'stats_pusher_mongodb'
 
-CFLAGS = ['-I/usr/include/mongo','-I/usr/local/include/mongo']
+CFLAGS = [
+    '-I/usr/include/mongo',
+    '-I/usr/local/include/mongo',
+    '-std=c++11',
+    '-Wno-error'
+]
 LDFLAGS = []
 
 LIBS = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/setup.py new/uwsgi-2.0.13/setup.py
--- old/uwsgi-2.0.12/setup.py   2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/setup.py   2016-05-10 11:17:48.000000000 +0200
@@ -9,6 +9,12 @@
 from setuptools.command.install_lib import install_lib
 from setuptools.command.build_ext import build_ext
 
+try:
+    from wheel.bdist_wheel import bdist_wheel
+    HAS_WHEEL = True
+except ImportError:
+    HAS_WHEEL = False
+
 """
 This is a hack allowing you installing
 uWSGI and uwsgidecorators via pip and easy_install
@@ -87,6 +93,13 @@
         install_lib.run(self)
 
 
+if HAS_WHEEL:
+    class uWSGIWheel(bdist_wheel):
+        def finalize_options(self):
+            bdist_wheel.finalize_options(self)
+            self.root_is_pure = False
+
+
 class uWSGIDistribution(Distribution):
 
     def __init__(self, *attrs):
@@ -94,6 +107,8 @@
         self.cmdclass['install'] = uWSGIInstall
         self.cmdclass['install_lib'] = uWSGIInstallLib
         self.cmdclass['build_ext'] = uWSGIBuilder
+        if HAS_WHEEL:
+            self.cmdclass['bdist_wheel'] = uWSGIWheel
 
     def is_pure(self):
         return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/uwsgi.gemspec 
new/uwsgi-2.0.13/uwsgi.gemspec
--- old/uwsgi-2.0.12/uwsgi.gemspec      2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/uwsgi.gemspec      2016-05-10 11:17:48.000000000 +0200
@@ -2,7 +2,7 @@
   s.name        = 'uwsgi'
   s.license     = 'GPL-2'
   s.version     = `python -c "import uwsgiconfig as uc; print 
uc.uwsgi_version"`.sub(/-dev-.*/,'')
-  s.date        = '2015-12-30'
+  s.date        = '2016-05-10'
   s.summary     = "uWSGI"
   s.description = "The uWSGI server for Ruby/Rack"
   s.authors     = ["Unbit"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/uwsgi.h new/uwsgi-2.0.13/uwsgi.h
--- old/uwsgi-2.0.12/uwsgi.h    2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/uwsgi.h    2016-05-10 11:17:48.000000000 +0200
@@ -153,29 +153,22 @@
 #endif
 #endif
 
+#if defined(__linux__) || defined(__GNUC__)
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
-#include <stdio.h>
-#ifdef __UCLIBC__
-#include <sched.h>
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
 #endif
-#undef _GNU_SOURCE
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <signal.h>
 #include <math.h>
 
 #include <sys/types.h>
-#ifdef __linux__
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#ifndef __USE_GNU
-#define __USE_GNU
-#endif
-#endif
 #include <sys/socket.h>
 #include <net/if.h>
 #ifdef __linux__
@@ -183,7 +176,6 @@
 #define MSG_FASTOPEN   0x20000000
 #endif
 #endif
-#undef _GNU_SOURCE
 #include <netinet/in.h>
 
 #include <termios.h>
@@ -269,6 +261,9 @@
 #include <stdint.h>
 
 #include <sys/wait.h>
+#ifndef WAIT_ANY
+#define WAIT_ANY (-1)
+#endif
 
 #ifdef __APPLE__
 #ifndef MAC_OS_X_VERSION_MIN_REQUIRED
@@ -342,6 +337,9 @@
 #ifdef __sun__
 #undef __EXTENSIONS__
 #endif
+#ifdef _GNU_SOURCE
+#undef _GNU_SOURCE
+#endif
 
 #define UWSGI_CACHE_FLAG_UNGETTABLE    0x01
 #define UWSGI_CACHE_FLAG_UPDATE        1 << 1
@@ -866,6 +864,11 @@
 
 #ifdef __linux__
 #include <endian.h>
+#if defined(__BYTE_ORDER__)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define __BIG_ENDIAN__ 1
+#endif
+#endif
 #elif defined(__sun__)
 #include <sys/byteorder.h>
 #ifdef _BIG_ENDIAN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/uwsgi-2.0.12/uwsgiconfig.py 
new/uwsgi-2.0.13/uwsgiconfig.py
--- old/uwsgi-2.0.12/uwsgiconfig.py     2015-12-30 10:08:49.000000000 +0100
+++ new/uwsgi-2.0.13/uwsgiconfig.py     2016-05-10 11:17:48.000000000 +0200
@@ -1,6 +1,6 @@
 # uWSGI build system
 
-uwsgi_version = '2.0.12'
+uwsgi_version = '2.0.13'
 
 import os
 import re
@@ -27,9 +27,15 @@
 except:
     import configparser as ConfigParser
 
-GCC = os.environ.get('CC', sysconfig.get_config_var('CC'))
-if not GCC:
-    GCC = 'gcc'
+
+PY3 = sys.version_info[0] == 3
+
+if uwsgi_os == 'Darwin':
+    GCC = os.environ.get('CC', 'clang')
+else:
+    GCC = os.environ.get('CC', sysconfig.get_config_var('CC'))
+    if not GCC:
+        GCC = 'gcc'
 
 def get_preprocessor():
     if 'clang' in GCC:
@@ -82,6 +88,7 @@
     'debug': False,
     'plugin_dir': False,
     'zlib': False,
+    'ucontext': False,
 }
 
 verbose_build = False
@@ -158,6 +165,39 @@
     else:
         return None
 
+
+def test_snippet(snippet):
+    """Compile a C snippet to see if features are available at build / link 
time."""
+    if not isinstance(snippet, bytes):
+        if PY3:
+            snippet = bytes(snippet, sys.getdefaultencoding())
+        else:
+            snippet = bytes(snippet)
+    cmd = "{} -xc - -o /dev/null".format(GCC)
+    p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, 
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+    p.communicate(snippet)
+    return p.returncode == 0
+
+
+def has_usable_ucontext():
+    if uwsgi_os in ('OpenBSD', 'Haiku'):
+        return False
+    if uwsgi_os.startswith('CYGWIN'):
+        return False
+    if uwsgi_os == 'Darwin' and uwsgi_os_k.startswith('8'):
+        return False
+    if uwsgi_cpu[0:3] == 'arm':
+        return False
+    # check for ucontext.h functions definitions, musl has only declarations
+    return test_snippet("""#include <ucontext.h>
+int main()
+{
+       ucontext_t uc;
+       getcontext(&uc);
+       return 0;
+}""")
+
+
 def spcall3(cmd):
     p = subprocess.Popen(cmd, shell=True, stdin=open('/dev/null'), 
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
 
@@ -257,7 +297,7 @@
             if not p or p == 'None':
                 continue
             if p == 'ugreen':
-                if uwsgi_os == 'OpenBSD' or uwsgi_cpu[0:3] == 'arm' or 
uwsgi_os == 'Haiku' or uwsgi_os.startswith('CYGWIN') or (uwsgi_os == 'Darwin' 
and uwsgi_os_k.startswith('8')):
+                if not report['ucontext']:
                     continue
             epc += "UDEP(%s);" % p
             eplc += "ULEP(%s);" % p
@@ -398,7 +438,7 @@
                     continue
 
                 if p == 'ugreen':
-                    if uwsgi_os == 'OpenBSD' or uwsgi_cpu[0:3] == 'arm' or 
uwsgi_os == 'Haiku' or uwsgi_os.startswith('CYGWIN') or (uwsgi_os == 'Darwin' 
and uwsgi_os_k.startswith('8')):
+                    if not report['ucontext']:
                         continue
 
                 path = path.rstrip('/')
@@ -850,6 +890,9 @@
             for extra in extras.split(','):
                 self.gcc_list.append(extra)
 
+        # check for usable ucontext
+        report['ucontext'] = has_usable_ucontext()
+
         # set locking subsystem
         locking_mode = self.get('locking','auto')
 
@@ -1378,7 +1421,7 @@
         pass
 
     if uc:
-        plugin_dest = uc.get('plugin_dir') + '/' + name + '_plugin'
+        plugin_dest = uc.get('plugin_build_dir', uc.get('plugin_dir')) + '/' + 
name + '_plugin'
     else:
         plugin_dest = name + '_plugin'
 


Reply via email to