1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

56311 Commits

Author SHA1 Message Date
Frantisek Sumsal
54e2f32f50 test-network: use specific exceptions instead of the Exception class 2022-02-03 19:30:11 +01:00
Frantisek Sumsal
a561bceeaa test-network: avoid name clashing/redefinition 2022-02-03 19:20:42 +01:00
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
f4526f82c9 resolved: maintain only a single list of "dont-resolve" domain names
Follow-up for: 46b53e8035
2022-02-03 17:16:11 +01:00
Luca Boccassi
cbfa043149 man: explicitly mention that Requires propagates restarts
It's implicit, but the actions are different, so let's be explicit to
avoid any confusion.
2022-02-03 14:48:27 +00:00
Leviticoh
f83da717d9 fix italian translations to display unit name 2022-02-03 23:05:58 +09:00
Lennart Poettering
0bf78c12b1 boot: fix pretty nasty typo
Note to self: should I ever become a black hat hacker, this is how I'd
hide a vulnerability. ;-)

(No, this one is not a vulnerability)

Follow-up for: 163d1ea5dd
2022-02-03 14:57:35 +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
Yu Watanabe
7809cab717 test-network: add testcase for external tunnel 2022-02-03 11:12:34 +09:00
Yu Watanabe
1ae308abb5 network: tunnel: support external mode
Closes #22352.
2022-02-03 11:12:01 +09:00
Yu Watanabe
acd8abb7f9 network: tunnel: reorder setting ip6tnl attributes
Just for improving readability.
2022-02-03 11:10:15 +09:00
Yu Watanabe
a07e07cd9c network: tunnel: reduce indentation in config_parse_encap_limit() 2022-02-03 11:10:15 +09:00
Yu Watanabe
59c8bef008 network: tunnel: reduce indentation in config_parse_ipv6_flowlabel() 2022-02-03 11:10:15 +09:00
Yu Watanabe
396dfe0a14 network: tunnel: use "data" field to assign result 2022-02-03 11:10:15 +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
dde009a879 core: simply freeing list in job_free()
Follow-up for cdebedb4d4
2022-02-02 16:33:25 +00:00
Luca Boccassi
b7b4252443 core: use strextend instead of strextendf when possible
Follow-up for cdebedb4d4
2022-02-02 16:33:25 +00: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