]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
16 months agoMerge pull request #33597 from keszybz/fetch-distro
Luca Boccassi [Mon, 22 Jul 2024 10:46:43 +0000 (11:46 +0100)] 
Merge pull request #33597 from keszybz/fetch-distro

Extend the distro fetching script to check the repository out

16 months agoDocument that MemorySwapMax supports % configuration
Steve Traylen [Wed, 3 Jul 2024 12:19:08 +0000 (14:19 +0200)] 
Document that MemorySwapMax supports % configuration

Certainly on systemd 252 at least a configuration of
```
MemorySwapMax=40%
```
is supported but this was missing from the man page.
Only MemoryMax was documented as supporting a %.

16 months agocore: when switching root remove /run/systemd before executing the binary specified...
Franck Bui [Wed, 17 Jul 2024 09:02:03 +0000 (11:02 +0200)] 
core: when switching root remove /run/systemd before executing the binary specified by init=

It's important if the binary specified by the init= boot option is not systemd
otherwise it confuses systemctl that incorrectly assumes that systemd is still
the init system due to the presence of /run/systemd/system.

Also some tools might also check the presence of /run/systemd/private to test
if systemd is running as pid1.

16 months agoMake vcs-tag do something useful for non-developer mode as well
Daan De Meyer [Fri, 19 Jul 2024 11:05:11 +0000 (13:05 +0200)] 
Make vcs-tag do something useful for non-developer mode as well

When building packages of arbitrary commits of systemd-stable,
distributors might want to include a git sha of the exact commit
they're on. Let's extend vcs-tag a little to make this possible.

If we're on a commit matching a tag, don't generate a git sha at all.
If we're not on a commit matching a tag, generate a vcs tag as usually.
However, if we're not in developer mode, don't append a '^' if the tree
is dirty to accomodate package builds applying various patches to the
tree which shouldn't be considered as "dirty" edits.

16 months agotools/fetch-distro: switch to the target branch 33597/head
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jul 2024 14:11:43 +0000 (16:11 +0200)] 
tools/fetch-distro: switch to the target branch

We switch opensuse from "factory" to "devel". I had an old checkout that was
using the stale branch.

16 months agotools/fetch-distro: only fetch the configured branch
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jul 2024 14:10:49 +0000 (16:10 +0200)] 
tools/fetch-distro: only fetch the configured branch

We don't need the other branches. This mostly cuts down on the
noise in output. But add '-v' to show what we're fetching.

16 months agotools/update-distro-hash: rename, fetch the repository if appropriate
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jul 2024 14:01:03 +0000 (16:01 +0200)] 
tools/update-distro-hash: rename, fetch the repository if appropriate

Let's rename the tool to tools/fetch-distro. It's useful to be able to fetch
the distro directly. But when that functionality is added, the old name is
confusing.

Now --update/-u must be specified to update the commits.

--reference-if-able is used to speed up the clone of debian.
It saves about 75% of the download.

16 months agozsh/_networkctl: remove duplicated argument for completion (#31926)
Collin L [Mon, 22 Jul 2024 09:36:47 +0000 (17:36 +0800)] 
zsh/_networkctl: remove duplicated argument for completion (#31926)

It is unnecessary, which will mess the completion.

16 months agoMerge pull request #33802 from DaanDeMeyer/packages
Daan De Meyer [Mon, 22 Jul 2024 09:23:22 +0000 (11:23 +0200)] 
Merge pull request #33802 from DaanDeMeyer/packages

mkosi: Various packaging improvements

16 months agoshared: log error when execve fail
Mauri de Souza Meneguzzo [Tue, 25 Jun 2024 02:47:15 +0000 (23:47 -0300)] 
shared: log error when execve fail

If there is an error with the execv call in fork_agent the
program exits without any meaningful log message. Log the
command and errno so the user gets more information about
the failure.

Fixes: #33418
Signed-off-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
16 months agoMerge pull request #33432 from gregorHerburger/add_IFLA_BR_FDB_MAX_LEARNED_support
Luca Boccassi [Mon, 22 Jul 2024 09:06:16 +0000 (10:06 +0100)] 
Merge pull request #33432 from gregorHerburger/add_IFLA_BR_FDB_MAX_LEARNED_support

network: bridge: add support for  IFLA_BR_FDB_MAX_LEARNED

16 months agomkosi: update arch commit reference 33802/head
Daan De Meyer [Mon, 22 Jul 2024 08:28:57 +0000 (10:28 +0200)] 
mkosi: update arch commit reference

1d577a6268 refresh the keys
12383ba712 make libarchive a regular optional dependency...
f51d5e04bf ignore rc releases in nvchecker
0b096a2baa add nvchecker
5f0ced863c upgpkg: 256.2-1: new upstream release

16 months agomkosi: update fedora commit reference
Daan De Meyer [Mon, 22 Jul 2024 08:28:50 +0000 (10:28 +0200)] 
mkosi: update fedora commit reference

00babccdea Simplify BFQ scheduler enablement
ef8ddb130b Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
5b4a5461d6 Fix changelog
a8c5c736f6 Only apply shorter shutdown timer changes on Fedora
*   f4e284cd7a Merge #150 `Deal with systemd-timesyncd backport in EPEL`
|\
| * 9378a0733a Deal with systemd-timesyncd backport in EPEL
* | 12d1f05029 Don't claim /sbin/installkernel if building for CentOS Stream 9
|/
79828f2753 spec: use "positive" conditions in conditionals
c5d3af1638 Add build dependency on rsync on CentOS Stream 9
8d080fb5cb Backport udma buffer access patch
6084453807 Add support for building from a specific branch
cb9d631ca0 Update PR patch metadata
3889da947e In standalone subpackages, suggest coreutils-single
b7800e3e66 Drop versions from Conflicts for standalone packages

16 months agotest: systemd-networkd-tests: add fdb learned tests 33432/head
Gregor Herburger [Thu, 20 Jun 2024 14:22:56 +0000 (16:22 +0200)] 
test: systemd-networkd-tests: add fdb learned tests

Add a test for the new bridge netlink attributes IFLA_BR_FDB_N_LEARNED and
IFLA_BR_FDB_MAX_LEARNED.

Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
16 months agonetworkctl: add support to display learned fdb entries
Gregor Herburger [Wed, 12 Jun 2024 12:05:09 +0000 (14:05 +0200)] 
networkctl: add support to display learned fdb entries

Since Linux commit ddd1ad68826d ("net: bridge: Add netlink knobs for number
/ max learned FDB entries") [1] it is possible to limit to number of
dynamically learned fdb entries per bridge.

Add support to the systemd networkctl for the netlink bridge attributes
IFLA_BR_FDB_MAX_LEARNED and IFLA_BR_FDB_N_LEARNED.

[1] https://lore.kernel.org/all/20231016-fdb_limit-v5-0-32cddff87758@avm.de/

Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
16 months agonetwork: bridge: add support for IFLA_BR_FDB_MAX_LEARNED
Gregor Herburger [Thu, 20 Jun 2024 14:10:24 +0000 (16:10 +0200)] 
network: bridge: add support for IFLA_BR_FDB_MAX_LEARNED

Since Linux commit ddd1ad68826d ("net: bridge: Add netlink knobs for number
/ max learned FDB entries") [1] it is possible to limit to number of
dynamically learned fdb entries per bridge.

Add support to the systemd netdev bridge for the new netlink attribute
IFLA_BR_FDB_MAX_LEARNED.

[1] https://lore.kernel.org/all/20231016-fdb_limit-v5-0-32cddff87758@avm.de/

Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
16 months agomkosi: Use the Fedora Rawhide spec for CentOS
Daan De Meyer [Mon, 22 Jul 2024 08:25:46 +0000 (10:25 +0200)] 
mkosi: Use the Fedora Rawhide spec for CentOS

These are now practically identical, with the only differences between
the two having no effect on the rpm builds we do with mkosi, so let's
cut out the middle man and just use the Fedora Rawhide spec for CentOS
as well.

16 months agomkosi: Switch back to PKG_SUBDIR instead of symlinks
Daan De Meyer [Mon, 22 Jul 2024 08:22:48 +0000 (10:22 +0200)] 
mkosi: Switch back to PKG_SUBDIR instead of symlinks

Previously I thought it would make sense to allow running the build
scripts from within the VM/container to rebuild the packages. Instead
we ended up making it possible to rerun mkosi outside of the container/VM
to rebuild the packages, so let's switch back to $PKG_SUBDIR to tell the
build scripts where to look for the packaging sources.

16 months agoMerge pull request #32612 from YHNdnzj/creds-test
Mike Yuan [Sun, 21 Jul 2024 20:27:42 +0000 (22:27 +0200)] 
Merge pull request #32612 from YHNdnzj/creds-test

core/service: imply Type=exec if credentials are used

16 months agocore/service: imply Type=exec if credentials are used 32612/head
Mike Yuan [Wed, 1 May 2024 13:26:33 +0000 (21:26 +0800)] 
core/service: imply Type=exec if credentials are used

When credentials are used with Type=simple + ExecStartPost=,
i.e. when multiple sd-executor instances are running in parallel
for a single service, the state of final credential dir
might be unexpected wrt path_is_mount_point() and other
steps. So, let's imply Type=exec if not explicitly specified,
and emit a warning otherwise.

16 months agotest-execute: ExecStop= and friends should not get credentials
Mike Yuan [Tue, 30 Apr 2024 13:55:05 +0000 (21:55 +0800)] 
test-execute: ExecStop= and friends should not get credentials

See #32583

16 months agocryptsetup: handle parallel activation of volumes with another tool gracefully
Kamil Szczęk [Thu, 27 Jun 2024 17:05:43 +0000 (19:05 +0200)] 
cryptsetup: handle parallel activation of volumes with another tool gracefully

This commit makes systemd-cryptsetup exit with a successful status when
the volume gets unlocked outside of the current systemd-cryptsetup
process while it was executing. This can be easily reproduced by calling
systemd-cryptsetup, and while it waits for user to input a password/PIN,
unlock the volume in a second terminal. Then after entering the password
systemd-cryptsetup will exit with a non-zero status code.

16 months agoMerge pull request #33443 from YHNdnzj/oneshot-destroy-cred
Luca Boccassi [Sun, 21 Jul 2024 17:44:25 +0000 (18:44 +0100)] 
Merge pull request #33443 from YHNdnzj/oneshot-destroy-cred

core/service: destroy runtime data when Type=oneshot services exit

16 months agoudev-builtin-net_id: use firmware_node/sun for ID_NET_NAME_SLOT
Etienne Champetier [Tue, 9 Jul 2024 15:53:50 +0000 (11:53 -0400)] 
udev-builtin-net_id: use firmware_node/sun for ID_NET_NAME_SLOT

pci_get_hotplug_slot() has the following limitations:
- if slots are not hotpluggable, they are not in /sys/bus/pci/slots.
- the address at /sys/bus/pci/slots/X/addr doesn't contains the function part,
  so on some system, 2 different slots with different _SUN end up with the same
  hotplug_slot, leading to naming conflicts.
- it tries all parent devices until it finds a slot number, which is incorrect,
  and what led to NAMING_BRIDGE_MULTIFUNCTION_SLOT being disabled.

The use of PCI hotplug to find the slot (ACPI _SUN) was introduced in
https://github.com/systemd/systemd/commit/0035597a30d120f70df2dd7da3d6128fb8ba6051
"udev: net_id - export PCI hotplug slot names" on 2012/11/26.
At the same time on the kernel side we got
https://github.com/torvalds/linux/commit/bb74ac23b10820d8722c3e1f4add9ef59e703f63
"ACPI: create _SUN sysfs file" on 2012/11/16.

Using PCI hotplug was the only way at the time, but now 12 years later we can use
firmware_node/sun sysfs file.
Looking at a small selection of server HW, for HPE (Gen10 DL325), the _SUN is attached
to the NIC device, whereas for Dell (R640/R6515/R6615) and Cisco (UCSC-C220-M5SX),
the _SUN is on the first parent pcieport.

We still fallback to pci_get_hotplug_slot() to handle the s390 case and
maybe some other coner cases (_SUN on grand parent device that is not a
bridge ?).

16 months agotest: override blocking localed policy in TEST-73-LOCALE
Luca Boccassi [Sat, 20 Jul 2024 10:34:51 +0000 (11:34 +0100)] 
test: override blocking localed policy in TEST-73-LOCALE

On Debian and derivatives writing calls to localed are blocked as other
tools are used to change settings, override that policy for the tests

16 months agohwdb: fix MXC6655 accelerometer mount matrix for Aquarius Cmp NS483
Vasiliy Kovalev [Sun, 21 Jul 2024 09:16:42 +0000 (12:16 +0300)] 
hwdb: fix MXC6655 accelerometer mount matrix for Aquarius Cmp NS483

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
16 months agosystemd.dnssd does not handle local requests (#32991)
Alain Greppin [Sun, 21 Jul 2024 11:48:56 +0000 (13:48 +0200)] 
systemd.dnssd does not handle local requests (#32991)

systemd.dnssd does not handle local requests

Fixes https://github.com/systemd/systemd/issues/32990

16 months agocore/service: destroy runtime data when Type=oneshot services exit 33443/head
Mike Yuan [Sat, 22 Jun 2024 10:03:50 +0000 (12:03 +0200)] 
core/service: destroy runtime data when Type=oneshot services exit

Currently, we have a bunch of Type=oneshot + RemainAfterExit=yes
services that make use of credentials. When those exits, the cred mounts
remain established, which is pointless and quite annoying. Let's
instead destroy the runtime data on SERVICE_EXITED, if no process
will be spawned for the unit again.

16 months agocore/unit: add one assertion for u->manager
Mike Yuan [Sat, 22 Jun 2024 10:08:39 +0000 (12:08 +0200)] 
core/unit: add one assertion for u->manager

16 months agoMerge pull request #33790 from YHNdnzj/run-exec-flags
Luca Boccassi [Sun, 21 Jul 2024 10:44:20 +0000 (11:44 +0100)] 
Merge pull request #33790 from YHNdnzj/run-exec-flags

run: clean up ExecCommandFlags serialization

16 months agotimedatectl: setting set_local_rtc to 1 will throw Warning as well, use log_warning...
ShreyasMahangade [Sat, 20 Jul 2024 17:07:30 +0000 (22:37 +0530)] 
timedatectl: setting set_local_rtc to 1 will throw Warning as well, use log_warning() (#33489)

Previously only running `timedatectl` it was showing warning regarding the dangers of setting RTC to local TZ.\rNow similar warning is also flashed when `set-local-rtc 1`.

16 months agomeson: fix missing failure if bpf-framework was enabled
Dominique Martinet [Sat, 20 Jul 2024 11:38:37 +0000 (20:38 +0900)] 
meson: fix missing failure if bpf-framework was enabled

If building with clang and clang does not support bpf, then enabling
-Dbpf-framework=enabled would silently drop the feature (even printing
bpf-framework: enabled in the meson build recap, and no message anywhere
that'd hint at the failure!)

This is unexpected, so add check to fail hard in this case.

All other code paths (gcc, missing bpftool) properly check for the
option, but it is not as easy for a custom command so check explicitly

16 months agoupate TODO
Lennart Poettering [Sat, 20 Jul 2024 13:04:32 +0000 (15:04 +0200)] 
upate TODO

16 months agorun: clean up ExecCommandFlags serialization 33790/head
Mike Yuan [Wed, 10 Jul 2024 20:27:21 +0000 (22:27 +0200)] 
run: clean up ExecCommandFlags serialization

The current behavior is actually OK, since use_ex_prop = !arg_expand_environment,
but that's very implicit and using STRV_MAKE() this way feels icky.
Let's make this more readable, by using exec_command_flags_to_strv().

16 months agoexec-util: modernize exec_command_flags_{to,from}_strv
Mike Yuan [Wed, 10 Jul 2024 20:23:37 +0000 (22:23 +0200)] 
exec-util: modernize exec_command_flags_{to,from}_strv

- Rename ret params following our coding style
- Use assertion where appropriate
- Use BIT_FOREACH()

16 months agozsh: update varlinkctl completions
Ronan Pigott [Fri, 19 Jul 2024 15:35:46 +0000 (08:35 -0700)] 
zsh: update varlinkctl completions

correct redundant or mismatched tags and fill the argument field of
curcontext because _regex_words does not do that for us.

The _complete_help text now looks much more reasonable most of the time:

$ varlinkctl call /run/systemd/resolve/io.systemd.Resolve ^Xh
tags in context :completion::complete:varlinkctl::
    argument-rest  (_arguments _varlinkctl)
tags in context :completion::complete:varlinkctl-call:method:
    varlink-methods  (_varlinkctl_cmd _varlinkctl_command _arguments _varlinkctl)

Fixes: af63b4b769bf ("zsh: add varlinkctl completions")
16 months agoexecute: add FIXME comment
Lennart Poettering [Fri, 19 Jul 2024 12:40:47 +0000 (14:40 +0200)] 
execute: add FIXME comment

As requested by @YHNdnzj:

https://github.com/systemd/systemd/pull/33707#discussion_r1684055699

16 months agozsh: add varlinkctl completions
Ronan Pigott [Fri, 19 Jul 2024 08:20:15 +0000 (01:20 -0700)] 
zsh: add varlinkctl completions

16 months agodocs: Document how to do stable releases
Daan De Meyer [Fri, 19 Jul 2024 12:00:04 +0000 (14:00 +0200)] 
docs: Document how to do stable releases

16 months agoMerge pull request #33707 from poettering/terminal-size-by-ansi-seq
Lennart Poettering [Fri, 19 Jul 2024 12:35:55 +0000 (14:35 +0200)] 
Merge pull request #33707 from poettering/terminal-size-by-ansi-seq

pid1: try to initialize terminal dimensions from data gathered via ANSI sequences + many clean-ups/refactorings

16 months agomkosi: Bump default device timeout a little
Daan De Meyer [Fri, 19 Jul 2024 11:24:35 +0000 (13:24 +0200)] 
mkosi: Bump default device timeout a little

We've been getting some integration test failures due to timeouts
on finding the root partition device. Let's bump the default device
timeout a little to see if it mitigates these failures.

16 months agohwdb: Add mic mute key mapping for Dell Pro Rugged series
Kai-Chuan Hsieh [Fri, 19 Jul 2024 08:16:52 +0000 (16:16 +0800)] 
hwdb: Add mic mute key mapping for Dell Pro Rugged series

16 months agopid1: use $COLUMNS info in status_vprintf() 33707/head
Lennart Poettering [Wed, 17 Jul 2024 15:56:01 +0000 (17:56 +0200)] 
pid1: use $COLUMNS info in status_vprintf()

This way, we can work around the fact that "struct winsize" for
/dev/console might not be initialized the moment we open the device.

16 months agomain: set $COLUMNS/$ROWS for PID 1 based on /dev/console data
Lennart Poettering [Wed, 17 Jul 2024 15:47:41 +0000 (17:47 +0200)] 
main: set $COLUMNS/$ROWS for PID 1 based on /dev/console data

In PID 1 we write status information to /dev/console regularly, but we
cannot keep it open continously, due to the kernel's SAK logic (which
would kill PID 1 if user hits SAK). But closing/reopening it all the
time really sucks for tty types that have no window size management
(such as serial terminals/hvc0 and suchlike), because it also means the
TTY is fully closed most of the time, and that resets the window sizes
to 0/0.

Now, we reinitialize the window size on every reopen, but that is a bit
expensive for simple status output. Hence, cache the window size in the
usualy $COLUMNS/$ROWS environment variables. We don't inherit these to
our payloads anyway, hence these are free to us to use.

16 months agoterminal-util: add recognizable error if cols/rows of tty are initially not initialized
Lennart Poettering [Wed, 17 Jul 2024 15:45:26 +0000 (17:45 +0200)] 
terminal-util: add recognizable error if cols/rows of tty are initially not initialized

Various tty types come up with cols/rows not initialized (i.e. set to
zero). Let's detect these cases, and return a better error than EIO,
simply to make things easier to debug.

16 months agoterminal-util: extend timeout on background color request
Lennart Poettering [Wed, 17 Jul 2024 15:57:12 +0000 (17:57 +0200)] 
terminal-util: extend timeout on background color request

I managed to hit the timeout a couple of times inside of slow qemu.
Let's increase it a bit to 1/3s

16 months agoterminal-util: try to avoid reading more from terminal than we need in get_default_ba...
Lennart Poettering [Wed, 17 Jul 2024 13:56:15 +0000 (15:56 +0200)] 
terminal-util: try to avoid reading more from terminal than we need in get_default_background_color()

16 months agoexec-invoke: user EBADF where appropriate
Lennart Poettering [Wed, 17 Jul 2024 13:06:48 +0000 (15:06 +0200)] 
exec-invoke: user EBADF where appropriate

16 months agotree-wide: acquire /dev/console lock around any attempts to reset TTY
Lennart Poettering [Wed, 17 Jul 2024 13:06:27 +0000 (15:06 +0200)] 
tree-wide: acquire /dev/console lock around any attempts to reset TTY

16 months agoterminal-util: teach resolve_dev_console() to deal correctly with /dev/console being...
Lennart Poettering [Wed, 17 Jul 2024 10:28:53 +0000 (12:28 +0200)] 
terminal-util: teach resolve_dev_console() to deal correctly with /dev/console being a symlink

/dev/console is sometimes a symlink in container managers. Let's handle
that correctly, and resolve the symlink, and not consider the data from
/sys/ in that case.

16 months agoterminal-util: move lock_dev_console() here
Lennart Poettering [Wed, 17 Jul 2024 10:20:32 +0000 (12:20 +0200)] 
terminal-util: move lock_dev_console() here

It doesn't really make sense to have that in dev-setup.c, which is
mostly about setting up /dev/, creating device nodes and stuff.

let's move it to the other stuff that deals with /dev/console's
peculiarities.

16 months agoman: clarify what TTYReset= and TTYVTDisallocate= do and do not do regarding screen...
Lennart Poettering [Fri, 12 Jul 2024 04:06:11 +0000 (06:06 +0200)] 
man: clarify what TTYReset= and TTYVTDisallocate= do and do not do regarding screen clearing

16 months agounits: bring agetty command lines back into sync
Lennart Poettering [Thu, 11 Jul 2024 14:18:49 +0000 (16:18 +0200)] 
units: bring agetty command lines back into sync

Let's always rely on our own TTY reset logic and tty disallocation/clear
screen logic, thus always pass --noclear and --noreset.

Also, bring the list of baud rates to try into sync for console-getty
and serial-getty (the former might or might not be connected to rs232,
we can't know, hence assume the worst, and copy what
serial-getty@.service does)

16 months agoexec-invoke: move terminal initialization a bit
Lennart Poettering [Thu, 11 Jul 2024 09:29:37 +0000 (11:29 +0200)] 
exec-invoke: move terminal initialization a bit

It's a bit confusing, but we actually initialize the terminal twice for
each service, potentially. One earlier time, where we might end up
firing vhangup() and vt_disallocate(), which is a pretty brutal way to
reset things, by disconnecting and possibly invalidating the tty
completely. When we do this we do not keep any fd open afterwards, since
it quite likely points to a dead connection of a tty.

The 2nd time we initialize things when we actually want to use it.

The first initialization is hence "destructive" (killing any left-overs
from previous uses) the 2nd one "constructive" (preparing things for our
new use), if you so will.

Let's document this distinction in comments, and let's also move both
initializations to exec_invoke(), so that they are easier to see in their
symmetric behaviour. Moreover, let's run the tty initialization after we
opened both input and output, since we need both for doing the fancy
dimension auto init stuff now.

Oh, and of course, one thing to mention: we nowadays initialize
terminals both with ioctl() and with ansi sequences. But the latter
means we need an fd that is open for *write* (since we are *writing*
those ansi sequences to the tty). Hence, resetting via the input fd is
conceptually wrong, it worked only so far if we had O_RDWR open mode
selected)

16 months agoexecute: reorder "destructive" tty reset operations
Lennart Poettering [Thu, 11 Jul 2024 14:28:08 +0000 (16:28 +0200)] 
execute: reorder "destructive" tty reset operations

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).

16 months agoexec-invoke: handle errno log message writing in write_confirm_error_fd() like we...
Lennart Poettering [Thu, 11 Jul 2024 09:44:31 +0000 (11:44 +0200)] 
exec-invoke: handle errno log message writing in write_confirm_error_fd() like we usually do

16 months agoexec-invoke: save original stdin/stdout with O_CLOEXEC set
Lennart Poettering [Thu, 11 Jul 2024 09:43:40 +0000 (11:43 +0200)] 
exec-invoke: save original stdin/stdout with O_CLOEXEC set

We turn off the flag anyway when we install them back as stdin/stdout
later (via dup2()). let's hence follow our usual rules, and turn on
O_CLOEXEC.

16 months agoexecute: also hook up ansi-seq-based terminal size determination with exec_context_de...
Lennart Poettering [Thu, 11 Jul 2024 09:29:15 +0000 (11:29 +0200)] 
execute: also hook up ansi-seq-based terminal size determination with exec_context_determine_size()

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.

16 months agotree-wide: reset stdout not stdin
Lennart Poettering [Mon, 15 Jul 2024 09:48:48 +0000 (11:48 +0200)] 
tree-wide: reset stdout not stdin

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.

16 months agoterminal-util: refactor vt_disallocate()
Lennart Poettering [Thu, 11 Jul 2024 15:45:34 +0000 (17:45 +0200)] 
terminal-util: refactor vt_disallocate()

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)

16 months agoterminal-util: move acquire_terminal() and AcquireTerminalFlags back together in...
Lennart Poettering [Thu, 11 Jul 2024 09:28:46 +0000 (11:28 +0200)] 
terminal-util: move acquire_terminal() and AcquireTerminalFlags back together in header file

16 months agoterminal-util: simplify terminal_set_size_fd() a tiny bit
Lennart Poettering [Thu, 11 Jul 2024 09:28:29 +0000 (11:28 +0200)] 
terminal-util: simplify terminal_set_size_fd() a tiny bit

16 months agoterminal-util: split out color macros/helpers into its own header
Lennart Poettering [Thu, 11 Jul 2024 09:02:28 +0000 (11:02 +0200)] 
terminal-util: split out color macros/helpers into its own header

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]

16 months agoterminal-util: remove terminal_vhangup() because apparently unused
Lennart Poettering [Thu, 11 Jul 2024 08:54:24 +0000 (10:54 +0200)] 
terminal-util: remove terminal_vhangup() because apparently unused

16 months agoterminal-util: rename return parameters ret_xyz
Lennart Poettering [Thu, 11 Jul 2024 08:50:51 +0000 (10:50 +0200)] 
terminal-util: rename return parameters ret_xyz

16 months agoterminal-util: modernize vt_reset_keyboard() a bit
Lennart Poettering [Fri, 19 Jul 2024 07:17:29 +0000 (09:17 +0200)] 
terminal-util: modernize vt_reset_keyboard() a bit

16 months agoterminal-util: don't export vt_reset_keyboard() + vt_default_utf8()
Lennart Poettering [Thu, 11 Jul 2024 08:47:01 +0000 (10:47 +0200)] 
terminal-util: don't export vt_reset_keyboard() + vt_default_utf8()

16 months agoterminal-util: modernize terminal_reset_ansi_seq() a bit
Lennart Poettering [Fri, 19 Jul 2024 07:17:48 +0000 (09:17 +0200)] 
terminal-util: modernize terminal_reset_ansi_seq() a bit

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.

16 months agoterminal-util: don't export terminal_reset_ioctl()/terminal_reset_ansi_seq() anymore
Lennart Poettering [Thu, 11 Jul 2024 08:37:32 +0000 (10:37 +0200)] 
terminal-util: don't export terminal_reset_ioctl()/terminal_reset_ansi_seq() anymore

We only use them in terminal-util.c, hence make them static (and move
them before their first using function).

16 months agoterminal-util: rename reset_terminal_fd() → terminal_reset_ioctl()
Lennart Poettering [Thu, 11 Jul 2024 08:26:14 +0000 (10:26 +0200)] 
terminal-util: rename reset_terminal_fd() → terminal_reset_ioctl()

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.

16 months agoterminal-util: remove reset_terminal() as it is unused
Lennart Poettering [Thu, 11 Jul 2024 08:23:14 +0000 (10:23 +0200)] 
terminal-util: remove reset_terminal() as it is unused

16 months agoterminal-util: don't issue "ESC c" sequence on reset, but only when erasing the screen
Lennart Poettering [Thu, 11 Jul 2024 07:34:11 +0000 (09:34 +0200)] 
terminal-util: don't issue "ESC c" sequence on reset, but only when erasing the screen

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
00bc83a275fa3ca8d90579fe9597d8b651d47332 (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
16 months agoterminal-util: add new helper terminal_reset_defensive() that combines reset-by-ioctl...
Lennart Poettering [Thu, 11 Jul 2024 07:26:07 +0000 (09:26 +0200)] 
terminal-util: add new helper terminal_reset_defensive() that combines reset-by-ioctl and reset-by-sequence reasonably

16 months agoterminal-util: add terminal_is_pty_fd() helper
Lennart Poettering [Wed, 10 Jul 2024 16:52:42 +0000 (18:52 +0200)] 
terminal-util: add terminal_is_pty_fd() helper

The helper checks if an fd references a pty

16 months agoterminal-util: unify code that resets /dev/console in common helper
Lennart Poettering [Wed, 10 Jul 2024 16:02:31 +0000 (18:02 +0200)] 
terminal-util: unify code that resets /dev/console in common helper

We have pretty much the same code at two places, let's make it one.

16 months agoterminal-util: reset /dev/console via ansi seq also in make_console_stdio()
Lennart Poettering [Wed, 10 Jul 2024 15:53:58 +0000 (17:53 +0200)] 
terminal-util: reset /dev/console via ansi seq also in make_console_stdio()

This appears to have been the intention of
00bc83a275fa3ca8d90579fe9597d8b651d47332, judging by the comments on
that.

16 months agoterminal-util: try to initialize rows/cols via ansi sequence in make_console_stdio()
Lennart Poettering [Wed, 10 Jul 2024 15:17:58 +0000 (17:17 +0200)] 
terminal-util: try to initialize rows/cols via ansi sequence in make_console_stdio()

Let's hook this up.

16 months agoterminal-util: add helper that adjust terminal width/height from data acquired via...
Lennart Poettering [Wed, 10 Jul 2024 14:33:10 +0000 (16:33 +0200)] 
terminal-util: add helper that adjust terminal width/height from data acquired via ANSI sequences

16 months agoterminal-util: add helper that queries terminal sizes via ANSI sequence
Lennart Poettering [Wed, 10 Jul 2024 14:02:52 +0000 (16:02 +0200)] 
terminal-util: add helper that queries terminal sizes via ANSI sequence

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.

16 months agoterminal-util: rename set_terminal_cursor_position() → terminal_set_cursor_position()
Lennart Poettering [Thu, 11 Jul 2024 08:31:02 +0000 (10:31 +0200)] 
terminal-util: rename set_terminal_cursor_position() → terminal_set_cursor_position()

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.

16 months agoterminal-util: when querying bg color, ensure input fd and output fd refer to same tty
Lennart Poettering [Wed, 10 Jul 2024 15:18:55 +0000 (17:18 +0200)] 
terminal-util: when querying bg color, ensure input fd and output fd refer to same tty

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.

16 months agoterminal-util: remember error code from tcsetattr()
Lennart Poettering [Fri, 12 Jul 2024 17:04:39 +0000 (19:04 +0200)] 
terminal-util: remember error code from tcsetattr()

16 months agoterminal-util: turn off echo on stdin, not stdout
Lennart Poettering [Wed, 10 Jul 2024 14:32:22 +0000 (16:32 +0200)] 
terminal-util: turn off echo on stdin, not stdout

This doesn't make much of a different IRL, but it feels more right that
an operation that happens in input is turned off via the input fd.

16 months agoterminal-util: don't process the same data twice when reading back bg color info
Lennart Poettering [Wed, 10 Jul 2024 14:06:30 +0000 (16:06 +0200)] 
terminal-util: don't process the same data twice when reading back bg color info

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.

16 months agoterminal-util: return correct error in chvt()
Lennart Poettering [Wed, 10 Jul 2024 14:32:35 +0000 (16:32 +0200)] 
terminal-util: return correct error in chvt()

16 months agoterminal-util: refuse a few more unexpected open flags in open_terminal()
Lennart Poettering [Wed, 10 Jul 2024 15:01:47 +0000 (17:01 +0200)] 
terminal-util: refuse a few more unexpected open flags in open_terminal()

16 months agoterminal-util: trivial white space fix
Lennart Poettering [Wed, 10 Jul 2024 15:17:20 +0000 (17:17 +0200)] 
terminal-util: trivial white space fix

16 months agoenv-util: suppress unnecessary setenv() in setenvf()
Lennart Poettering [Wed, 17 Jul 2024 15:54:09 +0000 (17:54 +0200)] 
env-util: suppress unnecessary setenv() in setenvf()

16 months agovmspawn: make "-n" just work
Lennart Poettering [Thu, 18 Jul 2024 13:39:39 +0000 (15:39 +0200)] 
vmspawn: make "-n" just work

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.

16 months agoMerge pull request #33591 from teknoraver/o_path
Luca Boccassi [Fri, 19 Jul 2024 09:01:01 +0000 (11:01 +0200)] 
Merge pull request #33591 from teknoraver/o_path

use O_PATH when possible

16 months agoMerge pull request #33770 from bluca/polkit-root
Luca Boccassi [Fri, 19 Jul 2024 08:57:07 +0000 (10:57 +0200)] 
Merge pull request #33770 from bluca/polkit-root

polkit: map POLKIT_ALWAYS_QUERY to new polkit flag

16 months agoman: Mention Type=oneshot timeout directive
Lucas Werkmeister [Tue, 16 Jul 2024 16:15:32 +0000 (18:15 +0200)] 
man: Mention Type=oneshot timeout directive

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.

16 months agoMerge pull request #33773 from kovalev0/fix_aquarius_cmp_ns483_keyb_and_sensor
Luca Boccassi [Thu, 18 Jul 2024 20:28:23 +0000 (22:28 +0200)] 
Merge pull request #33773 from kovalev0/fix_aquarius_cmp_ns483_keyb_and_sensor

Fix aquarius cmp ns483 keyboard and sensor

16 months agohwdb: add backslash and touchpad toggle mapping for Aquarius Cmp NS483 33773/head
Vasiliy Kovalev [Thu, 18 Jul 2024 18:58:55 +0000 (21:58 +0300)] 
hwdb: add backslash and touchpad toggle mapping for Aquarius Cmp NS483

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
16 months agohwdb: fix accelerometer mount matrix for Aquarius Cmp NS483
Vasiliy Kovalev [Thu, 18 Jul 2024 18:42:18 +0000 (21:42 +0300)] 
hwdb: fix accelerometer mount matrix for Aquarius Cmp NS483

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
16 months agoMerge pull request #33767 from keszybz/test-ukify-nicer
Luca Boccassi [Thu, 18 Jul 2024 15:59:55 +0000 (17:59 +0200)] 
Merge pull request #33767 from keszybz/test-ukify-nicer

Make test_ukify not use a real initrd

16 months agopolkit: fix typo in enum name 33770/head
Luca Boccassi [Thu, 18 Jul 2024 15:43:56 +0000 (16:43 +0100)] 
polkit: fix typo in enum name

16 months agol10n: fix credits for the French translation
Léane GRASSER [Thu, 18 Jul 2024 13:15:16 +0000 (15:15 +0200)] 
l10n: fix credits for the French translation

16 months agopolkit: map POLKIT_ALWAYS_QUERY to new polkit flag
Luca Boccassi [Thu, 27 Jun 2024 19:55:34 +0000 (20:55 +0100)] 
polkit: map POLKIT_ALWAYS_QUERY to new polkit flag

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.

16 months agoMerge pull request #33763 from DaanDeMeyer/mkosi
Daan De Meyer [Thu, 18 Jul 2024 14:43:15 +0000 (16:43 +0200)] 
Merge pull request #33763 from DaanDeMeyer/mkosi

mkosi: Two fixlets