1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00
Commit Graph

49237 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
38d1e12063 sd-bus: drop some bitfields in sd_bus_slot
A hole was/is present after the booleans, so changing them to be one byte each
doesn't change the structure size (122 bits on amd64). If we add more stuff
later, it might make sense to turn some of those into bitfields again. For now,
let's take the easy route. EINVAL fits into type now.

Code size it minimally reduced:
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 10 14:00 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109712 Feb 10 14:01 build/libsystemd.so.0.30.0
2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
399f74c79d sd-netlink: pahole optimization of sd_netlink_slot
By rearranging the fields, we can avoid one of the holes (on amd64).
By adding more space for .type, -EINVAL can be used as a value later on.
The structure is reduced from 96 to 88 bytes (on amd64).

Text size is also smaller:
-rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb  9 19:50 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb  9 19:51 build/libsystemd.so.0.30.0
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
4d24463211 shared/json: make JsonVariant.type field wider
pahole shows that this doesn't make a difference, but we can fit -EINVAL
into .type without warnings.
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
755c6d5923 sd-event: drop one bitfield from sd_event_source
pahole analysis confirms that the structure size does not change (there
was/is a hole after the sequence of bitfields anyway).
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
ec08f27069 core: drop bitfields in Manager object
Every bitfield may make the object a little smaller, but requires additional
code when accessing the field. So it only makes sense in objects that are
created in many many copies. The Manager is pretty much a singleton.

-rwxrwxr-x 1 zbyszek zbyszek 4443840 Feb  9 16:14 build/systemd
-rwxrwxr-x 1 zbyszek zbyszek 4442552 Feb  9 16:42 build/systemd

We save 1288 bytes of code by "wasting" a few bytes on storage. (The speed
advantages are probably more important, but harder to measure…)
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
61b315de9b Add comma in structured initialization in a few places
It just looks nicer…
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
170d40260b core: do not initialize variable which is unconditionally set below 2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
3c3cd61e75 test-tables: make the assert more readable
Doing it all in one line and with negation in front seemed like a good
idea at some point, but I think it is vastly easier to understand when
it is split out a bit.
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
b357fe57b2 test-tables: fix warning about NULL used in printf
With the simplified asserts, newer gcc is able to (correctly) figure
out that NULL was being passed.
2021-02-10 14:43:10 +01:00
Luca Boccassi
0f15cb2243
Merge pull request #18470 from mrc0mmand/ci-clang-12
ci: run build test with clang-12 as well
2021-02-09 13:06:40 +00:00
Zbigniew Jędrzejewski-Szmek
5bbf331434
Merge pull request #18416 from yuwata/strverscmp
util: introduce strverscmp_improved()
2021-02-09 14:06:18 +01:00
Zbigniew Jędrzejewski-Szmek
4ef8478eb5 fuzz-journal-remote: do not assert on resource conditions
We have a number of issues where oss-fuzz reports input-independent crashes of
fuzz-journal-remote. Instead of asserting that stuff that allocated fds and
memory never fails, let's instead just return an error.

https://oss-fuzz.com/testcase-detail/4791099424112640
https://oss-fuzz.com/testcase-detail/4531912477638656

I don't see any docs as to whether LLVMFuzzerTestOneInput() is allowed to
return non-zero. Propagating the error code is easiest, so let's just do that.
If it turns out that this causes oss-fuzz to still report a failure, we can
suppress that later.
2021-02-09 13:59:01 +01:00
Yu Watanabe
7bc38f59dc log: do not use uninitialized value
Follow-up for 85cf96e3f5.
2021-02-09 13:58:12 +01:00
Frantisek Sumsal
67c972c610 ci: temporarily pin Arch repositories to glibc 2.32-5
glibc 2.33-3 shipped on 2021-02-06 breaks running Arch containers on
systems with older kernels (like Ubuntu Focal). Until the issue is
resolved, let's pin the Arch repositories to glibc 2.32-5 to mitigate
the annoying CI fails.

See: https://bugs.archlinux.org/task/69563
2021-02-09 13:57:28 +01:00
Zbigniew Jędrzejewski-Szmek
f47df388a0
Merge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname
hostnamectl: try to set transient hostname even if setting static or pretty hostname failed
2021-02-09 12:42:25 +01:00
Yu Watanabe
beb75dd31d test-network: support protocol and linkdown flag for ff00::/8 route
Fixes #18507.
2021-02-09 12:25:27 +01:00
Kevin P. Fleming
12f7469bbe network: Delay addition of IPv6 Proxy NDP addresses
Setting of IPv6 Proxy NDP addresses must be done at the same
time as static addresses, static routes, and other link attributes
that must be configured when the link is up. Doing this ensures
that they are reconfigured on the link if the link goes down
and returns to service.
2021-02-09 19:56:56 +09:00
Yu Watanabe
8087644a13 tree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved() 2021-02-09 14:25:03 +09:00
Yu Watanabe
87b7d9b6ff string-util: introduce strverscmp_improved()
Unfortunately, strverscmp() from libc or str_verscmp() do not correctly
handle pre-release version, e.g. 247 vs 247~rc1.

This implement a new comparison function, which is based on the RPM's
rpmvercmp().
2021-02-09 14:24:58 +09:00
Yu Watanabe
e5bc5f1f5a fundamental: move several macros and functions into src/fundamental/
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.

Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
2021-02-09 14:22:54 +09:00
Yu Watanabe
822be62fb2 hostnamectl: use Table 2021-02-09 13:49:27 +09:00
Yu Watanabe
f2d3ec7abf hostnamectl: show hint when user try to set transient hostname but static hostname is already used 2021-02-09 13:49:27 +09:00
Yu Watanabe
e8acf09186 hostname: use free_and_strdup_and_warn() 2021-02-09 13:49:27 +09:00
Yu Watanabe
ba12e41d05 hostname: re-read file later when failed to update file
Previously, even when writing e.g. /etc/hostname fails, the static
hostname in Context is not restored. So, the subsequent call of the same
method succeeds:
```
$ sudo chattr +i /etc/hostname
$ sudo hostnamectl --static set-hostname aaa
Could not set static hostname: Access denied
$ echo $?
1
$ sudo hostnamectl --static set-hostname aaa
$ echo $?
0
```

This makes when updating file is failed, the saved stat is cleared. So,
the static hostname or machine information in the context are always
consistent to the corresponding files.
2021-02-09 13:49:27 +09:00
Yu Watanabe
c388618ec0 hostnamectl: unset pretty hostname only when no target is specified 2021-02-09 13:49:27 +09:00
Yu Watanabe
2d79e90a1f hostnamectl: try to set transient hostname even if updating static or pretty hostname failed
If no target (--pretty, --static, or --transient) is specified, then
let's try to set transient hostname even if setting static or pretty
hostname failed. This may be useful for read-only filesystem.
2021-02-09 13:49:15 +09:00
Yu Watanabe
957991b7ac hostname: introduce two bus errors for updating file 2021-02-09 13:37:27 +09:00
Yu Watanabe
0ce2a086da bus-error: align error definitions 2021-02-09 13:37:27 +09:00
Yu Watanabe
5c3d2e3f43 hostnamectl: improve log message on failure 2021-02-09 13:37:27 +09:00
Gablegritule
5f33b2300b
hwdb: add axis overrides for the Dell Latitude E5510 TouchPad (#18493)
I added an entry for Dell Latitude E5510 TouchPad to set up the true size
of the TouchPad (the size is currently over-estimated)
2021-02-09 09:30:49 +10:00
Frantisek Sumsal
0c69f2ee26
Merge pull request #18478 from mrc0mmand/fix-TEST-06
TEST-06-SELINUX fixes
2021-02-08 12:34:13 +01:00
Frantisek Sumsal
8762049792 tree-wide: fix the string concatenation warning with clang-12
e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "/usr/lib/os-release\0",
                                      ^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
                [META_OS_RELEASE]   = "/etc/os-release\0"
                                      ^
1 error generated.

See: https://reviews.llvm.org/D85545
2021-02-08 12:22:03 +01:00
Zbigniew Jędrzejewski-Szmek
ad22e7cf5c
Merge pull request #18375 from yuwata/cli-tools-also-read-kernel-command-line
tree-wide: make CLI tools also read kernel command line when run as service
2021-02-08 11:45:42 +01:00
Zbigniew Jędrzejewski-Szmek
07ffdcf915
Merge pull request #18331 from yuwata/test-udev-event-spawn
udev: add tests for udev_event_spawn()
2021-02-08 11:10:36 +01:00
Antonius Frie
4d0052d52f
Use correct config parser for MountAPIVFS (#18501)
As far as I can see, at some point the parser function for MountAPIVFS
was changed from the generic bool parser to a custom implementation, to
allow the context to keep track of whether MountAPIVFS had been set
explicitly. If not, exec_context_get_effective_mount_apivfs would fall
back to a default value. However, the corresponding entry in the big
parser table wasn't updated, meaning that the old bool parser was still
used, meaning that context->mount_apivfs_set remained at its default
value of false, meaning that the default value was always used and the
config option was effectively ignored.

Fix for 5e98086d16.
2021-02-08 09:15:15 +01:00
cprn
8e45c72cf5
hwdb: add Acecad Flair / Pentagram Quadpen (#18443) 2021-02-07 12:33:43 +01:00
Luca Boccassi
2a8e00846f
Merge pull request #18490 from keszybz/prettify-update-dbus-docs
Prettify update-dbus-docs
2021-02-06 15:36:39 +00:00
Zbigniew Jędrzejewski-Szmek
64eb60b8c5 update-dbus-docs: use color in summary 2021-02-06 11:41:42 +01:00
Zbigniew Jędrzejewski-Szmek
7bd5b8614d update-dbus-docs: say "MODIFIED" not "OUTDATED"
When executed in test mode, "OUTDATED" is appropriate. But when executed
to actually update the text, after the tool executes, those pages are the
opposite, not outdated.
2021-02-06 11:41:42 +01:00
Lennart Poettering
900915080a copy: use stat_verify_directory() where appropriate 2021-02-06 10:37:10 +00:00
Julia Cartwright
afe6a9c48e man: fix misspellings of "NameSeviceSwitch"
Fixup NameSeviceSwitch -> NameServiceSwitch spelling error in
documentation.

Found through inspection of documentation.
2021-02-06 00:00:44 +00:00
Weblate (bot)
33c85738ee
Translations update from Weblate (#18485)
* Translated using Weblate (Swedish)

Currently translated at 100.0% (189 of 189 strings)

Translation: systemd/main
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
2021-02-05 23:54:58 +00:00
Lennart Poettering
5055b51ee1 github: ask for systemd version in RFE form
It happens too often that what people ask for already is implemented.
Let's help cut the noise a bit, and make people check things first
hopefully, and at least make it either for us to detect such cases.
2021-02-05 23:42:47 +00:00
Lennart Poettering
f8f5b8d864 resolved: suppress ifindex info in varlink JSON responses if zero
If we don't have ifindex info, don't set the field for it.

We already do that for parsed IP address replies, let's do it for all
cases: it's a bit nicer to suppress the ifindex prop if it doesn't apply
than to pass it invalid.

This is the other side of #18482, i.e. fixes things so that the parser
doesn't get tripped up by this.

(This too makes a problem go away we should track down properly, i.e.
figure out how the ifindex got lost in
https://github.com/systemd/systemd/pull/17823#issuecomment-742439422 )
2021-02-06 00:17:10 +01:00
Lennart Poettering
9c09454dce
Merge pull request #18482 from poettering/resolved-nss-varlink-ifindex-fix
nss-resolve: handle zero ifindex reply from server
2021-02-06 00:16:28 +01:00
Lennart Poettering
425ed13991 nss-resolve: shortcut fixing of ifindex if it's zero anyway 2021-02-05 18:46:18 +01:00
Lennart Poettering
6da52ca861 nss-resolve: accept zero ifindex when parsing resolved reply
Sometimes a reply isn't associated to any specific interface, it might
be a general truth (for example served from /etc/hosts or so). In this
case the server might pass ifindex == 0. Accept that.

https://github.com/systemd/systemd/pull/17823#issuecomment-742439422
2021-02-05 18:44:22 +01:00
Lennart Poettering
cb3363ef7a
Merge pull request #18318 from yuwata/network-route-table-name
network: RouteTable= improvements
2021-02-05 18:08:56 +01:00
Ali Abdallah
3deed59afd PATCH] Always free deserialized_subscribed on reload
Otherwise, it will keep consuming memory on systemctl daemon-reload.
2021-02-05 18:04:55 +01:00
Frantisek Sumsal
01da74243d test: add a custom SELinux file context
Since the test suite overhaul, the test units are now under
/usr/lib/systemd/tests/testdata/tetsuite-06.units with
system_u:object_r:lib_t context. This causes an AVC denial, since the
systemd unit files are expected to have the
system_u:object_r:systemd_unit_file_t context. Let's fix this by using a
custom file context definition.
2021-02-05 17:08:58 +01:00