Hello,
On 9/30/2025 7:04 AM, Tao Liu wrote:
> Hi lianbo,
>
> This patch LGTM, but I'm unsure if this patch has relations with the
> ppc64 bug: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg01649.html.
This patch resolves the issue with the blank lines in the log (since you put back
fputc(*p, fp) for character wise writing in case of regular 'log/dmesg' command).
BUT, if I use the new 'log -R' option, the blank lines are back again!
Hi, Mikhail
---
printk.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/printk.c b/printk.c
index b8fcc8e..d9427c6 100644
--- a/printk.c
+++ b/printk.c
@@ -116,7 +116,7 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags)
uint64_t ts_nsec;
ulonglong nanos;
ulonglong seq;
- int ilen = 0, i;
+ int ilen = 0, i, nlines;
char *desc, *info, *text, *p;
ulong rem;
@@ -207,11 +207,23 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags)
text_len = BUFSIZE;
}
- for (i = 0, p = text; i < text_len; i++, p++) {
- if (*p == '\n')
+ for (i = 0, nlines = 0, p = text; i < text_len; i++, p++) {
+ if (*p == '\n') {
+ if ((msg_flags & SHOW_LOG_RUST) && (i != text_len - 1)) {
+ nlines++;
+ if (strlen(buf)) {
+ fprintf(fp, "%s", buf);
+ memset(buf, 0, strlen(buf));
+ }
+ }
fprintf(fp, "\n%s", space(ilen));
- else if ((msg_flags & SHOW_LOG_RUST) && (isprint(*p) || isspace(*p)))
- sprintf(&buf[i], "%c", *p);
+ } else if ((msg_flags & SHOW_LOG_RUST) && (isprint(*p) || isspace(*p))) {
+ if (nlines >= 1) {
+ fputc(*p, fp);
+ }
+ else
+ sprintf(&buf[i], "%c", *p);
+ }
else if (isprint(*p) || isspace(*p))
fputc(*p, fp);
else
--
2.51.0
It will verify my guess. Hope you can give me some feedback.
Thanks
Lianbo
BTW, it's s390x, not ppc64 ;)