rngd: fix --debug to also filter syslog() calls
PATCH 1/1 rngd: fix --debug to also filter syslog() calls
From: Yann Dirson <[email protected]>
Debug logs were only controlled by --debug flag while in --foreground mode. In --daemon mode (the default for us) /var/log/message got stuffed with details of entropy pool refilling, which is useless in production, and hamful when log rotation then gets rid of the more useful logs.
This change makes the two modes consistently only produce debug logs when --debug is specified.
--- .../rng-tools/rngd-debug-filter.patch | 22 +++++++++++++++++++ .../rng-tools/rng-tools_6.10.bb | 1 + 2 files changed, 23 insertions(+) create mode 100644 meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +22 -0
@@ -0,0 +1,22 @@ +Index: git/rngd.h +=================================================================== +--- git.orig/rngd.h ++++ git/rngd.h +@@ -145,13 +145,13 @@ extern bool quiet; + #define message(priority,fmt,args...) do { \ + if (quiet) \ + break;\ ++ if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \ ++ break;\ + if (am_daemon) { \ + syslog((priority), fmt, ##args); \ + } else if (!msg_squash) { \ +- if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug == true)) {\ +- fprintf(stderr, fmt, ##args); \ +- fflush(stderr); \ +- } \ ++ fprintf(stderr, fmt, ##args); \ ++ fflush(stderr); \ + } \ + } while (0) +
meta/recipes-support/rng-tools/rng-tools_6.10.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI = "\ git://github.com/nhorman/rng-tools.git \ file://a4b6d9ce64f132e463b9091d0536913ddaf11516.patch \ file://dab16a5fd4efde8ef569b358e19b1fcbc7d0d938.patch \ + file://rngd-debug-filter.patch \ file://init \ file://default \ file://rngd.service \
Signature · 1 line
2.28.0
Quoted 20 lines · Yann Dirson
From: Yann Dirson <[email protected]>
Debug logs were only controlled by --debug flag while in --foreground mode. In --daemon mode (the default for us)
/var/log/messagegot stuffed with details of entropy pool refilling, which is useless in production, and hamful when log rotation then gets rid of the more useful logs.This change makes the two modes consistently only produce debug logs when --debug is specified.
Signed-off-by Yann Dirson <[email protected]>--- .../rng-tools/rngd-debug-filter.patch | 22 +++++++++++++++++++ .../rng-tools/rng-tools_6.10.bb | 1 + 2 files changed, 23 insertions(+) create mode 100644 meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchmeta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +0
-0
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
Quoted 1 line
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +0
-1--- /dev/null
This patch has no description, author or Upstream-Status: information in it. It needs such information to be considered. It would be helpful if the change was submitted upstream too, not sure if you've looked at that? We try not to carry patches if we can.
Cheers,
Richard
Quoted 38 lines
+++
b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchmeta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +22
-0@@ -0,0 +1,22 @@ +Index: git/rngd.h +=================================================================== +--- git.orig/rngd.h ++++ git/rngd.h +@@ -145,13 +145,13 @@ extern bool quiet; + #define message(priority,fmt,args...) do { \ + if (quiet) \ + break;\ ++ if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \ ++ break;\ + if (am_daemon) { \ + syslog((priority), fmt, ##args); \ + } else if (!msg_squash) { \ +- if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug == true)) {\ +- fprintf(stderr, fmt, ##args); \ +- fflush(stderr); \ +- } \ ++ fprintf(stderr, fmt, ##args); \ ++ fflush(stderr); \ + } \ + } while (0) +meta/recipes-support/rng-tools/rng-tools_6.10.bb +1
-0@@ -12,6 +12,7 @@ SRC_URI = "\ git://github.com/nhorman/rng-tools.git \ file://a4b6d9ce64f132e463b9091d0536913ddaf11516.patch \ file://dab16a5fd4efde8ef569b358e19b1fcbc7d0d938.patch \ + file://rngd-debug-filter.patch \ file://init \ file://default \ file://rngd.service \
Quoted 28 lines · Richard Purdie
Quoted 3 lines · Yann Dirson
From: Yann Dirson <[email protected]>
Debug logs were only controlled by --debug flag while in --foreground
mode.
Quoted 7 lines
In --daemon mode (the default for us)
/var/log/messagegot stuffed with details of entropy pool refilling, which is useless in production, and hamful when log rotation then gets rid of the more useful logs.This change makes the two modes consistently only produce debug logs when --debug is specified.
Quoted 6 lines
Signed-off-by Yann Dirson <[email protected]>--- .../rng-tools/rngd-debug-filter.patch | 22 +++++++++++++++++++ .../rng-tools/rng-tools_6.10.bb | 1 + 2 files changed, 23 insertions(+) create mode 100644
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchQuoted 2 lines
diff --git
a/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchb/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchQuoted 3 lines
new file mode 100644
index 0000000000..320f0257e6
---/dev/null
Quoted 5 lines
This patch has no description, author or Upstream-Status: information in it. It needs such information to be considered. It would be helpful if the change was submitted upstream too, not sure if you've looked at that? We try not to carry patches if we can.
Lignthnig-speed upstream merged the patch after I re-rolled, is it worth a v3 tagged "accepted" ?
Quoted 46 lines
Cheers,
Richard
Quoted 6 lines
+++
b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patchmeta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +4
-0@@ -0,0 +1,22 @@ +Index: git/rngd.h +=================================================================== +--- git.orig/rngd.h ++++ git/rngd.hmeta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch line 14
Quoted 10 lines
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +10
-0+@@ -145,13 +145,13 @@ extern bool quiet; + #define message(priority,fmt,args...) do { \ + if (quiet) \ + break;\ ++ if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \ ++ break;\ + if (am_daemon) { \ + syslog((priority), fmt, ##args); \ + } else if (!msg_squash) { \ +- if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug== true)) {\
Review
Quoted 9 lines
meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch new file +8
-0+- fprintf(stderr, fmt, ##args); \ +- fflush(stderr); \ +- } \ ++ fprintf(stderr, fmt, ##args); \ ++ fflush(stderr); \ + } \ + } while (0) +(quoted diff) +0
-0b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
Quoted 13 lines
index
3f9720e406..98fb7aa775100644meta/recipes-support/rng-tools/rng-tools_6.10.bb +1
-0@@ -12,6 +12,7 @@ SRC_URI = "\ git://github.com/nhorman/rng-tools.git \ file://a4b6d9ce64f132e463b9091d0536913ddaf11516.patch \ file://dab16a5fd4efde8ef569b358e19b1fcbc7d0d938.patch \ + file://rngd-debug-filter.patch \ file://init \ file://default \ file://rngd.service \
Signature · 2 lines
Yann Dirson <[email protected]> Blade / Shadow -- http://shadow.tech
Quoted 44 lines · Yann Dirson
Quoted 32 lines · Richard Purdie
Quoted 3 lines · Yann Dirson
From: Yann Dirson <[email protected]>
Debug logs were only controlled by --debug flag while in --
foreground mode.
Quoted 1 line
In --daemon mode (the default for us)
/var/log/messagegotstuffed with
Quoted 1 line
details of entropy pool refilling, which is useless in
production, and
Quoted 3 lines
hamful when log rotation then gets rid of the more useful logs.
This change makes the two modes consistently only produce debug
logs when
Quoted 5 lines
--debug is specified.
Signed-off-by Yann Dirson <[email protected]>--- .../rng-tools/rngd-debug-filter.patch | 22+++++++++++++++++++
Quoted 3 lines
.../rng-tools/rng-tools_6.10.bb | 1 + 2 files changed, 23 insertions(+) create mode 100644 meta/recipes-support/rng-tools/rng-
tools/rngd-debug-filter.patchReview
Quoted 2 lines
(quoted diff) +0
-0filter.patch b/meta/recipes-support/rng-tools/rng-tools/rngd-debug- filter.patch
Quoted 3 lines
new file mode 100644
index 0000000000..320f0257e6
---/dev/nullQuoted 7 lines
This patch has no description, author or Upstream-Status:
information
in it. It needs such information to be considered. It would be helpful
if the change was submitted upstream too, not sure if you've looked at
that? We try not to carry patches if we can.
Quoted 2 lines
Lignthnig-speed upstream merged the patch after I re-rolled, is it worth a v3 tagged "accepted" ?
Please, it can be "Backport" now since it is!
Thanks for sending it, saves us carrying the patch and helps upstream too.
Cheers,
Richard