1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-29 21:55:36 +03:00
Commit Graph

56047 Commits

Author SHA1 Message Date
Frantisek Sumsal
524cc9d1d8 test-network: disable 'no-member' warning for the Utilities class
The warning is correct, since we don't inherit the necessary
unittest.TestCase class, but that's on purpose, since the Utilities
class is not supposed to be instantiated on its own, but should
complement other classes' definitions which do inherit from the
unittest.TestCase class.
2022-02-03 19:13:06 +01:00
Frantisek Sumsal
283863a116 test-network: use raw strings for regexes with backslashes
It currently works because `\(` and `\)` are not valid escape sequences,
so they're not treated differently. Using raw strings (or double
backslashes) is a more correct solution.
2022-02-03 18:55:12 +01:00
Frantisek Sumsal
535e8107ee test-network: explicitly set check=False for subprocess.run()
since we're checking the returned error code explicitly via the
`returncode` member.
2022-02-03 18:49:35 +01:00
Frantisek Sumsal
f7805a6c79 test-network: convert certain multiline strings to comments
Multiline comments are converted to docstrings only when they're the
first statement in a function/method. Even though they're still a no-op
otherwise, let's use "true" comments to make pylint happy.
2022-02-03 18:42:41 +01:00
Frantisek Sumsal
45dbd0b945 test-network: drop unused variables 2022-02-03 18:18:29 +01:00
Frantisek Sumsal
19aa7f99c7 test-network: drop unnecessary else statements 2022-02-03 18:18:29 +01:00
Frantisek Sumsal
6983bb0e5e test-network: drop unnecessary semicolons 2022-02-03 18:18:27 +01:00
Frantisek Sumsal
83bceef027 test-network: drop superfluous parens 2022-02-03 18:10:06 +01:00
Lennart Poettering
5d04cec867 journal: when copying journal file to undo NOCOW flag, go via fd
We have the journal file open already, hence reference it via the fd
insted of the file name. After all, some other tool might have
renamed/deleted it already.

Let's not actually reuse the fd though, since we want a separate file
offset for the copying, hence just make it simply and reopen via
/proc/self/fd/.

Follow-up for d71ece3f0b
2022-02-03 11:34:24 +01:00
Evgeny Vereshchagin
be496d6a9b tests: pass FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION to fuzzers
to let them use reproducible identifiers, which should make it possible
to really use files copied from OSS-Fuzz to reproduce issues on
GHActions and locally. Prompted by https://github.com/systemd/systemd/pull/22365
2022-02-03 08:56:00 +00:00
Lennart Poettering
362c62296a sd-boot: rename LOADER_STUB → LOADER_UNIFIED_LINUX
No actual code changes, just renaming.

Rationale: the focus here should be on the fact that these are "unified"
images, whether our stub is used or not, or something else doesn't
really matter. Moreover, these are still Linux entries. Hence, emphasize
that these are *unified* images, and *Linux* images, and deemphesize
that our sd-stub is likely used.
2022-02-03 13:44:28 +09:00
Evgeny Vereshchagin
697bb76589 tests: fuzz client_send_message
to make sure outgoing packets based on incoming packets are fine.
It's just another follow-up to
https://github.com/systemd/systemd/pull/10200.
Better late than never :-)
2022-02-03 13:43:49 +09:00
Lennart Poettering
a24e3938e8 udevadm: don't claim a sysattr was write only just because we get EPERM on read
it might be totally inaccessible, hence weaken our language a bit and
just say "not readable", thus making not claim whether it is writable or
not.

Follow-up for 3a90bef55a
2022-02-03 07:32:54 +09:00
Anita Zhang
3a17ffa68e
Merge pull request #22373 from DaanDeMeyer/journald-file-rename
journal: Rename JournaldFile to ManagedJournalFile
2022-02-02 13:53:18 -08:00
Luca Boccassi
5c10b98350
Merge pull request #22358 from yuwata/udevadm-test-support-dev-path-or-device-unit
udevadm: test,test-builtin: support /dev path or device unit
2022-02-02 15:32:20 +00:00
Yu Watanabe
84e8602dfe test: use rm_rf_physical_and_freep cleanup function 2022-02-02 15:31:40 +00:00
Daan De Meyer
d02af6f33b journal: Rename JournaldFile to ManagedJournalFile
JournalFile and JournaldFile are hard to distinguish from each other.
Let's use ManagedJournalFile instead to make the distinction more clear.
2022-02-02 14:39:39 +00:00
Yu Watanabe
613d65d88f network: update operational state when we remove an address 2022-02-02 20:44:47 +09:00
Evgeny Vereshchagin
9216fddc5a dhcp-identifier: always use a fixed machine-id while fuzzing
It's a follow-up to https://github.com/systemd/systemd/pull/10200 where
that fuzzer was introduced. At the time it was run regularly on machines
where machine-id wasn't present so it was kind of reproducible. Now
it's run on CIFuzz and CFLite using GHActions with the public OSS-Fuzz
corpora (based on that particular machine-id) so to fully utilize
those corpora it's necessary to use it always. Other than that
it makes it possible for fuzzers targeting outgoing packets
based on incoming packets like https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1795921
to get past client_parse_message on my machine :-)
2022-02-02 20:44:27 +09:00
Yu Watanabe
4900ae14a5 sd-device: drop device_new_from_synthetic_event() from libsystemd
It is used by only test-udev.c.
2022-02-02 20:34:38 +09:00
Yu Watanabe
043543f1bb udevadm: trigger: drop unnecessary slash 2022-02-02 20:34:38 +09:00
Yu Watanabe
f4f3249539 udevadm: make test and test-builtin command accept /dev path or device unit 2022-02-02 20:34:38 +09:00
Yu Watanabe
2079898088 sd-device: make device_set_action() take sd_device_action_t 2022-02-02 20:34:38 +09:00
Yu Watanabe
7f2e3eea28 sd-device: move device_read_uevent_file() to device-private.h
Then, it can be used by our tools or daemons.
2022-02-02 20:34:38 +09:00
Yu Watanabe
f30943c12f udev: do not generate format dynamically
Prompted by LGTM.
2022-02-02 20:34:31 +09:00
Yu Watanabe
e85fdacc8a test: allow to set NULL to intro or outro
Addresses https://github.com/systemd/systemd/pull/22338#discussion_r796741033.
2022-02-02 11:06:54 +00:00
Luca Boccassi
b0c7e3d0e1
Merge pull request #22359 from yuwata/mkdir-fix
mkdir: allow to create directory whose path contains symlink
2022-02-02 11:03:04 +00:00
Yu Watanabe
6f6b017b9b test: add a test for mkdir_p() 2022-02-02 15:09:45 +09:00
Yu Watanabe
5117059ee9 mkdir: allow to create directory whose path contains symlink
Fixes a regression caused by 3008a6f21c.

Before the commit, when `mkdir_parents_internal()` is called from `mkdir_p()`,
it uses `_mkdir()` as `flag` is zero. But after the commit, `mkdir_safe_internal()`
is always used. Hence, if the path contains a symlink, it fails with -ENOTDIR.

To fix the issue, this makes `mkdir_p()` calls `mkdir_parents_internal()` with
MKDIR_FOLLOW_SYMLINK flag.

Fixes #22334.
2022-02-02 15:09:45 +09:00
Yu Watanabe
e22916e61d mkdir: CHASE_NONEXISTENT cannot used in chase_symlinks_and_stat() 2022-02-02 15:09:45 +09:00
Yu Watanabe
e4de58c823 core/mount: fail early if directory cannot be created
Prompted by #22334.
2022-02-02 15:09:45 +09:00
Yu Watanabe
891c9b36cf
Merge pull request #22350 from poettering/journal-read-object-fix
journal: various fixes to journal_file_read_object()
2022-02-02 13:47:32 +09:00
Lennart Poettering
92b29166e1 systemctl: strings returned by sd_bus_message_read_basic() are immutable
It's totally not OK to write to the strings returned by it, the data is
shared by all code that references the message.

While we are at it, simplify the code via
json_variant_set_field_string().

Follow-up for: 5ef599b324
2022-02-02 13:46:46 +09:00
Lennart Poettering
e6d4a1106c journal-file: don't use pread() when determining where to append, use mmap as before
This partially undoes the effect of
ab6e257b3e.

Originally, we always used the mmap logic to determine the current end
of the file. ab6e257b3e changed this so
that we always used pread().

With this change we'll use pread() from the synchronization thread and
mmap otherwise.
2022-02-02 11:21:44 +09:00
Lennart Poettering
99839c7ebd tests: rework test macros to not take code as parameters
C macros are nasty. We use them, but we try to be conservative with
them. In particular passing literal, complex code blocks as argument is
icky, because of "," handling of C, and also because it's quite a
challange for most code highlighters and similar. Hence, let's avoid
that. Using macros for genreating functions is OK but if so, the
parameters should be simple words, not full code blocks.

hence, rework DEFINE_CUSTOM_TEST_MAIN() to take a function name instead
of code block as argument.

As side-effect this also fixes a bunch of cases where we might end up
returning a negative value from main().

Some uses of DEFINE_CUSTOM_TEST_MAIN() inserted local variables into the
main() functions, these are replaced by static variables, and their
destructors by the static destructor logic.

This doesn't fix any bugs or so, it's just supposed to make the code
easier to work with and improve it easthetically.

Or in other words: let's use macros where it really makes sense, but
let's not go overboard with it.

(And yes, FOREACH_DIRENT() is another one of those macros that take
code, and I dislike that too and regret I ever added that.)
2022-02-02 11:00:16 +09:00
Yu Watanabe
faa1b3c6c4 network: dhcp-server: make empty string to DNS= or friends clear previously specified servers 2022-02-02 10:02:57 +09:00
Yu Watanabe
32f8a613c5 sd-dhcp-lease: store static routes and classless static routes in different arrays
When classless static routes option is provided, then static routes
option should not be used. Hence, let's not mix and store them in one
storage.

This introduce sd_dhcp_lease_get_static_routes() and
sd_dhcp_lease_get_classless_routes().
2022-02-02 10:02:44 +09:00
Yu Watanabe
64a6b5ed21
Merge pull request #22351 from mrc0mmand/TEST-56-cgroupsv1
test: require unified cgroup hierarchy for TEST-56
2022-02-02 10:02:26 +09:00
Lennart Poettering
7ac29d2dab resolve: add missing OOM check 2022-02-02 07:08:03 +09:00
Luca Boccassi
86838bf08b core: warn on ExitType=cgroup with legacy cgroup setup
'cgroup empty' notifications are not reliable on v1, so log a warning.

See: https://github.com/systemd/systemd/issues/22320
2022-02-02 07:07:47 +09:00
Yu Watanabe
6a8ab6dd1e
Merge pull request #22332 from yuwata/network-dhcp-server-dns-server-address
network: dhcp-server: allow to specify server address for DNS= or friends
2022-02-02 07:07:22 +09:00
Yu Watanabe
e0ec975148
Merge pull request #22327 from joanbm/main_resolved_improvements
resolved: misc. small DnsStream refactors and improvements
2022-02-02 07:06:56 +09:00
Frantisek Sumsal
e262082018 test: require unified cgroup hierarchy for TEST-56
since cgroup empty notifications are unreliable in legacy cgroups.

See: systemd/systemd#22320
Complements: systemd/systemd#22344
2022-02-01 22:13:48 +01:00
Frantisek Sumsal
f723740871 test: introduce `get_cgroup_hierarchy() helper
which returns the host's cgroup hierarchy (unified, hybrid, or legacy).
2022-02-01 22:13:45 +01:00
Lennart Poettering
23b1e8d087 units: we need systemd-journald.service from systemd-journal-flush.service
This is a follow-up for d5ee050ffc, and
reintroduces a requirement dep from systemd-journal-flush.service onto
systemd-journald.service, but a weaker one than originally: a Wants= one
instead of a Requires= one.

Why? Simply because the service issues an IPC call to the journald,
hence it should pull it in. (Note that socket activation doesn't happen
for the Varlink socket it uses, hence we should pull in the service
itself.)
2022-02-02 05:09:39 +09:00
Yu Watanabe
c5f7a08739 test-network: add tests for DNS=_server_address in [DHCPServer] 2022-02-02 05:01:59 +09:00
Yu Watanabe
5f468b9f57 network: dhcp-server: introduce special value DNS=_server_address
Closes #15026.
2022-02-02 05:01:53 +09:00
Yu Watanabe
82140e956c
Merge pull request #22310 from yuwata/sd-dhcp-lease-fixes
sd-dhcp-lease: two fixes
2022-02-02 04:55:07 +09:00
Luca Boccassi
1e15b7c7f7
Merge pull request #22343 from poettering/assert-se-efi
efi: add/user assert_se()/ASSERT_SE_PTR() for OOM handling
2022-02-01 19:26:57 +00:00
Lennart Poettering
c0f65909cb analyze: correctly mention that --json= is also understood by inspect-elf 2022-02-02 03:55:51 +09:00