|
|
Subscribe / Log in / New account

Re: printk: what is going on with additional newlines?

From:  Linus Torvalds <torvalds-AT-linux-foundation.org>
To:  Pavel Machek <pavel-AT-ucw.cz>
Subject:  Re: printk: what is going on with additional newlines?
Date:  Tue, 29 Aug 2017 09:48:48 -0700
Message-ID:  <CA+55aFx_o_FfCO+c62zMWH8H8rLJsnKZ1TWvMqyUs2A90QJgGg@mail.gmail.com>
Cc:  Sergey Senozhatsky <sergey.senozhatsky-AT-gmail.com>, Petr Mladek <pmladek-AT-suse.com>, Steven Rostedt <rostedt-AT-goodmis.org>, Jan Kara <jack-AT-suse.cz>, Andrew Morton <akpm-AT-linux-foundation.org>, Jiri Slaby <jslaby-AT-suse.com>, Andreas Mohr <andi-AT-lisas.de>, Tetsuo Handa <penguin-kernel-AT-i-love.sakura.ne.jp>, Linux Kernel Mailing List <linux-kernel-AT-vger.kernel.org>, Sergey Senozhatsky <sergey.senozhatsky.work-AT-gmail.com>

On Mon, Aug 28, 2017 at 2:05 AM, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
> In 4.13-rc, printk("foo"); printk("bar"); seems to produce
> foo\nbar. That's... quite surprising/unwelcome. What is going on
> there? Are timestamps responsible?

No.

It's actively trying to treach you not to do shit.

If you want to continue a line, you NEED to use KERN_CONT.

That has always been true. It hasn't always been enforced, though.

If you do two printk's and the second one doesn't say "I'm a
continuation", the printk logic assumes you're just confused and
wanted two lines.

And no, we are *NOT* adding code to printk to help people avoid this.
Quite the reverse.

Stop doing continuations at all please. But if you do, you'd better
use KERN_CONT. And if you don't, and you get multiple lines, it's your
own damn fault.

                 Linus



to post comments


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds