All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rngd: fix --debug to also filter syslog() calls
@ 2020-10-09  8:55 Yann Dirson
  2020-10-09 13:00 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Dirson @ 2020-10-09  8:55 UTC (permalink / raw)
  To: openembedded-core; +Cc: Yann Dirson

From: Yann Dirson <yann@blade-group.com>

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.

Signed-off-by: Yann Dirson <yann@blade-group.com>
---
 .../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

diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
new file mode 100644
index 0000000000..320f0257e6
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
@@ -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)
+ 
diff --git a/meta/recipes-support/rng-tools/rng-tools_6.10.bb b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
index 3f9720e406..98fb7aa775 100644
--- a/meta/recipes-support/rng-tools/rng-tools_6.10.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
@@ -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 \
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCH] rngd: fix --debug to also filter syslog() calls
  2020-10-09  8:55 [PATCH] rngd: fix --debug to also filter syslog() calls Yann Dirson
@ 2020-10-09 13:00 ` Richard Purdie
  2020-10-09 14:19   ` Yann Dirson
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2020-10-09 13:00 UTC (permalink / raw)
  To: Yann Dirson, openembedded-core; +Cc: Yann Dirson

On Fri, 2020-10-09 at 10:55 +0200, Yann Dirson wrote:
> From: Yann Dirson <yann@blade-group.com>
> 
> 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.
> 
> Signed-off-by: Yann Dirson <yann@blade-group.com>
> ---
>  .../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
> 
> diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
> new file mode 100644
> index 0000000000..320f0257e6
> --- /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

> +++ b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
> @@ -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)
> + 
> diff --git a/meta/recipes-support/rng-tools/rng-tools_6.10.bb b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> index 3f9720e406..98fb7aa775 100644
> --- a/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> +++ b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> @@ -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 \
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCH] rngd: fix --debug to also filter syslog() calls
  2020-10-09 13:00 ` [OE-core] " Richard Purdie
@ 2020-10-09 14:19   ` Yann Dirson
  2020-10-09 15:21     ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Dirson @ 2020-10-09 14:19 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Patches and discussions about the oe-core layer, Yann Dirson

[-- Attachment #1: Type: text/plain, Size: 3308 bytes --]

Le ven. 9 oct. 2020 à 15:00, Richard Purdie <
richard.purdie@linuxfoundation.org> a écrit :

> On Fri, 2020-10-09 at 10:55 +0200, Yann Dirson wrote:
> > From: Yann Dirson <yann@blade-group.com>
> >
> > 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.
> >
> > Signed-off-by: Yann Dirson <yann@blade-group.com>
> > ---
> >  .../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
> >
> > diff --git
> a/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
> b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
> > new file mode 100644
> > index 0000000000..320f0257e6
> > --- /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.
>

Lignthnig-speed upstream merged the patch after I re-rolled, is it worth a
v3 tagged "accepted" ?


> Cheers,
>
> Richard
>
> > +++ b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-filter.patch
> > @@ -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)
> > +
> > diff --git a/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> > index 3f9720e406..98fb7aa775 100644
> > --- a/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> > +++ b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
> > @@ -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 \
> > 
> >
>
>

-- 
Yann Dirson <yann@blade-group.com>
Blade / Shadow -- http://shadow.tech

[-- Attachment #2: Type: text/html, Size: 5016 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCH] rngd: fix --debug to also filter syslog() calls
  2020-10-09 14:19   ` Yann Dirson
@ 2020-10-09 15:21     ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2020-10-09 15:21 UTC (permalink / raw)
  To: Yann Dirson; +Cc: Patches and discussions about the oe-core layer, Yann Dirson

On Fri, 2020-10-09 at 16:19 +0200, Yann Dirson wrote:
> 
> 
> Le ven. 9 oct. 2020 à 15:00, Richard Purdie <
> richard.purdie@linuxfoundation.org> a écrit :
> > On Fri, 2020-10-09 at 10:55 +0200, Yann Dirson wrote:
> > > From: Yann Dirson <yann@blade-group.com>
> > > 
> > > 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.
> > > 
> > > Signed-off-by: Yann Dirson <yann@blade-group.com>
> > > ---
> > >  .../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
> > > 
> > > diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd-debug-
> > filter.patch b/meta/recipes-support/rng-tools/rng-tools/rngd-debug-
> > filter.patch
> > > new file mode 100644
> > > index 0000000000..320f0257e6
> > > --- /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.
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-09 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  8:55 [PATCH] rngd: fix --debug to also filter syslog() calls Yann Dirson
2020-10-09 13:00 ` [OE-core] " Richard Purdie
2020-10-09 14:19   ` Yann Dirson
2020-10-09 15:21     ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.