[Toybox] [PATCH] clear.c: Clear scrollback buffer on non-vte (gnome based) terminals
Rob Landley
rob at landley.net
Fri Mar 8 17:24:07 PST 2024
On 3/8/24 00:02, Oliver Webb wrote:
> On Wednesday, March 6th, 2024 at 01:22, Rob Landley <rob at landley.net> wrote:
>
>> It's actually "reset" that should yank the tty out of cooked mode, which I
>> believe it does now.
>>
>> Why we have both "clear" and "reset", I couldn't tell you.
>
> reset sets tty settings while clear doesn't,
clear -r
*shrug* That ship has long since sailed, just...
> large enough
> difference to probably not make one a OLDTOY pointing at the other.
> Although reset does everything clear does
>
> Looking at the man page for reset, it does even more historical stuff that
> doesn't matter today, like "-r" which is the same as "reset; echo Terminal type is ${TERM}."
> and "-s" which is "reset; echo TERM=$TERM;"
I'm not sure why it would feel the need to display an environment variable.
Stuff like "tty" is generally performing a system call.
>> > Looking more at ncurses clear, what does it do?
>>
>> Way too much, all of which is historical nonsense.
>
> ncurses clear does seem to have a -x option to save the scrollback buffer.
> Not too important but it'd be one line of code to implement ("if (!toys.optargs) xputsn("\e[3J");")
echo -ne '\e[3J'
>> Toybox produces ansi escape sequences (well, "man 7 console_codes" really, but
>> MOSTLY ansi), and OFFICIALLY does not care what the TERM= is set to (or that it
>> is set at all) as a matter of policy.
>
>> Toybox assumes Linux.
>
> What is the oldest version of Linux are we planning to support?
Well, the FAQ says a 7 year support horizon.
https://landley.net/toybox/faq.html#support_horizon
Musl doesn't work on anything older than... 2.6.26 I think? Nope, he bumped it
to 2.6.39 for some reason:
https://wiki.musl-libc.org/supported-platforms
Toybox depends on posix-2008 for all the openat() stuff and 2.6.26 was July
2008, so ballpark of "around then, maybe". I generally just say "3.0" out of
habit, but yeah you can probably squeeze back into the 2.6.30's if you try.
Modulo we've also started to use some C11 features and 3.0 came out in July
2011. I don't THINK shoving an older kernel under that would care, but you'd
need to use a newer toolchain to target that older kernel...
> The nommu stuff seems to have only
> been done on 2.4/2.6 kernels from 15 years ago.
Um, no. Not remotely. Lots of embedded devs use older kernels because they're
way SMALLER than the modern bloated nonsense, but we support and regression test
stuff all the time.
I've booted at least linux 6.6 on physical nommu hardware (my turtle board).
Greg Ungerer and Geert Uytterhoeven regularly regression test like four
different nommu targets each release. We just had a long argument about the
Linux Test Project not having a nommu maintainer and various people both saying
"we support nommu" and "we don't really care about LTP bureaucracy", which is a
bit of catch-22...
https://lore.kernel.org/buildroot/90c1ddc1-c608-30fc-d5aa-fdf63c90d055@landley.net/T/#mf452bdcebfc29ab7a9d230275eb593b22d316ee1
(Which was of course cross-posted to like 4 different lists and each archive
only retained posts from people who were subscribed to that particular list...)
> So is "\e[3J" (A escape code added in 3.0)
> something we can use?
A) Toybox has a 7 year support horizon, 2011 was 13 years ago, 13 > 7, so I'd
assume so.
B) Added to what? The kernel's VGA text console (and/or bitmap console)
interpreting a sequence has nothing to do with XFCE's Terminal program
interpreting a sequence which has nothing to do with KDE's terminal interpreting
a sequence which has nothing to do with gnome terminal interpreting a sequence
which has nothing to do with the terminal Rich Felker wrote
(https://git.musl-libc.org/cgit/uuterm/) and there's a dozen others out there.
When was the sequence added to "man 7 console_codes"? There's a git... sigh,
google is finding
https://github.com/mkerrisk/man-pages/blob/master/man4/console_codes.4 but he
handed maintainership off over a year ago, and Google can't find the new guy.
Did I blog about this... yes I did:
https://landley.net/notes-2023.html#25-02-2023
http://lists.landley.net/pipermail/toybox-landley.net/2023-February/029469.html
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/
And I can't figure out how to annotate thorough that web interface. I could
clone it and see when it was added, but I have to go back to moving house.
(Specifically, lifting boxes into a "pod". We've moved back pickup of the pod
twice now, but need the driveway for a u-haul tomorrow and my flight's scheduled
sunday...)
Rob
More information about the Toybox
mailing list