Re: [PATCH] printk: make line continuation not result in stray emergency errors

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

 



On Tue, Nov 20, 2018 at 09:50:44PM +0100, Roland Hieber wrote:
> The levels of pr_emerg() and pr_cont() are both set to 0. When pr_cont()
> is used to continue a previous line, and colored console output is
> enabled, this can result in garbled log messages being printed, e.g.:
> 
>     ERROR: HABv4: -------- HAB warning Event 0 --------
>     ERROR: HABv4: event data:
>     ERROR: HABv4:  dbEMERG:  00EMERG:  24EMERG:  42EMERG:   69EMERG:  30EMERG:  e1EMERG:  1d
>     ERROR: HABv4:  00EMERG:  04EMERG:  00EMERG:  02EMERG:   40EMERG:  00EMERG:  36EMERG:  06
>     ERROR: HABv4:  55EMERG:  55EMERG:  00EMERG:  03EMERG:   00EMERG:  00EMERG:  00EMERG:  00
>     ERROR: HABv4:  00EMERG:  00EMERG:  00EMERG:  00EMERG:   00EMERG:  00EMERG:  00EMERG:  00
>     ERROR: HABv4:  00EMERG:  00EMERG:  00EMERG:  01EMERG:
>     ERROR: HABv4: Status: Operation completed with warning (0x69)
> 
> Note the additional "EMERG: " in front of each continuation, which is
> inserted by pr_cont(buf) being expanded to pr_printk(0, buf). These
> additional strings show up in deep red on the console (which is not
> supported in Git commit messages…). One might argue that this is the
> same color as the "ERROR: " prefix, but when pr_cont() is used with
> pr_notice() and pr_warning(), which are printed in blue and yellow
> respectively, at least then the change in color would lead to additional
> confusion.
> 
> The log level argument to pr_printk is defined as int, so we can solve
> this by defining the level for pr_cont() to -1, which is not used for
> any loglevel:
> 
>     ERROR: HABv4: -------- HAB warning Event 0 --------
>     ERROR: HABv4: event data:
>     ERROR: HABv4:  db 00 24 42  69 30 e1 1d
>     ERROR: HABv4:  00 04 00 02  40 00 36 06
>     ERROR: HABv4:  55 55 00 03  00 00 00 00
>     ERROR: HABv4:  00 00 00 00  00 00 00 00
>     ERROR: HABv4:  00 00 00 01
>     ERROR: HABv4: Status: Operation completed with warning (0x69)
> 
> Fixes: 0fcefdd9369050f35a88b41dcd42cc5a3c6c6b33 ("printk: Add pr_cont")
> Fixes: ea0e077ed65a003e4d7a1e023aee38cbe2d14898 ("printk: Fix pr_cont")
> Signed-off-by: Roland Hieber <r.hieber@xxxxxxxxxxxxxx>
> ---

Since it improved things: Applied, thanks.

However, I think we should make our minds if we keep pr_cont or if it's
just unnecessary ballast. Right now we only have a few users which could
be removed without much hassle.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux