IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Let's make sure to first issue the non-destructive operations, then
issue the hangup (for which we need the fd), then try to disallocate the
device (for which we don't need it anymore).
And while we are at it, merge exec_context_determine_tty_size() +
exec_context_apply_tty_size().
Let's simplify things, and merge the two funcs, since the latter just
does one more call.
At the same time, let's make sure we actually allow passing separate
input/output fds.
We nowadays reset TTYs by writing ANSI sequences to them. This can only
work if we operate on an *output* fd, not an input fd. Hence switch
various cases where we erroneously used an input fd to use an output fd
instead.
Numerous fixes:
1. use vtnr_from_tty() to parse out VT number from tty path
2. open tty for write only when we want to output just ansi sequences
3. open tty in asynchronous mode, and apply a timeout, just to be safe
4. propagate error from writing (most callers ignore it anyway, might as
well pass it along correctly)
This is a lot of stuff, and sometimes quite wild, let's turn this into
its own header.
All stuff color-related that just generates sequences is now in
ansi-color.h (no .c file!), and everything more complex that
probes/ineracts with terminals remains in termina-util.[ch]
Let's update the commentary a bit. Also, use a time-out of 100ms rather
than 50ms for this, simply to unify on the same value used in
vt_disallocate() in a similar case.
Let's put "terminal_" as prefix, like with the other reset calls, and
let's make clear that this only encapsulates the ioctl-based reset
logic, not the ANSI sequence based reset logic.
ESC c is a (vaguely defined) "reset to initial state" ANSI sequence.
Many terminals clear the screen in this case, but that's a bit drastic I
think for most resets.
ESC c was added to the reset logic in
00bc83a275 (i.e. very recently), and I
don't think the effect was clear at that time.
Let's keep the ESC c in place however when we actually want to clear the
screen. Hence move it from reset_terminal_fd() into vt_disallocate().
Fixes: #33689
When we are talking to a serial terminal quite commonly the dimensions
are not set properly, because the serial protocol has not handshake or
similar to transfer this information.
However, we can derive the dimensions via ANSI sequences too, which
should get us the right information, since ANSI sequences are
interpreted by the final terminal, rather than an intermediary local tty
driver (which is where TIOCGWINSZ is interpreted).
This adds a helper call that gets the dimensions this way.
Let's prefix these functions with the subsystem name, and clean them up
a bit. Specifically, drop the error logging, it's entirely duplicative,
since every single caller does it anyway.
Let's add an extra safety check: before issuing the ansi sequence to
query the bg color, let's make sure input and output fd actually
reference the same tty. because otherwise it's unlikely we'll be able to
read back the response from the tty driver.
This is mostly just paranoia.
If we only read partial information from the tty we ended up parsing it
again and again, confusing the state machine. hence, return how much
data we actually processed and drop it from the buffer.
The tap network device should be called "vt-", so that that the
80-vm-vt.network file we ship by default actually matches against it.
Also, turn off any qemu callout stuff, networkd is smart enough to
handle all this on its own, without ugly callouts.
Make the warning for oneshot services (where RuntimeMaxSec= has no
effect) more actionable by pointing to the directive people can use
instead to effectively limit their runtime.
polkitd by default just waves through requests from a root process.
A new POLKIT_CHECK_AUTHORIZATION_FLAGS_ALWAYS_CHECK flag was added
to main (will be part of v125 when it ships) that forces it to go
through the policy checks for root too. Previous versions will just
ignore it.
Change the flags handling slightly so that we pass this or the
interactive flags through, as the values match what polkit expects.
When we patch in a bg color we must make sure that when certain "reset"
sequences are transferred we fix up the bg color again.
Do so for \033[!p ("soft terminal reset") and \033c ("reset to initial
state" aka "full reset").
They might not be readable to the unprivileged user running the tests
and it shouldn't really matter what is used. OTOH, we need a real kernel
because we look at the header.