<div dir="ltr"><div>It turned out that one of our own shell scripts tried to interpret console= arguments in /proc/cmdline and tripped over a newline character in the kernel command line. That also explains the error message we saw.</div><div><br></div><div>That being said, I think my patch might still be valid, because the function show_cons_active in the Linux kernel uses space characters to separate console names. Please update the commit message accordingly.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 14, 2023 at 3:13 PM Daniel Mentz <<a href="mailto:danielmentz@google.com">danielmentz@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">oneit appears to have made the assumption that<br>
/sys/class/tty/console/active provides a list of console names separated<br>
by newline characters. It turned out, though, that individual names are<br>
separated by space characters with a newline character at the very end<br>
of the list.<br>
<br>
We previously observed the following error message:<br>
<br>
oneit: /dev/ttynull<br>
ttyS0: No such file or directory<br>
---<br>
toys/other/oneit.c | 5 +++--<br>
1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/toys/other/oneit.c b/toys/other/oneit.c<br>
index d154f582..13f58078 100644<br>
--- a/toys/other/oneit.c<br>
+++ b/toys/other/oneit.c<br>
@@ -73,12 +73,13 @@ void oneit_main(void)<br>
// Autodetect console from sysfs if no -c<br>
memcpy(toybuf, "/dev/", 5);<br>
if (!TT.c && (TT.c = readfile("/sys/class/tty/console/active", ss, 4096))) {<br>
- // Remove null terminator, take last entry<br>
+ // Take last entry, remove newline terminator<br>
for (;;) {<br>
- if (!(ss = strchr(TT.c, '\n'))) break;<br>
+ if (!(ss = strchr(TT.c, ' '))) break;<br>
if (!ss[1]) *ss = 0;<br>
else TT.c = ++ss;<br>
}<br>
+ if (ss = strchr(TT.c, '\n')) ss[1] = 0;<br>
// Ensure /dev prefix<br>
strstart(&TT.c, "/dev/");<br>
memmove(toybuf+5, TT.c, strlen(TT.c));<br>
-- <br>
2.40.0.634.g4ca3ef3211-goog<br>
<br>
</blockquote></div>