[oe-commits] [openembedded-core] 01/01: pseudo: Test upgrade
git at git.openembedded.org
git at git.openembedded.org
Mon Apr 2 13:29:18 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 90c45a9602941cc07544be286cf4416db46f434c
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Fri Mar 30 14:18:57 2018 +0100
pseudo: Test upgrade
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/recipes-devtools/pseudo/files/gistfile1.patch | 82 +++++++++
.../pseudo/files/revert-patch-handling.patch | 195 +++++++++++++++++++++
meta/recipes-devtools/pseudo/pseudo_git.bb | 3 +-
3 files changed, 279 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/pseudo/files/gistfile1.patch b/meta/recipes-devtools/pseudo/files/gistfile1.patch
new file mode 100644
index 0000000..83f98a4
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/gistfile1.patch
@@ -0,0 +1,82 @@
+diff --git a/pseudo_server.c b/pseudo_server.c
+index 7c2db2f..68433b3 100644
+--- a/pseudo_server.c
++++ b/pseudo_server.c
+@@ -62,6 +62,7 @@ static int active_clients = 0, highest_client = 0, max_clients = 0;
+ int pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;
+ static int die_peacefully = 0;
+ static int die_forcefully = 0;
++static sig_atomic_t do_list_clients = 0;
+
+ /* when the client is linked with pseudo_wrappers, these are defined there.
+ * when it is linked with pseudo_server, though, we have to provide different
+@@ -77,6 +78,11 @@ quit_now(int signal) {
+ die_forcefully = 1;
+ }
+
++static void
++set_do_list_clients(int sig) {
++ do_list_clients = sig;
++}
++
+ static int messages = 0, responses = 0;
+ static struct timeval message_time = { .tv_sec = 0 };
+
+@@ -581,9 +587,14 @@ pseudo_server_loop(void) {
+ int rc;
+ int fd;
+ int loop_timeout = pseudo_server_timeout;
++ struct sigaction eat_usr2 = {
++ .sa_handler = set_do_list_clients
++ };
+
+ clients = malloc(16 * sizeof(*clients));
+
++ sigaction(SIGUSR2, &eat_usr2, NULL);
++
+ clients[0].fd = listen_fd;
+ clients[0].pid = getpid();
+
+@@ -616,7 +627,12 @@ pseudo_server_loop(void) {
+ /* EINTR tends to come from profiling, so it is not a good reason to
+ * exit; other signals are caught and set the flag causing a graceful
+ * exit. */
++ sigset_t maskusr2;
++ sigemptyset(&maskusr2);
++ sigaddset(&maskusr2, SIGUSR2);
++ sigprocmask(SIG_BLOCK, &maskusr2, NULL);
+ while ((rc = select(max_fd + 1, &reads, &writes, &events, &timeout)) >= 0 || (errno == EINTR)) {
++ sigprocmask(SIG_UNBLOCK, &maskusr2, NULL);
+ if (rc == 0 || (rc == -1 && errno == EINTR)) {
+ /* If there's no clients, start timing out. If there
+ * are active clients, never time out.
+@@ -692,6 +708,21 @@ pseudo_server_loop(void) {
+ }
+ pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients);
+ }
++ if (do_list_clients) {
++ do_list_clients = 0;
++ pseudo_diag("listing clients [1 through %d]:\n", highest_client);
++ for (i = 1; i <= highest_client; ++i) {
++ if (clients[i].fd == -1) {
++ pseudo_diag("client %4d: inactive.\n", i);
++ continue;
++ }
++ pseudo_diag("client %4d: fd %4d, pid %5d, state %s, program %s\n",
++ i, clients[i].fd, clients[i].pid,
++ FD_ISSET(clients[i].fd, &reads) ? "R" : "-",
++ clients[i].program ? clients[i].program : "<unspecified>");
++ }
++ pseudo_diag("done.\n");
++ }
+ if (die_peacefully || die_forcefully) {
+ pseudo_debug(PDBGF_SERVER, "quitting.\n");
+ pseudo_debug(PDBGF_SERVER | PDBGF_BENCHMARK, "server %d exiting: handled %d messages in %.4f seconds\n",
+@@ -735,6 +766,7 @@ pseudo_server_loop(void) {
+ }
+ /* reinitialize timeout because Linux select alters it */
+ timeout = (struct timeval) { .tv_sec = LOOP_DELAY, .tv_usec = 0 };
++ sigprocmask(SIG_BLOCK, &maskusr2, NULL);
+ }
+ pseudo_diag("select failed: %s\n", strerror(errno));
+ }
diff --git a/meta/recipes-devtools/pseudo/files/revert-patch-handling.patch b/meta/recipes-devtools/pseudo/files/revert-patch-handling.patch
new file mode 100644
index 0000000..1834117
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/revert-patch-handling.patch
@@ -0,0 +1,195 @@
+diff --git a/ChangeLog.txt b/ChangeLog.txt
+index b4a76ac..39744aa 100644
+--- a/ChangeLog.txt
++++ b/ChangeLog.txt
+@@ -6,12 +6,6 @@
+ pointless when glibc hasn't got a wrapper so we have no
+ viable test cases.
+
+-2018-03-06:
+- * (seebs) Update path handling a bit to correctly fail if a path
+- tries to have a slash after a plain file name, even in cases
+- like "foo/.", which were previously ignored (or in the case of
+- "..", resolved as though it had been a directory).
+-
+ 2018-03-01:
+ * (seebs) If you get a CREAT for an existing file, and it matches
+ both path and inode, don't delete the entry because the inode
+diff --git a/pseudo_util.c b/pseudo_util.c
+index addf503..6a1fac2 100644
+--- a/pseudo_util.c
++++ b/pseudo_util.c
+@@ -265,7 +265,7 @@ int pseudo_util_evlog_fd = 2;
+ static int debugged_newline = 1;
+ static char pid_text[32];
+ static size_t pid_len;
+-static int pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurrent, const char *element, size_t elen, PSEUDO_STATBUF *buf, int leave_this);
++static int pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurrent, const char *element, size_t elen, int leave_this);
+ static int pseudo_append_elements(char *newpath, char *root, size_t allocated, char **current, const char *elements, size_t elen, int leave_last);
+ extern char **environ;
+ static ssize_t pseudo_max_pathlen = -1;
+@@ -618,11 +618,11 @@ pseudo_new_pid() {
+ * the symlink, appending each element in turn the same way.
+ */
+ static int
+-pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurrent, const char *element, size_t elen, PSEUDO_STATBUF *buf, int leave_this) {
++pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurrent, const char *element, size_t elen, int leave_this) {
+ static int link_recursion = 0;
+ size_t curlen;
+- int is_reg = S_ISREG(buf->st_mode);
+ char *current;
++ PSEUDO_STATBUF buf;
+ if (!newpath ||
+ !pcurrent || !*pcurrent ||
+ !root || !element) {
+@@ -630,31 +630,25 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
+ return -1;
+ }
+ current = *pcurrent;
+- /* the special cases here to skip empty paths, or ./.., should not
+- * apply to plain files, which should just get bogus
+- * paths.
+- */
+- if (!is_reg) {
+- /* sanity-check: ignore // or /./ */
+- if (elen == 0 || (elen == 1 && *element == '.')) {
+- return 1;
+- }
+- /* backtrack for .. */
+- if (elen == 2 && element[0] == '.' && element[1] == '.') {
+- /* if newpath's whole contents are '/', do nothing */
+- if (current <= root + 1)
+- return 1;
+- /* backtrack to the character before the / */
+- current -= 2;
+- /* now find the previous slash */
+- while (current > root && *current != '/') {
+- --current;
+- }
+- /* and point to the nul just past it */
+- *(++current) = '\0';
+- *pcurrent = current;
++ /* sanity-check: ignore // or /./ */
++ if (elen == 0 || (elen == 1 && *element == '.')) {
++ return 1;
++ }
++ /* backtrack for .. */
++ if (elen == 2 && element[0] == '.' && element[1] == '.') {
++ /* if newpath's whole contents are '/', do nothing */
++ if (current <= root + 1)
+ return 1;
++ /* backtrack to the character before the / */
++ current -= 2;
++ /* now find the previous slash */
++ while (current > root && *current != '/') {
++ --current;
+ }
++ /* and point to the nul just past it */
++ *(++current) = '\0';
++ *pcurrent = current;
++ return 1;
+ }
+ curlen = current - newpath;
+ /* current length, plus / <element> / \0 */
+@@ -665,20 +659,13 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
+ }
+ memcpy(current, element, elen);
+ current += elen;
+- /* nul-terminate, and we now point to the nul after the element just added. */
++ /* nul-terminate, and we now point to the nul after the slash */
+ *current = '\0';
+ /* now, the moment of truth... is that a symlink? */
+ /* if lstat fails, that's fine -- nonexistent files aren't symlinks */
+- /* don't do this if the parent was a regular file. it shouldn't matter,
+- * because readlink can't succeed in that case anyway.
+- */
+- if (!leave_this && !is_reg) {
+- /* if this fails, just use the parent's mode. which shouldn't have
+- * been a symlink, I hope? */
+- if (pseudo_real_lstat) {
+- pseudo_real_lstat(newpath, buf);
+- }
+- int is_link = S_ISLNK(buf->st_mode);
++ if (!leave_this) {
++ int is_link;
++ is_link = (pseudo_real_lstat) && (pseudo_real_lstat(newpath, &buf) != -1) && S_ISLNK(buf.st_mode);
+ if (link_recursion >= PSEUDO_MAX_LINK_RECURSION && is_link) {
+ pseudo_diag("link recursion too deep, not expanding path '%s'.\n", newpath);
+ is_link = 0;
+@@ -712,9 +699,9 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
+ return retval;
+ }
+ }
+- /* we used to always append a slash here. now we don't; append_elements
+- * handles slashes, so just update the pointer.
+- */
++ /* okay, not a symlink, go ahead and append a slash */
++ *(current++) = '/';
++ *current = '\0';
+ *pcurrent = current;
+ return 1;
+ }
+@@ -722,8 +709,6 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
+ static int
+ pseudo_append_elements(char *newpath, char *root, size_t allocated, char **current, const char *element, size_t elen, int leave_last) {
+ int retval = 1;
+- PSEUDO_STATBUF buf;
+- buf.st_mode = 0;
+ const char * start = element;
+ if (!newpath || !root ||
+ !current || !*current ||
+@@ -731,41 +716,30 @@ pseudo_append_elements(char *newpath, char *root, size_t allocated, char **curre
+ pseudo_diag("pseudo_append_elements: invalid arguments.");
+ return -1;
+ }
+- /* coming into append_elements, we should always have a trailing slash on
+- * the path. append_element won't provide one, though.
+- */
+ while (element < (start + elen) && *element) {
+ size_t this_elen;
+ int leave_this = 0;
+- int is_reg = S_ISREG(buf.st_mode);
+ char *next = strchr(element, '/');
+ if (!next) {
+ next = strchr(element, '\0');
+ leave_this = leave_last;
+ }
+ this_elen = next - element;
+- /* for an empty path, or a "/.", we skip the append, but not for regular
+- * files; regular files get it appended so they can fail properly
+- * later for being invalid paths.
+- */
+- if (is_reg || (this_elen > 1) || ((this_elen == 1) && (*element != '.'))) {
+- if (pseudo_append_element(newpath, root, allocated, current, element, this_elen, &buf, leave_this) == -1) {
+- retval = -1;
+- break;
++ switch (this_elen) {
++ case 0: /* path => '/' */
++ break;
++ case 1: /* path => '?/' */
++ if (*element != '.') {
++ if (pseudo_append_element(newpath, root, allocated, current, element, this_elen, leave_this) == -1) {
++ retval = -1;
++ }
+ }
+- /* if a path element was appended, we want to know whether the resulting
+- * thing is an existing regular file; regular files can't be further
+- * explored, which actually means we *do* append path things to them
+- * that would otherwise be skipped.
+- */
+- if (!pseudo_real_lstat || (pseudo_real_lstat(newpath, &buf) == -1)) {
+- buf.st_mode = 0;
++ break;
++ default:
++ if (pseudo_append_element(newpath, root, allocated, current, element, this_elen, leave_this) == -1) {
++ retval = -1;
+ }
+- /* having grabbed a stat for the path, we append a slash so we can append to it again
+- * if needed.
+- */
+- *(*current)++ = '/';
+- *(*current) = '\0';
++ break;
+ }
+ /* and now move past the separator */
+ element += this_elen + 1;
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 66da1cc..28210a3 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -6,9 +6,10 @@ SRC_URI = "git://git.yoctoproject.org/pseudo \
file://fallback-group \
file://moreretries.patch \
file://toomanyfiles.patch \
+ file://revert-patch-handling.patch \
"
-SRCREV = "d7c31a25e4b02af0c64e6be0b4b0a9ac4ffc9da2"
+SRCREV = "19f18124f16c4c85405b140a1fb8cb3b31d865bf"
S = "${WORKDIR}/git"
PV = "1.9.0+git${SRCPV}"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list