<div dir="ltr"><div>Something is a bit wrong with this version:</div><div><br></div><div>$ du -hs update-rc.d/0.7-r5/pseudo/*</div><div>72K     update-rc.d/0.7-r5/pseudo/files.db</div><div>16K     update-rc.d/0.7-r5/pseudo/logs.db</div><div>0       update-rc.d/0.7-r5/pseudo/pseudo.lock</div><div>31G     update-rc.d/0.7-r5/pseudo/pseudo.log</div><div>4.0K    update-rc.d/0.7-r5/pseudo/pseudo.pid</div><div>0       update-rc.d/0.7-r5/pseudo/pseudo.socket</div><div><br></div><div><div>$ grep -c &quot;tried to close client 0 (highest is 1)&quot; update-rc.d/0.7-r5/pseudo/pseudo.log</div></div><div>579655922<br></div><div><br></div><div>All pseudo processes I&#39;ve seen on various servers which were building with this change included got stuck until disk space run out..</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 16, 2018 at 10:56 AM, Alexander Kanavin <span dir="ltr">&lt;<a href="mailto:alexander.kanavin@linux.intel.com" target="_blank">alexander.kanavin@linux.intel.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dropped patches:<br>
0001-Use-epoll-API-on-Linux.<wbr>patch replaced by<br>
<a href="http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/commit/?id=0a3e435085046f535074f498a3de75a7704fb14c" rel="noreferrer" target="_blank">http://git.yoctoproject.org/<wbr>cgit/cgit.cgi/pseudo/commit/?<wbr>id=<wbr>0a3e435085046f535074f498a3de75<wbr>a7704fb14c</a><br>
(also add --enable-epoll to configure options)<br>
<br>
b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch merged upstream<br>
<br>
efe0be279901006f939cd357ccee47<wbr>b651c786da.patch merged upstream<br>
<br>
fastopreply.patch replaced by<br>
<a href="http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/commit/?id=449c234d3030328fb997b309511bb54598848a05" rel="noreferrer" target="_blank">http://git.yoctoproject.org/<wbr>cgit/cgit.cgi/pseudo/commit/?<wbr>id=<wbr>449c234d3030328fb997b309511bb5<wbr>4598848a05</a><br>
<br>
toomanyfiles.patch rebased<br>
<br>
Signed-off-by: Alexander Kanavin &lt;<a href="mailto:alexander.kanavin@linux.intel.com">alexander.kanavin@linux.<wbr>intel.com</a>&gt;<br>
---<br>
 .../pseudo/files/0001-Use-<wbr>epoll-API-on-Linux.patch | 292 ---------------------<br>
 .../<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch |  48 ----<br>
 .../<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch |  99 -------<br>
 .../pseudo/files/fastopreply.<wbr>patch                 |  76 ------<br>
 .../pseudo/files/toomanyfiles.<wbr>patch                |  44 ++--<br>
 meta/recipes-devtools/pseudo/<wbr>pseudo.inc            |   2 +-<br>
 meta/recipes-devtools/pseudo/<a href="http://pseudo_1.8.2.bb" rel="noreferrer" target="_blank">p<wbr>seudo_1.8.2.bb</a>       |  16 --<br>
 meta/recipes-devtools/pseudo/<a href="http://pseudo_git.bb" rel="noreferrer" target="_blank">p<wbr>seudo_git.bb</a>         |  11 +-<br>
 8 files changed, 34 insertions(+), 554 deletions(-)<br>
 delete mode 100644 meta/recipes-devtools/pseudo/<wbr>files/0001-Use-epoll-API-on-<wbr>Linux.patch<br>
 delete mode 100644 meta/recipes-devtools/pseudo/<wbr>files/<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch<br>
 delete mode 100644 meta/recipes-devtools/pseudo/<wbr>files/<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch<br>
 delete mode 100644 meta/recipes-devtools/pseudo/<wbr>files/fastopreply.patch<br>
 delete mode 100644 meta/recipes-devtools/pseudo/<a href="http://pseudo_1.8.2.bb" rel="noreferrer" target="_blank">p<wbr>seudo_1.8.2.bb</a><br>
<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/files/0001-Use-epoll-<wbr>API-on-Linux.patch b/meta/recipes-devtools/<wbr>pseudo/files/0001-Use-epoll-<wbr>API-on-Linux.patch<br>
deleted file mode 100644<br>
index 42557b17a7f..00000000000<br>
--- a/meta/recipes-devtools/<wbr>pseudo/files/0001-Use-epoll-<wbr>API-on-Linux.patch<br>
+++ /dev/null<br>
@@ -1,292 +0,0 @@<br>
-From 9e407e0be01695e7b927f5820ade87<wbr>ee9602c248 Mon Sep 17 00:00:00 2001<br>
-From: Alexander Kanavin &lt;<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>&gt;<br>
-Date: Fri, 15 Sep 2017 17:00:14 +0300<br>
-Subject: [PATCH] Use epoll API on Linux<br>
-<br>
-Also a couple of other modifications due to epoll having<br>
-a different approach to how the working set of fds is defined<br>
-and used:<br>
-1) open_client() returns an index into the array of clients<br>
-2) close_client() has a protection against being called twice<br>
-with the same client (which would mess up the active_clients<br>
-counter)<br>
-<br>
-Upstream-Status: Submitted [Seebs CC&#39;d by email]<br>
-Signed-off-by: Alexander Kanavin &lt;<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>&gt;<br>
-<br>
----<br>
- enums/<a href="http://exit_status.in" rel="noreferrer" target="_blank">exit_status.in</a> |   3 +<br>
- pseudo_server.c      | 189 ++++++++++++++++++++++++++++++<wbr>++++++++++++++++++++-<br>
- 2 files changed, 190 insertions(+), 2 deletions(-)<br>
-<br>
-diff --git a/enums/<a href="http://exit_status.in" rel="noreferrer" target="_blank">exit_status.in</a> b/enums/<a href="http://exit_status.in" rel="noreferrer" target="_blank">exit_status.in</a><br>
-index 6be44d3..88f94cd 100644<br>
---- a/enums/<a href="http://exit_status.in" rel="noreferrer" target="_blank">exit_status.in</a><br>
-+++ b/enums/<a href="http://exit_status.in" rel="noreferrer" target="_blank">exit_status.in</a><br>
-@@ -18,3 +18,6 @@ listen_fd, &quot;server loop had no valid listen fd&quot;<br>
- pseudo_loaded, &quot;server couldn&#39;t get out of pseudo environment&quot;<br>
- pseudo_prefix, &quot;couldn&#39;t get valid pseudo prefix&quot;<br>
- pseudo_invocation, &quot;invalid server command arguments&quot;<br>
-+epoll_create, &quot;epoll_create() failed&quot;<br>
-+epoll_ctl, &quot;epoll_ctl() failed&quot;<br>
-+<br>
-diff --git a/pseudo_server.c b/pseudo_server.c<br>
-index ff16efd..14d34de 100644<br>
---- a/pseudo_server.c<br>
-+++ b/pseudo_server.c<br>
-@@ -40,6 +40,12 @@<br>
- #include &quot;pseudo_client.h&quot;<br>
- #include &quot;pseudo_db.h&quot;<br>
-<br>
-+// This has to come after pseudo includes, as that&#39;s where PSEUDO_PORT defines are<br>
-+#ifdef PSEUDO_PORT_LINUX<br>
-+#include &lt;sys/epoll.h&gt;<br>
-+#endif<br>
-+<br>
-+<br>
- static int listen_fd = -1;<br>
-<br>
- typedef struct {<br>
-@@ -59,6 +65,7 @@ static int active_clients = 0, highest_client = 0, max_clients = 0;<br>
-<br>
- #define LOOP_DELAY 2<br>
- #define DEFAULT_PSEUDO_SERVER_TIMEOUT 30<br>
-+#define EPOLL_MAX_EVENTS 10<br>
- int pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;<br>
- static int die_peacefully = 0;<br>
- static int die_forcefully = 0;<br>
-@@ -80,6 +87,9 @@ quit_now(int signal) {<br>
- static int messages = 0, responses = 0;<br>
- static struct timeval message_time = { .tv_sec = 0 };<br>
-<br>
-+#ifdef PSEUDO_PORT_LINUX<br>
-+static void pseudo_server_loop_epoll(void)<wbr>;<br>
-+#endif<br>
- static void pseudo_server_loop(void);<br>
-<br>
- /* helper function to make a directory, just like mkdir -p.<br>
-@@ -369,12 +379,16 @@ pseudo_server_start(int daemonize) {<br>
-                       kill(ppid, SIGUSR1);<br>
-               }<br>
-       }<br>
-+#ifdef PSEUDO_PORT_LINUX<br>
-+      pseudo_server_loop_epoll();<br>
-+#else<br>
-       pseudo_server_loop();<br>
-+#endif<br>
-       return 0;<br>
- }<br>
-<br>
- /* mess with internal tables as needed */<br>
--static void<br>
-+static unsigned int<br>
- open_client(int fd) {<br>
-       pseudo_client_t *new_clients;<br>
-       int i;<br>
-@@ -390,7 +404,7 @@ open_client(int fd) {<br>
-                       ++active_clients;<br>
-                       if (i &gt; highest_client)<br>
-                               highest_client = i;<br>
--                      return;<br>
-+                      return i;<br>
-               }<br>
-       }<br>
-<br>
-@@ -414,9 +428,11 @@ open_client(int fd) {<br>
-<br>
-               max_clients += 16;<br>
-               ++active_clients;<br>
-+              return max_clients - 16;<br>
-       } else {<br>
-               pseudo_diag(&quot;error allocating new client, fd %d\n&quot;, fd);<br>
-               close(fd);<br>
-+              return 0;<br>
-       }<br>
- }<br>
-<br>
-@@ -433,6 +449,10 @@ close_client(int client) {<br>
-                       client, highest_client);<br>
-               return;<br>
-       }<br>
-+      if (clients[client].fd == -1) {<br>
-+              pseudo_debug(PDBGF_SERVER, &quot;client %d already closed\n&quot;, client);<br>
-+              return;<br>
-+      }<br>
-       close(clients[client].fd);<br>
-       clients[client].fd = -1;<br>
-       free(clients[client].tag);<br>
-@@ -566,6 +586,171 @@ serve_client(int i) {<br>
-       }<br>
- }<br>
-<br>
-+#ifdef PSEUDO_PORT_LINUX<br>
-+static void pseudo_server_loop_epoll(void)<br>
-+{<br>
-+      struct sockaddr_un client;<br>
-+      socklen_t len;<br>
-+        int i;<br>
-+        int rc;<br>
-+        int fd;<br>
-+      int timeout;<br>
-+      struct epoll_event ev, events[EPOLL_MAX_EVENTS];<br>
-+      int loop_timeout = pseudo_server_timeout;<br>
-+<br>
-+      clients = malloc(16 * sizeof(*clients));<br>
-+<br>
-+      clients[0].fd = listen_fd;<br>
-+      clients[0].pid = getpid();<br>
-+<br>
-+      for (i = 1; i &lt; 16; ++i) {<br>
-+              clients[i].fd = -1;<br>
-+              clients[i].pid = 0;<br>
-+              clients[i].tag = NULL;<br>
-+              clients[i].program = NULL;<br>
-+      }<br>
-+<br>
-+      active_clients = 1;<br>
-+      max_clients = 16;<br>
-+      highest_client = 0;<br>
-+<br>
-+      pseudo_debug(PDBGF_SERVER, &quot;server loop started.\n&quot;);<br>
-+      if (listen_fd &lt; 0) {<br>
-+              pseudo_diag(&quot;got into loop with no valid listen fd.\n&quot;);<br>
-+              exit(PSEUDO_EXIT_LISTEN_FD);<br>
-+      }<br>
-+<br>
-+      timeout = LOOP_DELAY * 1000;<br>
-+<br>
-+      int epollfd = epoll_create1(0);<br>
-+      if (epollfd == -1) {<br>
-+              pseudo_diag(&quot;epoll_create1() failed.\n&quot;);<br>
-+              exit(PSEUDO_EXIT_EPOLL_CREATE)<wbr>;<br>
-+      }<br>
-+      ev.events = EPOLLIN;<br>
-+      ev.data.u64 = 0;<br>
-+      if (epoll_ctl(epollfd, EPOLL_CTL_ADD, clients[0].fd, &amp;ev) == -1) {<br>
-+              pseudo_diag(&quot;epoll_ctl() failed with listening socket.\n&quot;);<br>
-+              exit(PSEUDO_EXIT_EPOLL_CTL);<br>
-+      }<br>
-+<br>
-+      pdb_log_msg(SEVERITY_INFO, NULL, NULL, NULL, &quot;server started (pid %d)&quot;, getpid());<br>
-+<br>
-+        for (;;) {<br>
-+              rc = epoll_wait(epollfd, events, EPOLL_MAX_EVENTS, timeout);<br>
-+              if (rc == 0 || (rc == -1 &amp;&amp; errno == EINTR)) {<br>
-+                      /* If there&#39;s no clients, start timing out.  If there<br>
-+                       * are active clients, never time out.<br>
-+                       */<br>
-+                      if (active_clients == 1) {<br>
-+                              loop_timeout -= LOOP_DELAY;<br>
-+                                /* maybe flush database to disk */<br>
-+                                pdb_maybe_backup();<br>
-+                              if (loop_timeout &lt;= 0) {<br>
-+                                      pseudo_debug(PDBGF_SERVER, &quot;no more clients, got bored.\n&quot;);<br>
-+                                      die_peacefully = 1;<br>
-+                              } else {<br>
-+                                      /* display this if not exiting */<br>
-+                                      pseudo_debug(PDBGF_SERVER | PDBGF_BENCHMARK, &quot;%d messages handled in %.4f seconds, %d responses\n&quot;,<br>
-+                                              messages,<br>
-+                                              (double) message_time.tv_sec +<br>
-+                                              (double) message_time.tv_usec / 1000000.0,<br>
-+                                                responses);<br>
-+                              }<br>
-+                      }<br>
-+              } else if (rc &gt; 0) {<br>
-+                      loop_timeout = pseudo_server_timeout;<br>
-+                      for (i = 0; i &lt; rc; ++i) {<br>
-+                              if (clients[events[i].data.u64].<wbr>fd == listen_fd) {<br>
-+                                      if (!die_forcefully) {<br>
-+                                              len = sizeof(client);<br>
-+                                              if ((fd = accept(listen_fd, (struct sockaddr *) &amp;client, &amp;len)) != -1) {<br>
-+                                              /* Don&#39;t allow clients to end up on fd 2, because glibc&#39;s<br>
-+                                               * malloc debug uses that fd unconditionally.<br>
-+                                               */<br>
-+                                                      if (fd == 2) {<br>
-+                                                              int newfd = fcntl(fd, F_DUPFD, 3);<br>
-+                                                              close(fd);<br>
-+                                                              fd = newfd;<br>
-+                                                      }<br>
-+                                                      pseudo_debug(PDBGF_SERVER, &quot;new client fd %d\n&quot;, fd);<br>
-+                                                      /* A new client implicitly cancels any<br>
-+                                                       * previous shutdown request, or a<br>
-+                                                       * shutdown for lack of clients.<br>
-+                                                       */<br>
-+                                                      pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;<br>
-+                                                      die_peacefully = 0;<br>
-+<br>
-+                                                      ev.events = EPOLLIN;<br>
-+                                                      ev.data.u64 = open_client(fd);<br>
-+                                                      if (ev.data.u64 != 0 &amp;&amp; epoll_ctl(epollfd, EPOLL_CTL_ADD, clients[ev.data.u64].fd, &amp;ev) == -1) {<br>
-+                                                              pseudo_diag(&quot;epoll_ctl() failed with accepted socket.\n&quot;);<br>
-+                                                              exit(PSEUDO_EXIT_EPOLL_CTL);<br>
-+                                                      }<br>
-+                                              } else if (errno == EMFILE) {<br>
-+                                                      pseudo_debug(PDBGF_SERVER, &quot;Hit max open files, dropping a client.\n&quot;);<br>
-+                                                      /* In theory there is a potential race here where if we close a client,<br>
-+                                                         it may have sent us a fastop message which we don&#39;t act upon.<br>
-+                                                         If we don&#39;t close a filehandle we&#39;ll loop indefinitely thought.<br>
-+                                                         Only close one per loop iteration in the interests of caution */<br>
-+                                                      for (int j = 1; j &lt;= highest_client; ++j) {<br>
-+                                                              if (clients[j].fd != -1) {<br>
-+                                                                      close_client(j);<br>
-+                                                                      break;<br>
-+                                                              }<br>
-+                                                      }<br>
-+                                              }<br>
-+                                      }<br>
-+                              } else {<br>
-+                                      struct timeval tv1, tv2;<br>
-+                                        int rc;<br>
-+                                      gettimeofday(&amp;tv1, NULL);<br>
-+                                      rc = serve_client(events[i].data.<wbr>u64);<br>
-+                                      gettimeofday(&amp;tv2, NULL);<br>
-+                                      ++messages;<br>
-+                                        if (rc == 0)<br>
-+                                                ++responses;<br>
-+                                      message_time.tv_sec += (tv2.tv_sec - tv1.tv_sec);<br>
-+                                      message_time.tv_usec += (tv2.tv_usec - tv1.tv_usec);<br>
-+                                      if (message_time.tv_usec &lt; 0) {<br>
-+                                              message_time.tv_usec += 1000000;<br>
-+                                              --message_time.tv_sec;<br>
-+                                      } else while (message_time.tv_usec &gt; 1000000) {<br>
-+                                              message_time.tv_usec -= 1000000;<br>
-+                                              ++message_time.tv_sec;<br>
-+                                      }<br>
-+                              }<br>
-+                              if (die_forcefully)<br>
-+                                      break;<br>
-+                      }<br>
-+                      pseudo_debug(PDBGF_SERVER, &quot;server loop complete [%d clients left]\n&quot;, active_clients);<br>
-+              } else {<br>
-+                      pseudo_diag(&quot;epoll_wait failed: %s\n&quot;, strerror(errno));<br>
-+                      break;<br>
-+              }<br>
-+              if (die_peacefully || die_forcefully) {<br>
-+                      pseudo_debug(PDBGF_SERVER, &quot;quitting.\n&quot;);<br>
-+                      pseudo_debug(PDBGF_SERVER | PDBGF_BENCHMARK, &quot;server %d exiting: handled %d messages in %.4f seconds\n&quot;,<br>
-+                              getpid(), messages,<br>
-+                              (double) message_time.tv_sec +<br>
-+                              (double) message_time.tv_usec / 1000000.0);<br>
-+                      pdb_log_msg(SEVERITY_INFO, NULL, NULL, NULL, &quot;server %d exiting: handled %d messages in %.4f seconds&quot;,<br>
-+                              getpid(), messages,<br>
-+                              (double) message_time.tv_sec +<br>
-+                              (double) message_time.tv_usec / 1000000.0);<br>
-+                      /* and at this point, we&#39;ll start refusing connections */<br>
-+                      close(clients[0].fd);<br>
-+                      /* This is a good place to insert a delay for<br>
-+                       * debugging race conditions during startup. */<br>
-+                      /* usleep(300000); */<br>
-+                      exit(0);<br>
-+              }<br>
-+      }<br>
-+<br>
-+}<br>
-+<br>
-+#endif<br>
-+<br>
- /* get clients, handle messages, shut down.<br>
-  * This doesn&#39;t actually do any work, it just calls a ton of things which<br>
-  * do work.<br>
---<br>
-2.14.1<br>
-<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/files/<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch b/meta/recipes-devtools/<wbr>pseudo/files/<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch<br>
deleted file mode 100644<br>
index 3045a3b736f..00000000000<br>
--- a/meta/recipes-devtools/<wbr>pseudo/files/<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch<br>
+++ /dev/null<br>
@@ -1,48 +0,0 @@<br>
-From b6b68db896f9963558334aff7fca61<wbr>adde4ec10f Mon Sep 17 00:00:00 2001<br>
-From: Seebs &lt;<a href="mailto:seebs@seebs.net">seebs@seebs.net</a>&gt;<br>
-Date: Thu, 13 Apr 2017 18:12:01 -0500<br>
-Subject: Prevent bash from segfaulting when unloading pseudo<br>
-<br>
-bash&#39;s extremely fancy internal awareness of how the environment looks<br>
-means that, if you directly call the underlying libc &quot;unsetenv&quot; on<br>
-a variable, bash can end up trying to access a null pointer. Fixing<br>
-this generically is actually rather hard; you can&#39;t really avoid<br>
-writing to environ on fork() or popen(), even if you change all<br>
-execv*() functions to use the execv*e() variants. So for now, instead<br>
-of unsetting the variable, set it to an empty string.<br>
-<br>
-Thanks to Saur in IRC for spotting this and helping debug it.<br>
-<br>
-Signed-off-by: Seebs &lt;<a href="mailto:seebs@seebs.net">seebs@seebs.net</a>&gt;<br>
-<br>
-Upstream-Status: Backport<br>
-<br>
-diff --git a/ChangeLog.txt b/ChangeLog.txt<br>
-index a2d30e9..8ba1ffa 100644<br>
---- a/ChangeLog.txt<br>
-+++ b/ChangeLog.txt<br>
-@@ -1,3 +1,8 @@<br>
-+2017-04-13:<br>
-+      * (seebs) don&#39;t unset LD_PRELOAD or the like, because if you<br>
-+        do that, bash can segfault because it &quot;knows&quot; how many<br>
-+        fields are in environ.<br>
-+<br>
- 2017-02-24:<br>
-       * (seebs) import posix_acl_default fix from Anton Gerasimov<br>
-         &lt;<a href="mailto:anton@advancedtelematic.com">anton@advancedtelematic.com</a>&gt;<br>
-diff --git a/pseudo_util.c b/pseudo_util.c<br>
-index 172990b..6a1fac2 100644<br>
---- a/pseudo_util.c<br>
-+++ b/pseudo_util.c<br>
-@@ -844,7 +844,7 @@ void pseudo_dropenv() {<br>
-               if (ld_preload &amp;&amp; strlen(ld_preload)) {<br>
-                       SETENV(PRELINK_LIBRARIES, ld_preload, 1);<br>
-               } else {<br>
--                      UNSETENV(PRELINK_LIBRARIES);<br>
-+                      SETENV(PRELINK_LIBRARIES, &quot;&quot;, 1);<br>
-               }<br>
-       }<br>
- }<br>
---<br>
-cgit v0.10.2<br>
-<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/files/<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch b/meta/recipes-devtools/<wbr>pseudo/files/<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch<br>
deleted file mode 100644<br>
index 64fc58c4fe6..00000000000<br>
--- a/meta/recipes-devtools/<wbr>pseudo/files/<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch<br>
+++ /dev/null<br>
@@ -1,99 +0,0 @@<br>
-From efe0be279901006f939cd357ccee47<wbr>b651c786da Mon Sep 17 00:00:00 2001<br>
-From: Seebs &lt;<a href="mailto:seebs@seebs.net">seebs@seebs.net</a>&gt;<br>
-Date: Fri, 24 Feb 2017 12:47:38 -0600<br>
-Subject: Don&#39;t try to record 0-length posix_acl_default xattrs<br>
-<br>
-Based on a submission from Anton Gerasimov &lt;<a href="mailto:anton@advancedtelematic.com">anton@advancedtelematic.com</a>&gt;<br>
-<br>
-On some systems, with some kernel configs, &quot;cp -a&quot; apparently tries to<br>
-set an empty ACL list, with a valid header but no contents, which causes<br>
-strange and mysterious behavior later if we actually create such an entry.<br>
-So filter that out, also sanity-check a couple of other things.<br>
-<br>
-Signed-off-by: Seebs &lt;<a href="mailto:seebs@seebs.net">seebs@seebs.net</a>&gt;<br>
-<br>
-Upstream-Status: Backport<br>
-<br>
-diff --git a/ChangeLog.txt b/ChangeLog.txt<br>
-index ae2a6e9..a2d30e9 100644<br>
---- a/ChangeLog.txt<br>
-+++ b/ChangeLog.txt<br>
-@@ -1,3 +1,6 @@<br>
-+2017-02-24:<br>
-+      * (seebs) import posix_acl_default fix from Anton Gerasimov<br>
-+        &lt;<a href="mailto:anton@advancedtelematic.com">anton@advancedtelematic.com</a>&gt;<br>
- 2017-02-01:<br>
-    * (seebs) handle xattr deletion slightly more carefully.<br>
-    * (seebs) tag this as 1.8.2<br>
-diff --git a/ports/linux/xattr/pseudo_<wbr>wrappers.c b/ports/linux/xattr/pseudo_<wbr>wrappers.c<br>
-index 46bc053..d69d53e 100644<br>
---- a/ports/linux/xattr/pseudo_<wbr>wrappers.c<br>
-+++ b/ports/linux/xattr/pseudo_<wbr>wrappers.c<br>
-@@ -62,9 +62,9 @@ static int<br>
- posix_permissions(const acl_header *header, int entries, int *extra, int *mode) {<br>
-       int acl_seen = 0;<br>
-       if (le32(header-&gt;version) != 2) {<br>
--              pseudo_diag(&quot;Fatal: ACL support no available for header version %d.\n&quot;,<br>
-+              pseudo_diag(&quot;Fatal: ACL support not available for header version %d.\n&quot;,<br>
-                       le32(header-&gt;version));<br>
--              return 1;<br>
-+              return -1;<br>
-       }<br>
-       *mode = 0;<br>
-       *extra = 0;<br>
-@@ -140,12 +140,38 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi<br>
-       pseudo_debug(PDBGF_XATTR, &quot;setxattr(%s [fd %d], %s =&gt; &#39;%.*s&#39;)\n&quot;,<br>
-               path ? path : &quot;&lt;no path&gt;&quot;, fd, name, (int) size, (char *) value);<br>
-<br>
-+      /* Filter out erroneous sizes for POSIX ACL<br>
-+       *  see posix_acl_xattr_count in include/linux/posix_acl_xattr.<wbr>h of Linux source code */<br>
-+      /* I don&#39;t think there&#39;s any posix_acl_* values that aren&#39;t in this format */<br>
-+      if (!strncmp(name, &quot;system.posix_acl_&quot;, 17)) {<br>
-+              // ACL is corrupt, issue an error<br>
-+              if(size &lt; sizeof(acl_header) || (size - sizeof(acl_header)) % sizeof(acl_entry) != 0) {<br>
-+                      pseudo_debug(PDBGF_XATTR, &quot;invalid data size for %s: %d\n&quot;,<br>
-+                              name, (int) size);<br>
-+                      errno = EINVAL;<br>
-+                      return -1;<br>
-+              }<br>
-+<br>
-+              // ACL is empty, do nothing<br>
-+              if((size - sizeof(acl_header)) / sizeof(acl_entry) == 0) {<br>
-+                      /* on some systems, &quot;cp -a&quot; will attempt to clone the<br>
-+                       * posix_acl_default entry for a directory (which would specify<br>
-+                       * default ACLs for new files in that directory), but if the<br>
-+                       * original was empty, we get a header but no entries. With<br>
-+                       * real xattr, that ends up being silently discarded, apparently,<br>
-+                       * so we discard it too.<br>
-+                       */<br>
-+                      pseudo_debug(PDBGF_XATTR, &quot;0-length ACL entry %s.\n&quot;, name);<br>
-+                      return 0;<br>
-+              }<br>
-+      }<br>
-       /* this may be a plain chmod */<br>
-       if (!strcmp(name, &quot;system.posix_acl_access&quot;)) {<br>
-               int extra;<br>
-               int mode;<br>
-               int entries = (size - sizeof(acl_header)) / sizeof(acl_entry);<br>
--              if (!posix_permissions(value, entries, &amp;extra, &amp;mode)) {<br>
-+              int res = posix_permissions(value, entries, &amp;extra, &amp;mode);<br>
-+              if (res == 0) {<br>
-                       pseudo_debug(PDBGF_XATTR, &quot;posix_acl_access translated to mode %04o. Remaining attribute(s): %d.\n&quot;,<br>
-                               mode, extra);<br>
-                       buf.st_mode = mode;<br>
-@@ -164,8 +190,12 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi<br>
-                       if (!extra) {<br>
-                               return 0;<br>
-                       }<br>
-+              } else if (res == -1) {<br>
-+                      errno = EOPNOTSUPP;<br>
-+                      return -1;<br>
-               }<br>
-       }<br>
-+<br>
-       if (!strcmp(name, &quot;user.pseudo_data&quot;)) {<br>
-               pseudo_debug(PDBGF_XATTR | PDBGF_XATTRDB, &quot;user.pseudo_data xattribute does not get to go in database.\n&quot;);<br>
-               return -1;<br>
---<br>
-cgit v0.10.2<br>
-<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/files/fastopreply.patch b/meta/recipes-devtools/<wbr>pseudo/files/fastopreply.patch<br>
deleted file mode 100644<br>
index 904c2d04e6a..00000000000<br>
--- a/meta/recipes-devtools/<wbr>pseudo/files/fastopreply.patch<br>
+++ /dev/null<br>
@@ -1,76 +0,0 @@<br>
-Ensure FASTOP messages get an ACK reply so that the client can be sure the server<br>
-recieved them. This means if connections are terminated, data isn&#39;t lost.<br>
-<br>
-RP 2017/9/22<br>
-<br>
-Upstream-Status: Submitted<br>
-<br>
-Index: pseudo-1.8.2/pseudo_client.c<br>
-=============================<wbr>==============================<wbr>========<br>
---- pseudo-1.8.2.orig/pseudo_<wbr>client.c<br>
-+++ pseudo-1.8.2/pseudo_client.c<br>
-@@ -1331,21 +1331,19 @@ pseudo_client_request(pseudo_<wbr>msg_t *msg,<br>
-                * indicating a successful send.<br>
-                */<br>
-               pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, &quot;sent!\n&quot;);<br>
--              if (msg-&gt;type != PSEUDO_MSG_FASTOP) {<br>
--                      response = pseudo_msg_receive(connect_fd)<wbr>;<br>
--                      if (!response) {<br>
--                              pseudo_debug(PDBGF_CLIENT, &quot;expected response did not occur; retrying\n&quot;);<br>
-+              response = pseudo_msg_receive(connect_fd)<wbr>;<br>
-+              if (!response) {<br>
-+                      pseudo_debug(PDBGF_CLIENT, &quot;expected response did not occur; retrying\n&quot;);<br>
-+              } else {<br>
-+                      if (response-&gt;type != PSEUDO_MSG_ACK) {<br>
-+                              pseudo_debug(PDBGF_CLIENT, &quot;got non-ack response %d\n&quot;, response-&gt;type);<br>
-+                              return 0;<br>
-+                      } else if (msg-&gt;type != PSEUDO_MSG_FASTOP) {<br>
-+                              pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, &quot;got response type %d\n&quot;, response-&gt;type);<br>
-+                              return response;<br>
-                       } else {<br>
--                              if (response-&gt;type != PSEUDO_MSG_ACK) {<br>
--                                      pseudo_debug(PDBGF_CLIENT, &quot;got non-ack response %d\n&quot;, response-&gt;type);<br>
--                                      return 0;<br>
--                              } else {<br>
--                                      pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, &quot;got response type %d\n&quot;, response-&gt;type);<br>
--                                      return response;<br>
--                              }<br>
-+                              return 0;<br>
-                       }<br>
--              } else {<br>
--                      return 0;<br>
-               }<br>
-       }<br>
-       pseudo_diag(&quot;pseudo: server connection persistently failed, aborting.\n&quot;);<br>
-Index: pseudo-1.8.2/pseudo_server.c<br>
-=============================<wbr>==============================<wbr>========<br>
---- pseudo-1.8.2.orig/pseudo_<wbr>server.c<br>
-+++ pseudo-1.8.2/pseudo_server.c<br>
-@@ -463,6 +463,11 @@ close_client(int client) {<br>
-                       --highest_client;<br>
- }<br>
-<br>
-+static pseudo_msg_t server_fastop_reply = {<br>
-+        .type = PSEUDO_MSG_ACK,<br>
-+        .op = OP_NONE,<br>
-+};<br>
-+<br>
- /* Actually process a request.<br>
-  */<br>
- static int<br>
-@@ -515,8 +520,14 @@ serve_client(int i) {<br>
-                * pseudo_server_response.<br>
-                */<br>
-               if (in-&gt;type != PSEUDO_MSG_SHUTDOWN) {<br>
--                        if (in-&gt;type == PSEUDO_MSG_FASTOP)<br>
-+                        if (in-&gt;type == PSEUDO_MSG_FASTOP) {<br>
-                                 send_response = 0;<br>
-+                                /* For fastops we reply now to say we got the data */<br>
-+                                if ((rc = pseudo_msg_send(clients[i].fd, &amp;server_fastop_reply, 0, NULL)) != 0) {<br>
-+                                            pseudo_debug(PDBGF_SERVER, &quot;failed to send fastop ack to client %d [%d]: %d (%s)\n&quot;,<br>
-+                                                    i, (int) clients[i].pid, rc, strerror(errno));<br>
-+                                }<br>
-+                        }<br>
-                       /* most messages don&#39;t need these, but xattr may */<br>
-                       response_path = 0;<br>
-                       response_pathlen = -1;<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/files/toomanyfiles.<wbr>patch b/meta/recipes-devtools/<wbr>pseudo/files/toomanyfiles.<wbr>patch<br>
index b085a4505d5..bda7e4b2026 100644<br>
--- a/meta/recipes-devtools/<wbr>pseudo/files/toomanyfiles.<wbr>patch<br>
+++ b/meta/recipes-devtools/<wbr>pseudo/files/toomanyfiles.<wbr>patch<br>
@@ -1,3 +1,8 @@<br>
+From b0b25fbc041a148d1de09f5a6503cd<wbr>95973ec77c Mon Sep 17 00:00:00 2001<br>
+From: Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@<wbr>linuxfoundation.org</a>&gt;<br>
+Date: Tue, 25 Apr 2017 15:25:54 +0100<br>
+Subject: [PATCH 3/3] pseudo: Handle too many files deadlock<br>
+<br>
 Currently if we max out the maximum number of files, pseudo can deadlock, unable to<br>
 accept new connections yet unable to move forward and unblock the other processes<br>
 waiting either.<br>
@@ -11,19 +16,23 @@ RP<br>
<br>
 Upstream-Status: Submitted [Peter is aware of the issue]<br>
<br>
-Index: pseudo-1.8.2/pseudo_server.c<br>
-=============================<wbr>==============================<wbr>========<br>
---- pseudo-1.8.2.orig/pseudo_<wbr>server.c<br>
-+++ pseudo-1.8.2/pseudo_server.c<br>
-@@ -581,6 +581,7 @@ pseudo_server_loop(void) {<br>
-       int rc;<br>
-       int fd;<br>
-       int loop_timeout = pseudo_server_timeout;<br>
+---<br>
+ pseudo_server.c | 10 ++++++++++<br>
+ 1 file changed, 10 insertions(+)<br>
+<br>
+diff --git a/pseudo_server.c b/pseudo_server.c<br>
+index dac3258..15a3e8f 100644<br>
+--- a/pseudo_server.c<br>
++++ b/pseudo_server.c<br>
+@@ -802,6 +802,7 @@ pseudo_server_loop(void) {<br>
+       struct sigaction eat_usr2 = {<br>
+               .sa_handler = set_do_list_clients<br>
+       };<br>
 +      int hitmaxfiles;<br>
<br>
        clients = malloc(16 * sizeof(*clients));<br>
<br>
-@@ -597,6 +598,7 @@ pseudo_server_loop(void) {<br>
+@@ -820,6 +821,7 @@ pseudo_server_loop(void) {<br>
        active_clients = 1;<br>
        max_clients = 16;<br>
        highest_client = 0;<br>
@@ -31,9 +40,9 @@ Index: pseudo-1.8.2/pseudo_server.c<br>
<br>
        pseudo_debug(PDBGF_SERVER, &quot;server loop started.\n&quot;);<br>
        if (listen_fd &lt; 0) {<br>
-@@ -663,10 +665,15 @@ pseudo_server_loop(void) {<br>
-                                               message_time.tv_usec -= 1000000;<br>
-                                               ++message_time.tv_sec;<br>
+@@ -878,10 +880,15 @@ pseudo_server_loop(void) {<br>
+                                       } else {<br>
+                                               serve_client(i);<br>
                                        }<br>
 +                              } else if (hitmaxfiles) {<br>
 +                                      /* Only close one per loop iteration in the interests of caution */<br>
@@ -47,13 +56,16 @@ Index: pseudo-1.8.2/pseudo_server.c<br>
                        if (!die_forcefully &amp;&amp;<br>
                            (FD_ISSET(clients[0].fd, &amp;events) ||<br>
                             FD_ISSET(clients[0].fd, &amp;reads))) {<br>
-@@ -688,6 +698,9 @@ pseudo_server_loop(void) {<br>
-                                          */<br>
-                                         pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;<br>
-                                         die_peacefully = 0;<br>
+@@ -903,6 +910,9 @@ pseudo_server_loop(void) {<br>
+                                        */<br>
+                                       pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;<br>
+                                       die_peacefully = 0;<br>
 +                              } else if (errno == EMFILE) {<br>
 +                                      hitmaxfiles = 1;<br>
 +                                      pseudo_debug(PDBGF_SERVER, &quot;Hit max open files, dropping a client.\n&quot;);<br>
                                }<br>
                        }<br>
                        pseudo_debug(PDBGF_SERVER, &quot;server loop complete [%d clients left]\n&quot;, active_clients);<br>
+--<br>
+2.15.1<br>
+<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/pseudo.inc b/meta/recipes-devtools/<wbr>pseudo/pseudo.inc<br>
index 18ce9f92596..fb742522f50 100644<br>
--- a/meta/recipes-devtools/<wbr>pseudo/pseudo.inc<br>
+++ b/meta/recipes-devtools/<wbr>pseudo/pseudo.inc<br>
@@ -26,7 +26,7 @@ do_configure () {<br>
 NO32LIBS ??= &quot;1&quot;<br>
 NO32LIBS_class-nativesdk = &quot;1&quot;<br>
<br>
-PSEUDO_EXTRA_OPTS ?= &quot;--enable-force-async --without-passwd-fallback&quot;<br>
+PSEUDO_EXTRA_OPTS ?= &quot;--enable-force-async --without-passwd-fallback --enable-epoll&quot;<br>
<br>
 # Compile for the local machine arch...<br>
 do_compile () {<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_1.8.2.bb" rel="noreferrer" target="_blank">pseudo_1.8.2.bb</a> b/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_1.8.2.bb" rel="noreferrer" target="_blank">pseudo_1.8.2.bb</a><br>
deleted file mode 100644<br>
index 73ef57231a0..00000000000<br>
--- a/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_1.8.2.bb" rel="noreferrer" target="_blank">pseudo_1.8.2.bb</a><br>
+++ /dev/null<br>
@@ -1,16 +0,0 @@<br>
-require pseudo.inc<br>
-<br>
-SRC_URI = &quot;<a href="http://downloads.yoctoproject.org/releases/pseudo/${BPN}-${PV}.tar.bz2" rel="noreferrer" target="_blank">http://downloads.<wbr>yoctoproject.org/releases/<wbr>pseudo/${BPN}-${PV}.tar.bz2</a> \<br>
-           file://0001-configure-Prune-<wbr>PIE-flags.patch \<br>
-           file://fallback-passwd \<br>
-           file://fallback-group \<br>
-           file://moreretries.patch \<br>
-           file://<wbr>efe0be279901006f939cd357ccee47<wbr>b651c786da.patch \<br>
-           file://<wbr>b6b68db896f9963558334aff7fca61<wbr>adde4ec10f.patch \<br>
-           file://fastopreply.patch \<br>
-           file://toomanyfiles.patch \<br>
-           file://0001-Use-epoll-API-on-<wbr>Linux.patch \<br>
-           &quot;<br>
-<br>
-SRC_URI[md5sum] = &quot;<wbr>7d41e72188fbea1f696c399c1a4356<wbr>75&quot;<br>
-SRC_URI[sha256sum] = &quot;<wbr>ceb456bd47770a37ca20784a91d715<wbr>c5a7601e07e26ab11b0c77e9203ed3<wbr>d196&quot;<br>
diff --git a/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_git.bb" rel="noreferrer" target="_blank">pseudo_git.bb</a> b/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_git.bb" rel="noreferrer" target="_blank">pseudo_git.bb</a><br>
index 42c7b2ea572..ac9bd079f8b 100644<br>
--- a/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_git.bb" rel="noreferrer" target="_blank">pseudo_git.bb</a><br>
+++ b/meta/recipes-devtools/<wbr>pseudo/<a href="http://pseudo_git.bb" rel="noreferrer" target="_blank">pseudo_git.bb</a><br>
@@ -1,15 +1,14 @@<br>
 require pseudo.inc<br>
<br>
-SRCREV = &quot;<wbr>02168305b0a19f981ffe857f36eb25<wbr>6ba8810b77&quot;<br>
-PV = &quot;1.8.2+git${SRCPV}&quot;<br>
-<br>
-DEFAULT_PREFERENCE = &quot;-1&quot;<br>
-<br>
 SRC_URI = &quot;git://<a href="http://git.yoctoproject.org/pseudo" rel="noreferrer" target="_blank">git.yoctoproject.org/<wbr>pseudo</a> \<br>
            file://0001-configure-Prune-<wbr>PIE-flags.patch \<br>
            file://fallback-passwd \<br>
            file://fallback-group \<br>
-           file://moreretries.patch&quot;<br>
+           file://moreretries.patch \<br>
+           file://toomanyfiles.patch \<br>
+           &quot;<br>
<br>
+SRCREV = &quot;<wbr>b6a015aa91d7ab84c2f5466f3b5704<wbr>f501129cbc&quot;<br>
 S = &quot;${WORKDIR}/git&quot;<br>
+PV = &quot;1.9.0+git${SRCPV}&quot;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.15.1<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>