mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hamdy Abou El Anein <info@daylightlinux.ch>
To: sashal@kernel.org
Cc: hamdy.aea@protonmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH] scripts: decode_stacktrace: preserve input while reading lines
Date: Tue,  3 Nov 2026 17:42:03 +0100	[thread overview]
Message-ID: <20261103164203.129660-1-info@daylightlinux.ch> (raw)

From: Hamdy Abou El Anein <hamdy.aea@protonmail.com>

Plain read strips leading and trailing whitespace and interprets
backslashes before the decoder sees a line. It also drops a final line
without a newline. This loses log text and defeats the alignment
preservation in handle_line().

Read with an empty IFS and -r, and process a nonempty final fragment.

Tested passthrough text with indentation, backslashes and trailing
spaces, plus a real debug-enabled object and stack entries terminated
by LF, CRLF or EOF. All three stack entries decode with their original
indentation.

AI assistance: ChatGPT/Codex identified the issue and prepared the
change, commit message and executable regression tests.

Fixes: dbd1abb20971 ("decode_stacktrace: make stack dump output useful again")
Signed-off-by: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
---
 scripts/decode_stacktrace.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 39d60d477bf..8b06810d463 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -346,7 +346,7 @@ handle_line() {
 	echo "${spaces[$last]}${symbol}${module:+ ${module}}${info_str:+ ${info_str}}"
 }
 
-while read line; do
+while IFS= read -r line || [[ -n $line ]]; do
 	# Strip unexpected carriage return at end of line
 	line=${line%$'\r'}
 

             reply	other threads:[~2026-11-03 16:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:42 Hamdy Abou El Anein [this message]
2026-11-03 17:26 ` Sasha Levin

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=20261103164203.129660-1-info@daylightlinux.ch \
    --to=info@daylightlinux.ch \
    --cc=hamdy.aea@protonmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    /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®