[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bootlogd: make isconsole() more lenient
From: |
Jesse Smith |
Subject: |
Re: [PATCH] bootlogd: make isconsole() more lenient |
Date: |
Fri, 23 Jul 2021 11:18:13 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
Matthias,
As I understand it, you're hoping to make it possible to have bootlogd
work in situations where the kernel "console=" parameter can be used
even if it doesn't contain a number. And, with a little modification,
we can use any "console=" device, even if it's not a normal device name
like /dev/tty0.
I am in favour of your first solution, allowing any device name even if
it doesn't include a number. And allowing "console=X" to map to
"/dev/X", assuming we have a character device.
Let's not accept "console=null" yet. Later, if it's supported in the
kernel I'm okay with trying that, but for now let's wait until Linux
supports a null console device.
I'll be happy to accept a patch for this and add it to our next release
of SysV init tools.
Jesse
On 2021-07-22 9:18 a.m., Matthias Schiffer wrote:
> Do not require a digit after the known prefix. This makes console
> detection work with various serial drivers, which use device names like
> ttymxc%d or ttyAPP%d.
> ---
>
> An (even more lenient) alternative solution would be to try opening any
> device passed as console=X as /dev/X as a last resort when all prefix
> matches fail. Checking that the file is a chardev might make sense then?
>
> The latter should also allow using console=null to disable the console
> completely (which I consider a desirable feature, although it is
> currently not working for the Linux kernel console either [1]).
>
> Please let me know which solution you prefer, so I can update my patch
> accordingly.
>
>
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a91bd6223ecd46addc71ee6fcd432206d39365d2
>
>
> src/bootlogd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/bootlogd.c b/src/bootlogd.c
> index 787db87..5fb3939 100644
> --- a/src/bootlogd.c
> +++ b/src/bootlogd.c
> @@ -228,7 +228,7 @@ int isconsole(char *s, char *res, int rlen)
> l = strlen(c->cmdline);
> if (sl <= l) continue;
> p = s + l;
> - if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p))
> + if (strncmp(s, c->cmdline, l) != 0)
> continue;
> for (i = 0; i < 2; i++) {
> snprintf(res, rlen, i ? c->dev1 : c->dev2, p);