From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH] commands: dmesg: clear logbuffer fully if not requested otherwise
Date: Mon, 20 Oct 2025 11:36:01 +0200 [thread overview]
Message-ID: <aPYCgfi-oX6zQgY-@pengutronix.de> (raw)
In-Reply-To: <20251017-dmesg-v1-1-ac9c2fb021f6@pengutronix.de>
On Fri, Oct 17, 2025 at 01:04:36PM +0200, Jonas Rebmann wrote:
> Previously, `dmesg -c` would clear the logbuffer except for the last 10
> lines. This comes with a fair amount of surprise given linux `dmesg -c`
> clears the whole logbuffer.
>
> Clear the complete logbuffer given `dmesg -c` but with an optional
> argument `dmesg -c [<num>]` to keep <num> lines.
>
> While at it, move the deleteion of log lines to the log_print function
> to prevent a corner case of lost log message if they arrive between the
> log_print() and log_clean() in dmesg.
>
> If loglevels are selected using -l or -p in addition to cleaning being
> selected using -c, only clean those messages shown by the loglevel
> selection.
I find this behaviour rather surprising. The only useful thing I could
think of we can do with this is "Discard unimportant messages", but only
by printing them. It would be more useful if we had a -C (uppercase)
option to discard messages without printing them. But even with that,
there are many things we can do with this behaviour that are not useful
and only a few that are actually useful. We could delete for example all
"info" messages and keep the more and less important messages, but why
would we want to do this?
I think you should rather use the filter options -l and -p to limit the
output to the messages you are interested in and finally use -c to clear
the buffer.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-10-20 12:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 11:04 Jonas Rebmann
2025-10-17 11:17 ` Ahmad Fatoum
2025-10-20 9:36 ` Sascha Hauer [this message]
2025-10-20 12:36 ` Jonas Rebmann
2025-10-20 13:23 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPYCgfi-oX6zQgY-@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jre@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox