Zbigniew Jędrzejewski-Szmek [Thu, 8 Apr 2021 07:45:28 +0000 (09:45 +0200)]
TEST-43: fix exit condition testing
We were invoking 'systemd-run bash', but the test invoked by bash
was not effective. When the result of that check is propagated, the
outer command fails.
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 22:09:55 +0000 (00:09 +0200)]
TEST-*: use spacing before redirection operator, but not after
<< EOF → <<EOF
> foo < bar → >foo <bar
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 23:27:33 +0000 (01:27 +0200)]
TEST-*: make failure tests actually fail on failure
Here the intent was actually correct, and the tests still pass when the check
is made effective.
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 23:23:49 +0000 (01:23 +0200)]
TEST-42-EXECSTOPPOST: un-invert test
Since we test for the file right below, it seems we expected the
command to succeed.
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 22:48:35 +0000 (00:48 +0200)]
tmpfiles: make handling of existing-but-different targets more consistent
create_fifo() was added in
a2fc2f8dd30c17ad1e23a31fc6ff2aeba4c6fa27, and
would always ignore failure. The test was trying to fail in this case, but
we actually don't fail, which seems to be correct. We didn't notice before
because the test was ineffective.
To make things consistent, generally log at warning level, but don't propagate
the error. For symlinks, log at debug level, as before.
For 'e', failure is not propagated now. The test is adjusted to match.
I think warning is appropriate in most cases: we do not expect a device node to
be replaced by a different device node or even a non-device file. This would
most likely be an error somewhere. An exception is made for symlinks, which are
mismatched on purpose, for example /etc/resolv.conf. With this patch, we don't
get any warnings with the any of the 74 tmpfiles.d files, which suggests that
increasing the warning levels will not cause too many unexpected warnings. If
it turns out that there are valid cases where people have expected mismatches
for non-symlink types, we can always decrease the log levels again.
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 22:09:38 +0000 (00:09 +0200)]
TEST-33-CLEAN-UNIT: fix broken test exposed by condition check fix
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 21:32:14 +0000 (23:32 +0200)]
TEST-22-TMPFILES: fix broken test exposed by condition check fix
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 21:24:25 +0000 (23:24 +0200)]
tests: make inverted tests actually count
"! test ..." does not cause the script to fail, even with set -e.
IIUC, bash treats this command as part of an expression line, as it
would if 'test ... && ...' was used. Failing expression lines do not
terminate the script.
This fixes the obvious cases by changing '! test' → 'test !'.
Then the inversion happens internally in test and bash will propagate
the failure.
Luca Boccassi [Tue, 6 Apr 2021 19:24:17 +0000 (20:24 +0100)]
Bump test-random-util timeout
It is using log_trace, which we enabled in the CI, so now it's
slower and it is timing out. Bump the timeout from 30s to 120s.
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 05:41:16 +0000 (07:41 +0200)]
Merge pull request #19135 from bluca/coredump_decode
coredump: parse build-id and .note.package
Luca Boccassi [Tue, 6 Apr 2021 14:48:52 +0000 (15:48 +0100)]
Add markdown doc about coredump package metadata
Luca Boccassi [Tue, 6 Apr 2021 17:02:41 +0000 (18:02 +0100)]
coredumpctl: parse and print package metadata
Luca Boccassi [Tue, 6 Apr 2021 17:24:01 +0000 (18:24 +0100)]
coredump: parse and append package metadata to journal message
Append 'package' and 'packageVersion' to the journal as discrete fields
COREDUMP_PKGMETA_PACKAGE and COREDUMP_PKGMETA_PACKAGEVERSION respectively,
and the full json blurb as COREDUMP_PKGMETA_JSON.
Luca Boccassi [Tue, 6 Apr 2021 17:21:48 +0000 (18:21 +0100)]
coredump: parse .note.package ELF section
Parse the .note.package ELF section for each ELF object
contained in a core file, if present.
Luca Boccassi [Thu, 18 Mar 2021 11:19:09 +0000 (11:19 +0000)]
coredump: parse build-id out of core file
Parse the build-id of each ELF object contained in the core file
using the elfutils' libdwfl interface.
Add it to the journal.
Luca Boccassi [Tue, 6 Apr 2021 17:52:11 +0000 (18:52 +0100)]
Merge pull request #19215 from braewoods/main
hwdb: 60-keyboard:: Add quirks for 2 new HP laptops
Lennart Poettering [Tue, 6 Apr 2021 09:46:19 +0000 (11:46 +0200)]
tpm2-util: properly load tpm2 libraries befre unsealing
We forgot a call to dlopen_tpm2() in the unseal codepaths. As long as
automatic TPM2 device discovery was used that didn't matter, since in
that codepaths we'd have another call dlopen_tpm2(). But with an
explicitly configured TPM2 device things should work too, hence add the
missing call.
Fixes: #19206
Lennart Poettering [Tue, 6 Apr 2021 09:45:54 +0000 (11:45 +0200)]
recovery-key: add some extra asserts
Let's ensure our key sizes calculations are correct.
This doesn't actually change anything, just adds more safety checks.
Inspired by #19203, but not a fix.
KoyamaSohei [Sat, 3 Apr 2021 16:13:37 +0000 (01:13 +0900)]
resolve: copy rd flag from the query to response
Sibo Dong [Sat, 3 Apr 2021 03:33:59 +0000 (23:33 -0400)]
bash-completion: localize words and cword variables
The words and cword variables are not localized in all Bash completion
scripts that call _init_completion.
cur, prev, words, and cword (and split if using the -s flag) are all
variables that should be localized in Bash completion scripts before
calling _init_completion (even if they don't otherwise appear in the
calling script). This is done for cur and prev, but not for words and
cword. Letting words and cword remain unlocalized may clobber variables
the user is using for other purposes, which is bad.
This issue can be resolved by declaring words and cword as local
variables.
Resolves #19188.
Luca Boccassi [Fri, 2 Apr 2021 15:30:43 +0000 (16:30 +0100)]
sysusers/firstboot: temporarily disable LoadCredential
Single-param LoadCredential= in units causes systemd v247/v248 to
assert when parsing. Disable it for now, until the fix is merged
in the stable trees, released and available (eg: in Debian
for the CI)
See: https://github.com/systemd/systemd/issues/19178
Lennart Poettering [Tue, 6 Apr 2021 09:45:27 +0000 (11:45 +0200)]
update
James Buren [Tue, 6 Apr 2021 07:18:26 +0000 (02:18 -0500)]
hwdb: 60-keyboard:: Add HP ProBook 455 G5 hotkey quirks
This enables all of the known hotkeys that were not working out of the
box on my test unit.
James Buren [Tue, 6 Apr 2021 06:32:37 +0000 (01:32 -0500)]
hwdb: 60-keyboard:: Add HP mt44 Mobile Thin Client hotkey quirks
This enables all of the known hotkeys that were not working out of the
box on my test unit.
Gibeom Gwon [Mon, 5 Apr 2021 14:11:23 +0000 (23:11 +0900)]
qrcode-util: set case-sensitive for generating QR codes
Until now, string treated case-insensitive, always converted to
uppercase. This can cause confusion such as user enter uppercased
recovery key.
Anita Zhang [Fri, 2 Apr 2021 09:49:37 +0000 (02:49 -0700)]
test-firewall-util: skip if iptables nat table does not exist
Zbigniew Jędrzejewski-Szmek [Tue, 6 Apr 2021 05:59:59 +0000 (07:59 +0200)]
Merge pull request #19126 from anitazha/oomdimprovements
systemd-oomd post-test week improvements
Frantisek Sumsal [Fri, 2 Apr 2021 17:51:44 +0000 (19:51 +0200)]
test: check if the unit file fuzzer corpora is up to date
This follows a similar pattern we already have in place for
networkd-related directives.
Anita Zhang [Fri, 26 Mar 2021 09:37:01 +0000 (02:37 -0700)]
oomd: threshold swap kill candidates to usages of more than 5%
In some instances, particularly with swap on zram, swap used will be high
while there is still a lot of memory available. FB OOMD handles this by
thresholding kills to X% of total swap usage. Let's do the same thing here.
Anecdotally with these thresholds and my laptop which is exclusively swap
on zram I can sit at 0K / 4G swap free with most of memory free and
systemd-oomd doesn't kill anything.
Partially addresses aggressive kill behavior from
https://bugzilla.redhat.com/show_bug.cgi?id=
1941170
Anita Zhang [Fri, 26 Mar 2021 08:53:15 +0000 (01:53 -0700)]
oomd: don't get pressure candidates on every interval
Only start collecting candidates for a memory pressure kill when we're
hitting the limit (but before the duration hitting that limit is
exceeded). This brings CPU util from ~1% to 0.3%.
Addresses CPU util from
https://bugzilla.redhat.com/show_bug.cgi?id=
1941340
and
https://bugzilla.redhat.com/show_bug.cgi?id=
1944646
Frantisek Sumsal [Fri, 2 Apr 2021 16:07:26 +0000 (18:07 +0200)]
fuzzer: add a test case for #19178
Luca Boccassi [Fri, 2 Apr 2021 16:56:13 +0000 (17:56 +0100)]
Merge pull request #19179 from anitazha/buildandtest
test-oomd-util: fix running in mkosi
Viktor Mihajlovski [Thu, 18 Mar 2021 10:03:34 +0000 (11:03 +0100)]
udev: fix slot based network names on s390
The s390 PCI driver assigns the hotplug slot name from the
function_id attribute of the PCI device using a 8 char hexadecimal
format to match the underlying firmware/hypervisor notation.
Further, there's always a one-to-one mapping between a PCI
function and a hotplug slot, as individual functions can
hot plugged even for multi-function devices.
As the generic matching code will always try to parse the slot
name in /sys/bus/pci/slots as a positive decimal number, either
a wrong value might be produced for ID_NET_NAME_SLOT if
the slot name consists of decimal numbers only, or none at all
if a character in the range from 'a' to 'f' is encountered.
Additionally, the generic code assumes that two interfaces
share a hotplug slot, if they differ only in the function part
of the PCI address. E.g., for an interface with the PCI address
dddd:bb:aa.f, it will match the device to the first slot with
an address dddd:bb:aa. As more than one slot may have this address
for the s390 PCI driver, the wrong slot may be selected.
To resolve this we're adding a new naming schema version with the
flag NAMING_SLOT_FUNCTION_ID, which enables the correct matching
of hotplug slots if the device has an attribute named function_id.
The ID_NET_NAME_SLOT property will only be produced if there's
a file /sys/bus/pci/slots/<slotname> where <slotname> matches
the value of /sys/bus/pci/devices/.../function_id in 8 char
hex notation.
Fixes #19016
See also #19078
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 13:53:16 +0000 (15:53 +0200)]
Merge pull request #18717 from yuwata/sd-device-monitor-introduce-more-filters
sd-device-monitor: introduce two new filters and use them in dissect-image.c
Carlo Teubner [Fri, 2 Apr 2021 08:03:02 +0000 (09:03 +0100)]
docs: use current spelling "macOS" not "OS X" etc.
Yu Watanabe [Sun, 21 Feb 2021 02:11:28 +0000 (11:11 +0900)]
dissect-image: move parent device check into device_is_partition()
Checking parent for enumerated devices is mostly redundant. Just for
safety.
Yu Watanabe [Sun, 21 Feb 2021 02:16:18 +0000 (11:16 +0900)]
dissect-image: also check devtype in device_is_partition()
This should be mostly redundant. Just for safety.
Yu Watanabe [Sun, 21 Feb 2021 02:00:19 +0000 (11:00 +0900)]
dissect-image: filter out enumerated or triggered devices without "partition" sysattr
This also adds more filters for device enumerator and monitor.
These newly added filters should be mostly redundant. But this hides
spurious error in sd_device_get_sysattr_value(). See,
https://github.com/systemd/systemd/pull/18684#discussion_r579700977
Yu Watanabe [Wed, 24 Feb 2021 05:05:03 +0000 (14:05 +0900)]
test: add tests for filters of sd-device-monitor
Yu Watanabe [Sun, 21 Feb 2021 00:54:55 +0000 (09:54 +0900)]
sd-device-monitor: introduce sd_device_monitor_filter_add_match_parent()
Yu Watanabe [Sun, 21 Feb 2021 00:53:50 +0000 (09:53 +0900)]
sd-device-enumerator: also move match_parent() to device-util.[ch]
Yu Watanabe [Sun, 21 Feb 2021 00:33:04 +0000 (09:33 +0900)]
sd-device-monitor: introduce sd_device_monitor_filter_add_match_sysattr()
Yu Watanabe [Sun, 21 Feb 2021 00:32:39 +0000 (09:32 +0900)]
sd-device-enumerator: move match_sysattr() to device-util.[ch]
It will be used by sd-device-monitor in later commits.
Yu Watanabe [Sat, 20 Feb 2021 22:53:31 +0000 (07:53 +0900)]
sd-device-monitor: split passes_filter() into two parts
Anita Zhang [Fri, 2 Apr 2021 02:06:26 +0000 (19:06 -0700)]
test-oomd-util: fix running in mkosi
When this test is run in mkosi, the previously tested cgroup that we write
xattrs into and the root cgroup are the same.
Since the root cgroup is a live cgroup anyways (vs. the test cgroups which are
remade each time) let's generate the expected preference values from reading
the xattrs instead of assuming it will be NONE.
Anita Zhang [Fri, 26 Mar 2021 08:19:10 +0000 (01:19 -0700)]
oomd: force DefaultMemoryPressureDurationSec= to be greater than or equal 1 sec
Anita Zhang [Fri, 26 Mar 2021 07:54:46 +0000 (00:54 -0700)]
oomd: delete unused variables
Anita Zhang [Sat, 27 Mar 2021 09:02:00 +0000 (02:02 -0700)]
oomd: rename last_hit_mem_pressure_limit -> mem_pressure_limit_hit_start
Since this is only changed the first time the limit is hit (and remains
set as long as the pressure remains over), I changed the name to better
reflect that.
Keeps consistent with "last_had_mem_reclaim" which is actually updated
every time there is reclaim activity.
Anita Zhang [Fri, 26 Mar 2021 07:39:25 +0000 (00:39 -0700)]
oomd: rework memory reclaim detection logic
systemd-oomd only monitors and kills within a selected cgroup subtree
For memory pressure kills, this means it's unnecessary to get the
pgscan rate across all the monitored memory pressure cgroups.
The increase will show up whether we do a total sum or not, but since
we only care about the increase in the subtree we're about to target
for a kill, we can simplify the code a bit by not doing this total sum.
Anita Zhang [Fri, 26 Mar 2021 06:54:22 +0000 (23:54 -0700)]
oomd: refactor pgscan_rate calculation into helper
Anita Zhang [Wed, 24 Mar 2021 09:17:04 +0000 (02:17 -0700)]
oomd: split swap and mem pressure event timers
One thing that came out of the test week is that systoomd needs to poll
more frequently so as not to race with the kernel oom killer in
situations where memory is eaten quickly. Memory pressure counters are
lagging so it isn't worthwhile to change the current read rate; however swap
is not lagging and can be checked more frequently.
So let's split these into 2 different timer events. As a result, swap
now also doesn't have to be subject to the post-action (post-kill) delay
that we need for memory pressure events.
Addresses some of slowness to kill discussed in
https://bugzilla.redhat.com/show_bug.cgi?id=
1941340
Anita Zhang [Fri, 2 Apr 2021 01:44:26 +0000 (18:44 -0700)]
meson: link with libm for math functions
Fixes this error I got building on F33:
/usr/bin/ld: test-random-util.p/src_test_test-random-util.c.o: undefined
reference to symbol 'sqrt@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libm.so.6: error adding symbols: DSO missing
from command line
Joerg Behrmann [Tue, 30 Mar 2021 14:29:59 +0000 (16:29 +0200)]
systemd-notify: Fix return value of --booted
Luca Boccassi [Thu, 1 Apr 2021 18:45:08 +0000 (19:45 +0100)]
Merge pull request #19175 from keszybz/maybe-unitialized-warning-2
Third batch of fixes and suppressions for maybe-unitialized warnings
Luca Boccassi [Thu, 1 Apr 2021 08:48:36 +0000 (09:48 +0100)]
resolved: use _cleanup_(gcry_md_closep) in one more place
Documentation says gcry_md_close will ignore a NULL input so should be safe:
https://gnupg.org/documentation/manuals/gcrypt/Working-with-hash-algorithms.html
Makes Coverity happy, follow-up for
248b1e0aa4
CID #
1451555
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 19:28:11 +0000 (21:28 +0200)]
libudev: fix return of udev_monitor_filter_add_match_subsystem_devtype()
Follow-up for
7117842657c0fc5a3446b6fe158615279cf2d650.
sd_device_monitor_filter_add_match_subsystem_devtype() now returns 1 to signify
that something was done, and 0 to signify that nothing was done, but
udev_monitor_filter_add_match_subsystem_devtype() needs to return 0 as documented.
udev_monitor_filter_add_match_tag() is adjusted to match.
This makes gdm start successfully here again.
Before, it would just not boot, with nothing very obvious in the logs:
gdm[1756]: Gdm: GdmDisplay: Session never registered, failing
Replaces #19171.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 09:12:57 +0000 (11:12 +0200)]
resolved: avoid passing unitialized variable
The issue was introduced in the refactoring in
775ae35403f8f3c01b7ac13387fe8aac1759993f.
We would pass an initialized value to a helper function. We would only *use*
it if it was initialized. But the mere passing of an unitialized variable is
UB, so let's not do that. This silences a gcc warning.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:37:11 +0000 (10:37 +0200)]
various: silence gcc warnings
AFAICT, gcc is just being stupid in all those cases.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:53:42 +0000 (10:53 +0200)]
shared/dissect-image: silence gcc warning
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:22:50 +0000 (10:22 +0200)]
sd-netlink: drop unnecessary forward declaration
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:19:07 +0000 (10:19 +0200)]
backlight: refactor get_max_brightness() to appease gcc
The old code was just fine, but gcc doesn't understand that max_brightness is
initialized. Let's rework it a bit to move some logic to the main function. Now
get_max_brightness() just retrieves and parses the attribute, and the main
function decides what to do with it.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:11:30 +0000 (10:11 +0200)]
test-device-util: let's verify that we return proper error from log_device_*
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:09:11 +0000 (10:09 +0200)]
sd-device: header needs an include because it uses sd_device type
Luca Boccassi [Thu, 1 Apr 2021 09:07:46 +0000 (10:07 +0100)]
Merge pull request #19168 from keszybz/nss-resolve-unfoobar
Fix nss-resolve reverse alias lookups
Luca Boccassi [Thu, 1 Apr 2021 08:36:46 +0000 (09:36 +0100)]
Merge pull request #19169 from keszybz/reenable-maybe-unitialized-warning
Fix a bunch of maybe-unitialized warnings but don't enable the warning yet
Deepak Rawat [Wed, 31 Mar 2021 16:44:07 +0000 (09:44 -0700)]
logind: Rename kexec reboot flag
Also change error message to be more meanigful. No change in
functionality.
Fixes:
0d96caa5c0
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 16:13:00 +0000 (18:13 +0200)]
basic/env-util: silence two gcc warnings
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 16:07:57 +0000 (18:07 +0200)]
cryptsetup: silence gcc maybe-unused warning
Simplify one debug stmt while at it.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 16:07:25 +0000 (18:07 +0200)]
systemctl: silence gcc maybe-unused warning
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:46:04 +0000 (17:46 +0200)]
shared/pretty-print: silence gcc warning
gcc was very unhappy for some reason:
[988/1664] Compiling C object systemd-oomd.p/src_oom_oomd.c.o
In file included from ../src/basic/path-util.h:10,
from ../src/shared/pretty-print.c:14,
from ../src/oom/oomd.c:15:
../src/shared/pretty-print.c: In function ‘conf_files_cat’:
../src/basic/strv.h:123:32: warning: ‘prefixes’ may be used uninitialized [-Wmaybe-uninitialized]
123 | for ((s) = (l); (s) && *(s); (s)++)
| ^
In file included from ../src/oom/oomd.c:15:
../src/shared/pretty-print.c:283:16: note: ‘prefixes’ was declared here
283 | char **prefixes, **prefix;
| ^~~~~~~~
../src/shared/pretty-print.c:305:12: warning: ‘is_collection’ may be used uninitialized in this function [-Wmaybe-uninitialized]
305 | if (!is_collection) {
| ^
../src/shared/pretty-print.c:301:13: warning: ‘extension’ may be used uninitialized in this function [-Wmaybe-uninitialized]
301 | r = conf_files_list_strv(&files, extension, root, 0, (const char* const*) dirs);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Maybe this is caused by the statis char** variables?
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:37:25 +0000 (17:37 +0200)]
core: silence gcc warning
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:32:04 +0000 (17:32 +0200)]
shared/bus-message-util: silence gcc warning
[1/429] Compiling C object src/shared/libsystemd-shared-248.a.p/bus-message-util.c.o
../src/shared/bus-message-util.c: In function ‘bus_message_read_dns_servers’:
../src/shared/bus-message-util.c:165:21: warning: ‘family’ may be used uninitialized in this function [-Wmaybe-uninitialized]
165 | r = in_addr_full_new(family, &a, port, 0, server_name, dns + n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/bus-message-util.c:165:21: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
../src/shared/bus-message-util.c:165:21: warning: ‘server_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]
The warning would be there despite all the asserts in bus_error_setfv() and
sd_bus_error_set(). So let's add an explicit assert.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:24:26 +0000 (17:24 +0200)]
shared/conf-parser: fix unitialized variable
Introduced in
4f9ff96a55187927a4164a19df580329f4c6522b.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:13:24 +0000 (17:13 +0200)]
test-capability: silence gcc warning
[2/3] Compiling C object test-capability.p/src_test_test-capability.c.o
../src/test/test-capability.c: In function ‘main’:
../src/test/test-capability.c:270:12: warning: ‘run_ambient’ may be used uninitialized in this function [-Wmaybe-uninitialized]
270 | if (run_ambient)
| ^
gcc-11.0.1-0.3.fc34.x86_64
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 12:21:21 +0000 (14:21 +0200)]
basic/cgroup-util: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 12:06:39 +0000 (14:06 +0200)]
sd-event: silence gcc's maybe-unitialized warning
[91/180] Compiling C object libsystemd.a.p/src_libsystemd_sd-event_sd-event.c.o
In file included from ../src/basic/macro.h:12,
from ../src/basic/alloc-util.h:9,
from ../src/libsystemd/sd-event/sd-event.c:11:
../src/libsystemd/sd-event/sd-event.c: In function ‘sd_event_wait’:
../src/fundamental/macro-fundamental.h:86:63: warning: ‘child_min_priority’ may be used uninitialized in this function [-Wmaybe-uninitialized]
86 | UNIQ_T(A, aq) < UNIQ_T(B, bq) ? UNIQ_T(A, aq) : UNIQ_T(B, bq); \
| ^
../src/libsystemd/sd-event/sd-event.c:3983:45: note: ‘child_min_priority’ was declared here
3983 | int64_t epoll_min_priority, child_min_priority;
| ^~~~~~~~~~~~~~~~~~
Alternative to #19159.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 10:43:00 +0000 (12:43 +0200)]
varlink: use two local flag variables to silence gcc warning
[59/655] Compiling C object src/shared/libsystemd-shared-248.a.p/varlink.c.o
../src/shared/varlink.c: In function ‘varlink_write’:
../src/shared/varlink.c:459:12: warning: ‘n’ may be used uninitialized in this function [-Wmaybe-uninitialized]
459 | if (n < 0) {
| ^
../src/shared/varlink.c: In function ‘varlink_process’:
../src/shared/varlink.c:541:12: warning: ‘n’ may be used uninitialized in this function [-Wmaybe-uninitialized]
541 | if (n < 0) {
| ^
../src/shared/varlink.c:486:17: note: ‘n’ was declared here
486 | ssize_t n;
| ^
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 09:46:31 +0000 (11:46 +0200)]
man: split the description of sd_bus_error_set()
It was one giant all of text in pseudo-random order. Let's split it into
paragraphs talk about one subject each.
And unfortunately, the description of what happens when the error is not
set was not correct. In general, various functions treat 0/NULL as
not-an-error, and return 0.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 09:45:15 +0000 (11:45 +0200)]
sd-bus: add asserts showing that sd_bus_error_setf() returns negative
(when name is specified).
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 09:27:15 +0000 (11:27 +0200)]
sd-bus: add assert to tell the compiler that the error code is positive
I was hoping it would help with the following gcc warning:
[35/657] Compiling C object src/shared/libsystemd-shared-248.a.p/bus-message-util.c.o
../src/shared/bus-message-util.c: In function ‘bus_message_read_dns_servers’:
../src/shared/bus-message-util.c:165:21: warning: ‘family’ may be used uninitialized in this function [-Wmaybe-uninitialized]
165 | r = in_addr_full_new(family, &a, port, 0, server_name, dns + n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/bus-message-util.c:165:21: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
../src/shared/bus-message-util.c:165:21: warning: ‘server_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]
It actually doesn't, but the compiler has a point here: the code is specified
in sd_bus_error_map[], and it has no way of knowning that we want it to be a
positive value.
I think this should be an assert, because if this assumption fails, a
programming error has occured, something that'd want to catch.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 09:09:39 +0000 (11:09 +0200)]
basic/fileio: silence gcc's maybe-unitialized warning
[11/657] Compiling C object src/basic/libbasic.a.p/fileio.c.o
../src/basic/fileio.c: In function ‘write_string_stream_ts’:
../src/basic/fileio.c:167:21: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
167 | if (futimens(fd, twice) < 0)
| ^~~~~~~~~~~~~~~~~~~
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 09:06:41 +0000 (11:06 +0200)]
basic/socket-util: add hint to silence gcc's maybe-unitialized warning
[59/1551] Compiling C object src/basic/libbasic.a.p/socket-util.c.o
../src/basic/socket-util.c: In function ‘socket_get_mtu’:
../src/basic/socket-util.c:1393:16: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1393 | *ret = (size_t) mtu;
| ^~~~~~~~~~~~
Zbigniew Jędrzejewski-Szmek [Mon, 29 Mar 2021 18:58:44 +0000 (20:58 +0200)]
resolved: drop unnecessary {}
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 14:48:04 +0000 (16:48 +0200)]
nss-resolve: define variables in the body
Same motivation as in the parent commit: let's define variables later, ideally
right when they are first initialized, so it's easier to figure out that they
are properly initialized.
error_id and r_tuple* were previously initialized, but I don't see why they
would need to be.
No functional change intended.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 14:20:30 +0000 (16:20 +0200)]
nss-resolve: fix parsing of io.systemd.Resolve.ResolveAddress reply
Since the switch to varlink in
0c73f4f075a2d23f7cabe708b589f19f4bbbec37, the
code wasn't functional. The JSON_VARIANT_UNSIGNED/JSON_VARIANT_STRING mismatch
meant that we'd reject any reply. Once past that, the code would use
unitialized 'c' and 'n' variables, so it's lucky we never got that far ;)
With -Wmaybe-unitialized, gcc would warn.
I think that declaring the huge list of local variables with very short names
at the top of the function was making it harder to understand what is going on
in the function. So let's rename the variables a bit, and initialize them upon
declaration if possible.
$ build/test-nss-hosts resolve 1.1.1.1 1.0.0.1 10.38.5.41
======== resolve ========
_nss_resolve_gethostbyaddr2_r("1.1.1.1") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"one.one.one.one"
AF_INET 1.1.1.1
_nss_resolve_gethostbyaddr_r("1.1.1.1") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error)
"one.one.one.one"
AF_INET 1.1.1.1
_nss_resolve_gethostbyaddr2_r("1.0.0.1") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"one.one.one.one"
AF_INET 1.0.0.1
_nss_resolve_gethostbyaddr_r("1.0.0.1") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error)
"one.one.one.one"
AF_INET 1.0.0.1
_nss_resolve_gethostbyaddr2_r("10.38.5.41") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"squid.redhat.com"
alias "squid.corp.redhat.com"
alias "squid2.corp.redhat.com"
alias "squid3.corp.redhat.com"
alias "squid4.corp.redhat.com"
alias "squid5.corp.redhat.com"
AF_INET 10.38.5.41
_nss_resolve_gethostbyaddr_r("10.38.5.41") → status=NSS_STATUS_SUCCESS
errno=999/--- h_errno=0/Resolver Error 0 (no error)
"squid.redhat.com"
alias "squid.corp.redhat.com"
alias "squid2.corp.redhat.com"
alias "squid3.corp.redhat.com"
alias "squid4.corp.redhat.com"
alias "squid5.corp.redhat.com"
AF_INET 10.38.5.41
(I have 10.38.5.41 squid.redhat.com squid.corp.redhat.com squid2.corp.redhat.com squid3.corp.redhat.com squid4.corp.redhat.com squid5.corp.redhat.com
in /etc/hosts for testing.)
Luca Boccassi [Tue, 23 Jun 2020 12:09:42 +0000 (13:09 +0100)]
portabled: add --extension parameter for layered images support
Add an --extension parameter to portablectl, and new DBUS methods
to attach/detach/reattach/inspect.
Allows to append separate images on top of the root directory (os-release
will be searched in there) and mount the images using an overlay-like
setup (unit files will be searched in there) using the new ExtensionImages
service option.
Luca Boccassi [Sat, 27 Mar 2021 19:11:08 +0000 (19:11 +0000)]
gcrypt: do not ignore return values
Check the return code from gcrypt's functions. In some
cases just log, as it shoulnd't really happen.
Fixes various Coverity issues:
CID #
1444702
CID #
1444704
CID #
1444706
CID #
1444711
CID #
1444712
CID #
1444713
Zbigniew Jędrzejewski-Szmek [Fri, 26 Mar 2021 16:09:13 +0000 (17:09 +0100)]
rpm: when disabling a unit, do not complain if systemd is not running
$ sudo dnf remove --installroot=/var/tmp/img1 systemd-networkd
...
Running scriptlet: systemd-networkd-248~rc4-4.fc32.x86_64 1/1
Removed /etc/systemd/system/multi-user.target.wants/systemd-networkd.service.
Removed /etc/systemd/system/sockets.target.wants/systemd-networkd.socket.
Removed /etc/systemd/system/dbus-org.freedesktop.network1.service.
Removed /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
(Another option would be make --now do nothing if systemd is not running.
But I think that's not too good. 'disable --now' doing nothing would be OK,
since if systemd is not running, the service is not running either, so we are
in the desired state. But that argument doesn't work for 'enable --now'. And
accepting 'disable --now' but not 'enable --now' seems overly complex. So I
think it is better to make the scriptlet handle this case explicitly.)
Also, let's reindent the file to 4 spaces. Very deeply nested scriptlets are
harder to read, and the triggers file is indented to 4 spaces already.
Jan Janssen [Fri, 26 Mar 2021 15:37:33 +0000 (16:37 +0100)]
resolved.conf: Add hostnames for default DNS servers
Deepak Rawat [Tue, 30 Mar 2021 03:22:16 +0000 (20:22 -0700)]
logind: Add new flag for kexec reboot
Add new flag to allow kexec reboot if kernel is already loaded.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 08:47:12 +0000 (10:47 +0200)]
Merge pull request #19109 from poettering/resolved-transaction-log-tweaks
resolved: minor tweaks to transaction logic and logging
Lennart Poettering [Tue, 23 Mar 2021 15:10:31 +0000 (16:10 +0100)]
shared: add new IMAGE_VERSION=/IMAGE_ID= field to /etc/os-release
This specifes two new optional fields for /etc/os-release:
IMAGE_VERSION= and IMAGE_ID= that are supposed to identify the image of
the current booted system by name and version.
This is inspired by the versioning stuff in
https://github.com/systemd/mkosi/pull/683.
In environments where pre-built images are installed and updated as a
whole the existing os-release version/distro identifier are not
sufficient to describe the system's version, as they describe only the
distro an image is built from, but not the image itself, even if that
image is deployed many times on many systems, and even if that image
contains more resources than just the RPMs/DEBs.
In particular, "mkosi" is a tool for building disk images based on
distro RPMs with additional resources dropped in. The combination of all
of these together with their versions should also carry an identifier
and version, and that's what IMAGE_VERSION= and IMAGE_ID= is supposed to
be.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 08:42:21 +0000 (10:42 +0200)]
Merge pull request #19064 from yuwata/resolve-fix-cache-19049
resolve: several trivial cleanups
gaoyi [Fri, 19 Mar 2021 07:16:56 +0000 (15:16 +0800)]
udevd: don't kill worker in manager_kill_workers when it's running
If worker is running, kill worker may lead uevent unprocessed.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 08:38:37 +0000 (10:38 +0200)]
Merge pull request #18990 from yuwata/network-dhcpv6-use-domains
network: also introduce UseDomains= for [DHCPv6] section
Lennart Poettering [Wed, 31 Mar 2021 08:37:49 +0000 (10:37 +0200)]
Merge pull request #19101 from poettering/mount-util-fixes
Make recursive bind remounting handle failures gracefully
Lennart Poettering [Tue, 23 Mar 2021 13:07:53 +0000 (14:07 +0100)]
dissect: make the --image= switch of our various tools honour Verity data
This adds simple Verity support to
mount_image_privately_interactively(): we dicover the verity metadata
and use it.
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 08:36:03 +0000 (10:36 +0200)]
Merge pull request #18989 from yuwata/ordered-set-put-strdup
ordered-set: make ordered_set_put_strdup() allocate OrderedSet object
Lennart Poettering [Tue, 23 Mar 2021 13:05:56 +0000 (14:05 +0100)]
repart: make sure CopyFiles= works with a / suffixed path
If we define a partition with CopyFiles=/efi/ this should just work.
However it previously didn't because basename() would return the
trailing slash.
Let's fix this by moving things to path_extract_{directory|filename}()
Lennart Poettering [Fri, 19 Mar 2021 17:34:06 +0000 (18:34 +0100)]
machine-id-setup: support --image= mode