Re: [PATCH] util-linux-demsg-issue-2666-patch-1.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 31, 2023 at 10:33:36AM -0800, Edward Chron wrote:
> +	if (*rec->caller_id) {
> +		if (ctl->json) {
> +			ul_jsonwrt_value_s(&ctl->jfmt, "caller", rec->caller_id);
> +		} else {
> +			char cidbuf[PID_CHARS_MAX+3] = {'\0'};
> +
> +			sprintf(cidbuf, "[%*s] ",
> +				(char)ctl->caller_id_size, rec->caller_id);
> +			ctl->indent += strnlen(cidbuf, sizeof(cidbuf));
> +			fputs(cidbuf, stdout);
> +		}
> +	}

The variable width (ctl->caller_id_size) of caller ID makes your
regression test fragile, see:

https://github.com/util-linux/util-linux/actions/runs/7384780996/job/20088287790?pr=2647

--- /home/runner/work/util-linux/util-linux/tests/expected/dmesg/cid-limit	2024-01-02 10:34:02.893193174 +0000
+++ /home/runner/work/util-linux/util-linux/tests/output/dmesg/cid-limit	2024-01-02 10:38:29.209015303 +0000
@@ -1,4 +1,4 @@
-[    1.000000] [    T1] example[1]
-[    8.000000] [    T2] example[2]
-[   27.000000] [    T3] example[3]
-[   64.000000] [    T4] example[4]
+[    1.000000] [   T1] example[1]
+[    8.000000] [   T2] example[2]
+[   27.000000] [   T3] example[3]
+[   64.000000] [   T4] example[4]


I see two possible ways to fix it:

 * "normalize" the output in the tests -- just use sed(1) to
   remove all the blanks space "[    T4]" to "[T4]", so the output
   will be always the same

 * or use fixed width for the caller_id in dmesg.c


    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux