1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00
Commit Graph

51628 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
412339835e man/check-os-release.py: strip trailing whitespace
The shell parser would do that, so so should we.
2021-05-22 12:20:51 +02:00
Zbigniew Jędrzejewski-Szmek
c0527e1f95 man: say that initrd-release is like os-release 2021-05-22 12:20:51 +02:00
Hans de Goede
eb281f3eff hwdb: Add accel orientation quirk for the KD Kurio Smart C15200 tablet
Add a quirk to fix the accelerometer orientation on the
KD Kurio Smart C15200 tablet.
2021-05-22 12:13:42 +02:00
Lennart Poettering
c3565fe81f sleep: clarify that failure setting env var is not fatal 2021-05-22 11:00:04 +02:00
Lennart Poettering
3d1321117e sleep: if hybrid sleep fails, do regular suspend
Fixes #19550
2021-05-22 11:00:04 +02:00
Lennart Poettering
b0c035e3c8 sleep: remove duplicate logging
execute() logs about all errors, hence only log about what's new, i.e.
what we'll do as consequence, and don't mention the error cause again.
2021-05-22 11:00:04 +02:00
Lennart Poettering
887b2019b6 sleep: don't check for EADV
EADV is not generated anymore since
6d176522f5, let's hence not check for it
anymore.
2021-05-22 11:00:00 +02:00
Lennart Poettering
61dc84817e sleep: can_sleep_state() + can_sleep_disk() don#t return plain booleans 2021-05-22 11:00:00 +02:00
Lennart Poettering
c8cd8ca398 sleep: use SleepOperation enum everywhere and drop sleep_settings()
Instead of comparing strings everywhere, let's use the new enum. This
allows us to drop sleep_settings(), since the operation enum can be
directly used as index into the config settings.

Some minor other refactoring is done, but mostly just shifting thing
around a bit, no actual change in behaviour.
2021-05-22 11:00:00 +02:00
Lennart Poettering
be2a4b0d7e sleep: introduce high-level SleepOperation enum 2021-05-22 10:58:22 +02:00
Lennart Poettering
86204ae145 units: make sure importd has CAP_LINUX_IMMUTABLE flag
Since d8f9686c0f we use the chattr +i flag
for marking containers in directories as reead-only. But to do so we
need the cap for it, hence grant it.

Fixes: #19115
2021-05-22 16:02:02 +09:00
Yu Watanabe
af92e46527
Merge pull request #19594 from yuwata/network-nexthop-group
network: nexthop: add Group= setting to configure multipath route with group nexthop
2021-05-22 16:01:13 +09:00
Yu Watanabe
a6c747a63f
Merge pull request #19691 from poettering/read-virtual-file-tweaks
tweaks to read_virtual_file()
2021-05-22 15:59:17 +09:00
Zbigniew Jędrzejewski-Szmek
fe7f113c13 units: skip some units in the initrd
I'm working on building initramfs images directly from normal packages, and it
doesn't make sense for those units to be started. Pristine system rpms need to
behave correctly as much as possible also in the initrd, and those units are
enabled by the rpms. There usually isn't enough time for the timer to actually
fire, but starting it gives a line on the console and generally looks confusing
and sloppy. Flushing the journal means that its actually lost, since the real
/var is not available yet.

Another approach would be not enable those units, but right now they are
statically enabled, and changing that would be more work, and doesn't really
seem necessary, since the condition checks are very quick.

Checking for /etc/initrd-release is the standard condition that the initrd
units use, so let's do the same here.
2021-05-22 15:58:40 +09:00
Yu Watanabe
9c8f90d0f9 test-network: add a test case for nexthop Group= setting 2021-05-22 04:59:45 +09:00
Yu Watanabe
228c3e21e9 network: nexthop: add Group= setting to configure multipath route with group nexthop 2021-05-22 04:59:40 +09:00
Yu Watanabe
8031e5ca8d network: nexthop: IFF_UP flag is required for nexthops which attached to a link 2021-05-22 04:56:46 +09:00
Yu Watanabe
7b3a7581e3 network: make nexthop_add(), nexthop_configure() and friends return 0 on success
After request queue is introduced, the return value on success is unused.
2021-05-22 04:56:46 +09:00
Lennart Poettering
b2d0b90f54 fileio: read_virtual_file(): on last attempt ignore file size
Apparently the reported file size was misleading on this file, hence
ignore it on our last loop attempt and just pretend it wasn't reported
at all.
2021-05-21 21:54:44 +02:00
Lennart Poettering
eff722c693 test-fileio: run read_virtual_file() for a couple of more interesting sizes 2021-05-21 21:54:44 +02:00
Lennart Poettering
8461d6da35 test-fileio: fix confusing log output
Previously we'd pass all return values of read_virtual_file() to
log_info_errno() as error, but that makes no sense, given that we
sometimes return positive one with means "not truncated" but we'd show
as "Permission denied. Let's fix this, and log differently for sucess
and error.
2021-05-21 21:54:43 +02:00
Lennart Poettering
fd3c6992d9 fileio: read_virtual_file() don't tweak buffer for returning it when we aren't returning it
Let's avoid some redundant work.

Moreover, let' not check for NUL bytes in the buffer if we don't return
the buffer.
2021-05-21 21:54:43 +02:00
Lennart Poettering
259f6de486 fileio: fix typo in comment 2021-05-21 21:54:43 +02:00
Lennart Poettering
136f12a26a fileio: read_virtual_file(): exit once the max_size limit is reached
Alternative to: #19682
2021-05-21 21:54:19 +02:00
Lennart Poettering
1b5e91a8d2 fileio: if we try to read a file larger than SIZE_MAX this is not a problem if a max_size is specified
i.e. 32bit userspace reading /proc/kcore on a 64bit kernel with max_size
should not needlessly fail.
2021-05-21 21:54:19 +02:00
Yu Watanabe
234106dbf9 network: route: make stored multipath route weight equivalent to hop of nexthop 2021-05-22 04:54:09 +09:00
Yu Watanabe
11a288e846 ethtool-util: downgrade log level
This just hides issue #19625. It will be fixed in later commits.
2021-05-22 04:40:54 +09:00
Luca Boccassi
0557680919 test-env-util: use streq_ptr when comparing directly the result of getenv
It might return NULL.

Fixes CID #1453247
2021-05-22 03:05:53 +09:00
Lennart Poettering
f5e775973a sd-device: use strjoina() more again in sd_device_new_from_subsystem_sysname()
This reverts a major part of: e17c95af8e

Using format strings for concatenating strings is pretty unefficient,
and using PATH_MAX buffers unpretty as well. Let's revert to using
strjoina() as before.

However, to fix the fuzz issue at hand, let's explicitly verify the two
input strings ensuring they are valid path names. This includes a length
check (to 2K each), thus making things prettier, faster and using less
memory again.
2021-05-21 17:52:57 +02:00
Lennart Poettering
a6383f1e93
Merge pull request #19676 from bluca/coverity
Fix two new coverity issues
2021-05-21 17:52:36 +02:00
Lennart Poettering
2c80660557
Merge pull request #19672 from yuwata/strextend
tree-wide: introduce strextendf_with_separator() and use strextend() or freinds
2021-05-21 17:52:14 +02:00
Zbigniew Jędrzejewski-Szmek
8fd67ab5a3 man: reword description of BUILD_ID in os-release
Our description was pretty hard to parse. Let's replace it with a description
loosely based on a fairly clear description written by a distro that actually
uses BUILD_ID:
https://developer.rigado.com/docsets/Working-with-the-Rigado-Vesta-Gateway/latest/production/versioning-images.html#the-rigos-scheme.
2021-05-21 17:06:28 +02:00
Lennart Poettering
674d8dcc47
Merge pull request #19647 from ddstreet/test-oomd-failure
handle lack of kernel support for some cgroup files
2021-05-21 16:35:16 +02:00
Zbigniew Jędrzejewski-Szmek
3ca606d103 man: add example os-release mangling in python
This is also not entirely obvious. I think the code I came
up with is pretty elegant ;] The final part of of the code that makes
use of the parsed data is kept very similar to the shell code on purpose,
even though it could be written a bit more idiomatically.
2021-05-21 16:33:04 +02:00
Zbigniew Jędrzejewski-Szmek
e839ebe551 man: add an example how to correctly read os-release in shell
This is not entirely obvious.

The logic of how to interpret the fields applies in any language, so drop the
pointless mention of C or shell.
2021-05-21 16:32:54 +02:00
Zbigniew Jędrzejewski-Szmek
00e3abe024 man: reorder fields in os-release
Let's order the fields from the most general to least: os name, os variant, os
version, machine-parseable version details, metadata, special settings. I added
section headers to roughly group the settings. The division is not strict,
because for example CPE_NAME also includes the version, and PRETTY_NAME may
too, but it still makes it easier to find the right name.

Also split out Examples to separate paragraphs:
almost all descriptions had "Example:" at the end, where multiple
examples were listed. Splitting this out to separate paragraphs
makes the whole thing much easier to read.

Add missing markup and punctuation while at it.

About
- If not set, defaults to <literal>NAME=Linux</literal>.
+ If not set, a default of <literal>NAME=Linux</literal> may be used.
and similar changes: in many circumstances, if this is not set, no value should
be used. The fallback mostly make sense when we need to present something to the
user. So let's reword this to not imply that the default is necessary.
2021-05-21 12:24:14 +02:00
Yu Watanabe
e8f99f4e24 network: fix an infinite loop
Fixes #19467.
2021-05-21 12:03:01 +09:00
asavah
670427a4d4 man: prevent race condition when generating systemd.directives.xml 2021-05-20 20:49:50 +01:00
Dan Streetman
135400276c oom: log one-time warning if kernel doesn't provide memory.swap.current
The kernel can be compiled without support for any memory.swap.* files, or
it can be disabled at boot time with the 'swapaccount=0' boot parameter,
so if the file doesn't exist log warning indicating the kernel doesn't
support the file and the user may need to try using the 'swapaccount=1'
boot param.

Note that the actual error from the call to fopen() is ENOENT, but
that is translated into ENODATA in cg_get_attribute_as_uint64()
2021-05-20 15:40:29 -04:00
Dan Streetman
0de2fd1870 psi: update is_pressure_supported to read file
The kernel still provides the /proc and cgroup pressure files even
if its psi support is disabled, so we need to actually read the files
to verify they don't return -EOPNOTSUPP
2021-05-20 15:40:21 -04:00
Dan Streetman
264f0afe0d log: add log_once() and log_once_errno() macros
These macros will log a message at the specified level only the first time
they are called. On all later calls, if the specified level is debug, the
logs will be suppressed; otherwise the message will be logged at debug.
2021-05-20 15:39:15 -04:00
Dan Streetman
ea42da3825 macro: add ONCE macro that evaluates to 1 one time
Every location that this macro is used, it will be true the first
time it's checked, then false each time after that.

This can be useful for things such as one-time logging.
2021-05-20 15:39:15 -04:00
Lennart Poettering
f267c3142a fileio: make return parameters of read_virtual_file() optional
Prompted by: #19647
2021-05-20 15:39:03 -04:00
Lennart Poettering
9d54c9a3d9
Merge pull request #19551 from cgzones/fix_reload
selinux: reload label db on policy load with libselinux 3.2
2021-05-20 21:37:59 +02:00
Lennart Poettering
f9e60ff9ad
Merge pull request #19605 from yuwata/network-fdb-outgoing-interface
network: bridge-fdb: add support to specify outgoing interface
2021-05-20 21:33:14 +02:00
Yu Watanabe
e6655fbe40 man: mention that drop-in files are merged in alphanumeric order
This addresses the request in https://github.com/systemd/systemd/issues/19467#issuecomment-829332877.
2021-05-20 21:20:51 +02:00
Yu Watanabe
580bf61304 sysv-generator: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe
742a011a3a systemctl: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe
eda397c966 run: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe
cfea7618f2 nspawn: use strextendf_with_separator() 2021-05-20 21:57:04 +09:00