On 10/21/2025 5:14 AM, lijiang wrote:
> On Tue, Sep 30, 2025 at 3:11 PM Mikhail Zaslonko <[email protected]>
> wrote:
>
>> 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/[email protected]/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
>
> I hacked the following code based on the v2(
> https://www.mail-archive.com/[email protected]/msg01636.html),
> can you try if that can work for you?
Hi Lianbo
I tested the code below and it seems to work fine for s390x. At least I see no
more issues
with 'log' or 'log -R' output.
Just a minor comment below.
Thanks for taking care!
>
> ---
> 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);
Maybe add braces for else statement to be consistent with preceding if? Or
remove for both.
As for indentation, I assume it's a mailing glitch.
> + }
> else if (isprint(*p) || isspace(*p))
> fputc(*p, fp);
> else
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki