mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Bagas Sanjaya <bagasdotme@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Documentation <linux-doc@vger.kernel.org>,
	Linux Serial <linux-serial@vger.kernel.org>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
	"Cengiz Can" <cengiz@kernel.wtf>,
	"Tomas Mudrunka" <tomas.mudrunka@gmail.com>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Anselm Schüler" <mail@anselmschueler.com>
Subject: Re: [PATCH v2] Documentation: sysrq: Rewrite /proc/sysrq-trigger usage
Date: Thu, 16 Oct 2025 21:25:41 -0700	[thread overview]
Message-ID: <aa388d29-b83b-454e-a686-638c80c6a7bf@infradead.org> (raw)
In-Reply-To: <20251016103609.33897-2-bagasdotme@gmail.com>

Hi,

On 10/16/25 3:36 AM, Bagas Sanjaya wrote:
> /proc/sysrq-trigger usage documentation (in "On all" section) states
> that it is not recommended to write extra characters to it to avoid
> undefined behavior, which is contradictive to previous sentence that
> such characters are ignored. Also, in order to actually process them
> (as a string), prepending it with underscore is required.
> 
> Rewrite the description.
> 
> Link: https://lore.kernel.org/lkml/7ca05672-dc20-413f-a923-f77ce0a9d307@anselmschueler.com/
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
> Changes since v1 [1]:
> 
>   - Rewrite the whole "On all" section (Jon, Randy)
> 
> [1]: https://lore.kernel.org/linux-doc/20251008112409.33622-1-bagasdotme@gmail.com/
> 
>  Documentation/admin-guide/sysrq.rst | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
> index 9c7aa817adc72d..6157d93e03a1e2 100644
> --- a/Documentation/admin-guide/sysrq.rst
> +++ b/Documentation/admin-guide/sysrq.rst
> @@ -75,16 +75,13 @@ On other
>  	submit a patch to be included in this section.
>  
>  On all
> -	Write a single character to /proc/sysrq-trigger.
> -	Only the first character is processed, the rest of the string is
> -	ignored. However, it is not recommended to write any extra characters
> -	as the behavior is undefined and might change in the future versions.
> -	E.g.::

I didn't quite follow Tomas's objection to the patch.
However, if we need to keep most of the paragraph above, I think
that it should at least say something like:

	In this mode, only the first character is processed; the rest of the string
	is silently ignored. To write multiple characters, see the
	alternative mode below.


At any rate, this patch LGTM.

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Or there is yet another alternative wording below.

> +	Write a single character to /proc/sysrq-trigger. E.g.::
>  
>  		echo t > /proc/sysrq-trigger
>  
> -	Alternatively, write multiple characters prepended by underscore.
> -	This way, all characters will be processed. E.g.::
> +	If a string (multiple characters) is written instead, only the
> +	first character is processed unless the string is prepended by
> +	an underscore, like::
>  
>  		echo _reisub > /proc/sysrq-trigger
>  
> 
> base-commit: a1af37b935c73049c54cb1412cf0e850212af420e


Alternative rewrite:

On all
	To write a single character to /proc/sysrq-trigger::

		echo command_key > /proc/sysrq-trigger

	E.g::
		echo t > /proc/sysrq-trigger

	Only the first character is processed; any following characters
	are silently ignored.
	However, it is not recommended to write any extra characters
	as the behavior is undefined and might change in the future versions.

	Alternatively, to write multiple characters to /proc/sysrq-trigger,
	prepend then with an underscore.
	This way, all characters will be processed. E.g.::

		echo _reisub > /proc/sysrq-trigger


I am still OK with removing the 2 "However" lines. We don't typically
document or provide warnings for how the code might be changed in the
future. If someone modifies this code and the documentation needs to be
updated, it should be updated at that time.

-- 
~Randy

  reply	other threads:[~2025-10-17  4:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 10:36 Bagas Sanjaya
2025-10-17  4:25 ` Randy Dunlap [this message]
2025-10-20 11:50   ` Tomáš Mudruňka
2025-10-20 19:12     ` Randy Dunlap
2025-10-21  8:37       ` Tomáš Mudruňka
2025-10-21 17:04         ` Randy Dunlap
2025-10-23  0:35           ` Bagas Sanjaya

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=aa388d29-b83b-454e-a686-638c80c6a7bf@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=bagasdotme@gmail.com \
    --cc=cengiz@kernel.wtf \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mail@anselmschueler.com \
    --cc=tomas.mudrunka@gmail.com \
    /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

all inboxes | Powered by JetHome®