diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-09-27 22:35:06 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-30 17:14:10 +0100 |
commit | efd0b0f604f9f498b9c20bc9a25708c493aa4f4a (patch) | |
tree | 2f42bb5c56684b701c9393ce4694892837525a34 /meta/recipes-devtools/pseudo | |
parent | 57dd9e8b5bb5e32973d4648792758e59f7cfe7a4 (diff) | |
download | openembedded-core-contrib-efd0b0f604f9f498b9c20bc9a25708c493aa4f4a.tar.gz |
pseudo: quiet diagnostics during startup for pseudo -d
When the client spawns a pseudo server, it starts out sending diagnostics
to stderr. This can be spammy in some cases with races during startup;
everything resolves, but we get scary-looking diagnostics. So shove
those into a log file.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'meta/recipes-devtools/pseudo')
3 files changed, 109 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0001-Quiet-diagnostics-during-startup-for-pseudo-d.patch b/meta/recipes-devtools/pseudo/files/0001-Quiet-diagnostics-during-startup-for-pseudo-d.patch new file mode 100644 index 00000000000..d4b9f6a0f8d --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/0001-Quiet-diagnostics-during-startup-for-pseudo-d.patch @@ -0,0 +1,54 @@ +From eead8a505245a292c43f070c0e836cdfeb7bd7bd Mon Sep 17 00:00:00 2001 +From: Seebs <seebs@seebs.net> +Date: Wed, 28 Sep 2016 17:05:17 -0500 +Subject: [PATCH 1/2] Quiet diagnostics during startup for pseudo -d + +When the client spawns a pseudo server, it starts out sending diagnostics +to stderr. This can be spammy in some cases with races during startup; +everything resolves, but we get scary-looking diagnostics. So shove +those into a log file. + +Signed-off-by: Seebs <seebs@seebs.net> + +Upstream-Status: Backport +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +--- + ChangeLog.txt | 5 +++++ + pseudo_server.c | 4 +++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog.txt b/ChangeLog.txt +index d6359ca..4cc24de 100644 +--- a/ChangeLog.txt ++++ b/ChangeLog.txt +@@ -1,3 +1,8 @@ ++2016-09-28: ++ * (seebs) Send errors to log when daemonizing, but do that a lot ++ sooner to prevent startup messages which can show up spuriously ++ with multiple clients. ++ + 2016-07-28: + * (seebs) Fix performance issue on deletion with xattr changes. + +diff --git a/pseudo_server.c b/pseudo_server.c +index 8731d20..7c2db2f 100644 +--- a/pseudo_server.c ++++ b/pseudo_server.c +@@ -162,6 +162,9 @@ pseudo_server_start(int daemonize) { + * SIGUSR1, or until too much time has passed. */ + if (daemonize) { + int child; ++ ++ /* make startup messages go away when invoked-as-daemon */ ++ pseudo_debug_logfile(PSEUDO_LOGFILE, 2); + child = fork(); + if (child == -1) { + pseudo_diag("Couldn't fork child process: %s\n", +@@ -231,7 +234,6 @@ pseudo_server_start(int daemonize) { + setsid(); + fclose(stdin); + fclose(stdout); +- pseudo_debug_logfile(PSEUDO_LOGFILE, 2); + /* and then just execute the server code normally. */ + /* Any logging will presumably go to logfile, but + * exit status will make it back to the parent for diff --git a/meta/recipes-devtools/pseudo/files/0002-Use-correct-file-descriptor.patch b/meta/recipes-devtools/pseudo/files/0002-Use-correct-file-descriptor.patch new file mode 100644 index 00000000000..dd6fd87ae9b --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/0002-Use-correct-file-descriptor.patch @@ -0,0 +1,53 @@ +From 7a0632cad851826d804db0540d9a59773e6bf29c Mon Sep 17 00:00:00 2001 +From: Seebs <seebs@seebs.net> +Date: Wed, 28 Sep 2016 22:12:29 -0500 +Subject: [PATCH 2/2] Use correct file descriptor + +So it turns out that pseudo_logfile() was returning 0 or -1, and +pseudo_debug_logfile() was expecting it to be the correct file descriptor +to use. And it's basically a mystery that any of that ever worked. + +Signed-off-by: Seebs <seebs@seebs.net> + +Upstream-Status: Backport +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +--- + ChangeLog.txt | 3 +++ + pseudo_util.c | 3 ++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog.txt b/ChangeLog.txt +index 4cc24de..49a6c36 100644 +--- a/ChangeLog.txt ++++ b/ChangeLog.txt +@@ -2,6 +2,9 @@ + * (seebs) Send errors to log when daemonizing, but do that a lot + sooner to prevent startup messages which can show up spuriously + with multiple clients. ++ * (seebs) return file descriptor from pseudo_logfile, so we set ++ pseudo_util_debug_fd to the right value instead of to stdin. ++ Nice bug. + + 2016-07-28: + * (seebs) Fix performance issue on deletion with xattr changes. +diff --git a/pseudo_util.c b/pseudo_util.c +index 0c156cf..a60c74b 100644 +--- a/pseudo_util.c ++++ b/pseudo_util.c +@@ -1569,7 +1569,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) { + if (fd == -1) + return -1; + else +- return 0; ++ return fd; + } + + int +@@ -1579,6 +1579,7 @@ pseudo_debug_logfile(char *defname, int prefer_fd) { + + fd = pseudo_logfile(filename, defname, prefer_fd); + if (fd > -1) { ++ pseudo_diag("debug_logfile: fd %d\n", fd); + pseudo_util_debug_fd = fd; + return 0; + } diff --git a/meta/recipes-devtools/pseudo/pseudo_1.8.1.bb b/meta/recipes-devtools/pseudo/pseudo_1.8.1.bb index cec214986e1..67eb298b22e 100644 --- a/meta/recipes-devtools/pseudo/pseudo_1.8.1.bb +++ b/meta/recipes-devtools/pseudo/pseudo_1.8.1.bb @@ -7,6 +7,8 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/pseudo/${BPN}-${PV}.tar.bz file://moreretries.patch \ file://Fix-xattr-performance.patch \ file://0001-Don-t-send-SIGUSR1-to-init.patch \ + file://0001-Quiet-diagnostics-during-startup-for-pseudo-d.patch \ + file://0002-Use-correct-file-descriptor.patch \ " SRC_URI[md5sum] = "ee38e4fb62ff88ad067b1a5a3825bac7" |