Commit graph

72537 commits

Author SHA1 Message Date
Mike Yuan 6f801feb4b
bless-boot-generator: use generator_add_symlink 2024-04-10 23:40:53 +08:00
Mike Yuan 8b317c3400
core: use FOREACH_ARRAY at 3 more places 2024-04-10 23:40:53 +08:00
Ivan Kruglov 5152b8459a ASSERT_NULL/ASSERT_NOT_NULL 2024-04-10 16:57:30 +02:00
Frantisek Sumsal 0ab87ebd97
Merge pull request #32201 from aafeijoo-suse/test-minor-fixes
test: minor fixes
2024-04-10 16:54:37 +02:00
Mike Yuan 48c21790ba
test: merge TEST-77-OPENFILE into TEST-23-UNIT-FILE
And add coverage for #32179
2024-04-10 21:49:28 +08:00
Daan De Meyer f1e9e8041c git: Add post-rewrite hook that invokes git submodule update
git rebase does not support a --recurse-submodules switch to automatically
check out the submodules at their registered commits during or after a rebase.

Instead, let's use the post-rewrite git hook to do this ourselves.
2024-04-10 14:39:49 +02:00
Daan De Meyer 8bc9232636 Update submodules 2024-04-10 14:36:59 +02:00
Mike Yuan c1f9509f79
shared/open-file: use xescape to escape ':'
Fixes #32179
2024-04-10 20:16:35 +08:00
Mike Yuan 4eb1feb110
shared/open-file: make open_file_free_many static inline 2024-04-10 20:16:35 +08:00
Mike Yuan c642f43131
core/exec-invoke: modernize get_open_file_fd a bit 2024-04-10 20:16:35 +08:00
Mike Yuan 9b076e86c0
core/exec-invoke: modernize connect_unix_harder 2024-04-10 20:16:34 +08:00
Pablo Méndez Hernández ffd0cca34a man/journald: Add missing configuration files
The man page was missing:

-  `/run/systemd/journald.conf`
-  `/usr/lib/systemd/journald.conf`

as valid configuration files.

Fixes: https://github.com/systemd/systemd/issues/32199
2024-04-10 20:15:17 +08:00
Antonio Alvarez Feijoo 2ad44c22fe
tools/check-version-history: skip test if lxml is not installed
```
================================= 1070/1408 ==================================
test:         systemd:dist / check-version-history
start time:   07:55:05
duration:     0.03s
result:       exit status 1
...
----------------------------------- stderr -----------------------------------
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/tools/check-version-history.py", line 6, in <module>
    import lxml.etree as tree
ModuleNotFoundError: No module named 'lxml'
==============================================================================
```

Follow-up for 3691e7fce7
2024-04-10 11:10:02 +02:00
Antonio Alvarez Feijoo 866a469e5a
test: add missing header to test.h
```
../src/shared/tests.h:361:28: error: implicit declaration of function ‘fork’ [-Werror=implicit-function-declaration]
  361 |                 int _pid = fork();                                                                              \
      |                            ^~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: error: implicit declaration of function ‘_exit’ [-Werror=implicit-function-declaration]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1115:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1115 |         ASSERT_SIGNAL(ASSERT_OK(-ENOANO), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/test/test-macro.c:1119:21: error: implicit declaration of function ‘getpid’; did you mean ‘getpt’? [-Werror=implicit-function-declaration]
 1119 |         ASSERT_TRUE(getpid());
      |                     ^~~~~~
```

Follow-up for #32189
2024-04-10 11:09:52 +02:00
Lennart Poettering 5538b62f59 secure-boot: tighten enrollment logic a bit regarding file sizes
It's OK the dbx file is not loaded, but let's explicitly check for that
(i.e. if the buffer is actually non-NULL), rather than the size of the
bufer, since empty files actually do exist.

Or in other words, let's not magically suppress enrollment of empty
files, but let uefi firmware handle these on their own.

Follow-up for: 57ea8012d6
2024-04-10 16:59:37 +09:00
Lennart Poettering 6fea0f0ba0 boot: re-align table
We like our tables aligned.

(Also suppres the final two fields, which are all zeroes anyway, to
declutter a bit)
2024-04-10 16:59:37 +09:00
Lennart Poettering 3ee27b2580 resolved: dns_name_equal() can fail, handle that reasonably
Ignoring errors can be OK sometimes, but we should make this explicit.
2024-04-10 16:58:34 +09:00
Yu Watanabe cd226becd8
Merge pull request #32189 from mrc0mmand/test-tweaks
Another batch of assorted test tweaks
2024-04-10 16:57:00 +09:00
Yu Watanabe f8e15d6d98
Merge pull request #32191 from yuwata/network-persistent-storage-follow-ups
network: follow-ups for persistent storage
2024-04-10 16:54:39 +09:00
Lennart Poettering 475107f014 ndisc: use memzero() where appropriate 2024-04-10 16:54:20 +09:00
Lennart Poettering e1771c8ee6 sd-journal: make sure sd_journal_add_match() also accepts SIZE_MAX as size
In many of our internal functions that take a pointer + a size we have
introduced the rule that SIZE_MAX as size means: take strlen().

sd_journal_add_match() has something similar, but the special value is
0, not SIZE_MAX. This is a bit ugly, since a zero size data block is
theoretically fine. The only reason sd_journal_add_match() gets away
with using this special value is because valid matches must consist of
at least 2 chars, hence cannot be zero.

But let's make this more robust and less surprising when compared to the
rest of our code, and *also* accept SIZE_MAX to mean strlen().

No actual code changes, just some clean-up.
2024-04-10 16:54:03 +09:00
Daan De Meyer 7072777163 core: Serialize both pid and pidfd
If we try to deserialize only a pidfd that points to a process that
has been reaped, creating the pidref object will fail, which means that
we'll try to create a pidref object from the serialized pid that comes
next. If the pid has already been reused, this will succeed and we'll
now have a pidref that points to a different process.

Let's avoid this issue by serializing both the pidfd and the pid and
creating the pidref object directly from both. This means we'll reuse
the deserialized pidfd instead of opening a new one. We'll then immediately
notice the pidfd is dead and do the appropriate follow up depending on
the unit type.
2024-04-10 09:32:04 +02:00
Yu Watanabe a0430b0d95 test-network: add test case for ndisc MTU option 2024-04-10 12:24:33 +09:00
Yu Watanabe 8c9ef90b19 network/ndisc: set IPv6 MTU through sysctl
Closes #31496.
2024-04-10 12:22:43 +09:00
Yu Watanabe fb71748e4f network/sysctl: round IPv6 MTU with the current device MTU rather than the maximum MTU
Otherwise, writing IPv6 MTU may fail.

This also makes link_set_ipv6_mtu() take log level about rounding IPv6 MTU,
and downgrade the log level from LOG_WARNING -> LOG_INFO, as we usually
use LOG_WARNING for per-interface critical failure.
2024-04-10 12:15:33 +09:00
Yu Watanabe eb426caae7 network: always set IPv6 MTU when we detect the device MTU is changed
Then, we can keep the IPv6 MTU even if the device MTU is changed by an
external tool, e.g. 'ip link set' command.
2024-04-10 12:15:33 +09:00
Yu Watanabe d4386dd1c8 network/setlink: adjust requested MTU when it is ready to set
This should not change any effective behavior.
Just for safety, and making the logic consistent with others, e.g.
setting master ifindex.
2024-04-10 12:15:33 +09:00
Yu Watanabe 11a150bc43 po: update Japanese translation 2024-04-10 07:07:34 +09:00
Yu Watanabe 4d97f7deeb network/varlink: fix error cause
Follow-up for e1254d0616.

Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557552244.
2024-04-10 04:59:43 +09:00
Yu Watanabe fb6f98ae63 network: open persistent directory without O_PATH
Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557549629.
2024-04-10 04:59:43 +09:00
Frantisek Sumsal 515eb678a0 test: wait until the test container is fully booted up
TEST-69 still occasionally times out in CI and appears to be stuck on
boot, so let's see if this helps the situation a bit.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal 8d4bfd38ed test: disable background color for nspawn containers
As it makes the logs really messy in certain tests.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal 04f0c6752c test: set pexpect's logfile early
So we capture the container's boot as well.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal 721e78ff73 test: give sd-resolved enough time to timeout
The timeout on sd-resolved's side is 5-10s (UDP or TCP), but dig's
default timeout is 5s. Let's give sd-resolved enough time to timeout
before either giving up or checking if it served stale data on dig's
side.

Resolves: #31639
2024-04-09 21:39:46 +02:00
Frantisek Sumsal bfd30e8af6 test: let curl show a potential error in silent mode
I collected a couple of fails in this particular test, but without any
output they're impossible to debug. Let's make this slightly less
annoying and let curl show an error (if any) even in silent mode.

This patch uncovers that curl has been (silently) complaining about not
being able to write to the output destination, because `grep -q`
short-circuits on the first match and doesn't bother reading the rest,
so replace `grep -q` with `grep ... >/dev/null` to force grep to always
read the whole thing from curl.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal d4e11f30bc test: forward journal to console in TEST-24-CRYPTSETUP
If we fail to mount the encrypted /var during boot we're left with
nothing to debug, so let's do the same thing we do for TEST-08-INITRD
and forward journal to the console.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal 8c33218e9e test: add a couple of sanity tests for ASSERT_*() macros
Also, introduce ASSERT_SIGNAL() macro that should help us test failing
cases of mentioned macros (which usually end with calling abort()).
2024-04-09 21:39:46 +02:00
Frantisek Sumsal 7d7a3d4787 test: handle NULL correctly when passed to ASSERT_EQ()
strcmp() doesn't handle NULLs nicely, so switch to streq_ptr().
2024-04-09 21:39:46 +02:00
Yu Watanabe ce4ed0ad99 test-network: add test case for regenerating prefix stable address on conflict
For issue #31605.
2024-04-10 04:36:03 +09:00
Yu Watanabe e14679ff76 network/address-generation: regenerate IPv6 prefix stable address on conflict
If a generated address with IPv6Token=prefixstable conflicts with the
one on another node or interface, let's generate another address and try
to assign it.

This improves support of RFC 7217.

Fixes #31605.
2024-04-10 04:36:03 +09:00
Frantisek Sumsal edda10f2ae tree-wide: make sure net/if.h is included before any linux/ header
The linux/ headers include linux/libc-compat.h that makes sure the
linux/ headers won't redeclare symbols already declared by net/if.h, but
glibc's net/if.h doesn't do that, so if the include order is reversed
we'll end up with a bunch of errors about redeclared stuff:

[3/519] Compiling C object test-network-tables.p/src_network_test-network-tables.c.o
FAILED: test-network-tables.p/src_network_test-network-tables.c.o
cc -Itest-network-tables.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -Isrc/libsystemd-network -I../src/libsystemd-network -Isrc/network -I../src/network -I../src/network/netdev -I../src/network/tc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -DTEST_CODE=1 -MD -MQ test-network-tables.p/src_network_test-network-tables.c.o -MF test-network-tables.p/src_network_test-network-tables.c.o.d -o test-network-tables.p/src_network_test-network-tables.c.o -c ../src/network/test-network-tables.c
In file included from ../src/basic/linux/if_bonding.h:47,
                 from ../src/network/netdev/bond.h:5,
                 from ../src/network/test-network-tables.c:3:
../src/basic/linux/if.h:111:41: error: redeclaration of enumerator ‘IFF_UP’
  111 | #define IFF_UP                          IFF_UP
      |                                         ^~~~~~
../src/basic/linux/if.h:84:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’
   84 |         IFF_UP                          = 1<<0,  /* sysfs */
      |         ^~~~~~
../src/basic/linux/if.h:112:41: error: redeclaration of enumerator ‘IFF_BROADCAST’
  112 | #define IFF_BROADCAST                   IFF_BROADCAST
      |                                         ^~~~~~~~~~~~~
...

This also drops remaining workarounds from the last time this issue was
brought up (6f270e6bd8) since they shouldn't be needed anymore if the
order of the includes is the "correct" one. I also added a comment to
each affected include when this is inevitably encountered again in the
future.

Resolves: #32160
2024-04-09 21:19:15 +02:00
Antonio Alvarez Feijoo 8c62676e4b test-date: add missing header
```
[587/2863] Compiling C object test-date.p/src_test_test-date.c.o
FAILED: test-date.p/src_test_test-date.c.o
cc -Itest-date.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -DTEST_CODE=1 -MD -MQ test-date.p/src_test_test-date.c.o -MF test-date.p/src_test_test-date.c.o.d -o test-date.p/src_test_test-date.c.o -c ../src/test/test-date.c
../src/test/test-date.c: In function ‘main’:
../src/test/test-date.c:86:13: error: implicit declaration of function ‘access’; did you mean ‘accept’? [-Werror=implicit-function-declaration]
   86 |         if (access("/usr/share/zoneinfo/Asia/Seoul", F_OK) >= 0) {
      |             ^~~~~~
      |             accept
../src/test/test-date.c:86:13: warning: nested extern declaration of ‘access’ [-Wnested-externs]
../src/test/test-date.c:86:54: error: ‘F_OK’ undeclared (first use in this function)
   86 |         if (access("/usr/share/zoneinfo/Asia/Seoul", F_OK) >= 0) {
      |                                                      ^~~~
../src/test/test-date.c:86:54: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
```

Fixes ae4088b23e
2024-04-10 02:08:35 +08:00
Lennart Poettering 82bdb3ede2 service: explicitly add comment about donated reference on parameter
Follow-up for: d6a911e906

See my comment: d6a911e906 (r1557384101)
2024-04-10 02:08:03 +08:00
Mike Yuan 74531a93d6
pidref: 0 -> NULL for pointer 2024-04-10 01:45:12 +08:00
Daan De Meyer 035bdb1472 mkosi; Fix permissions of mkosi.postinst script
Must be executable.
2024-04-09 16:20:58 +01:00
Luca Boccassi aef47ec274
Merge pull request #32154 from DaanDeMeyer/mkosi
mkosi: Make scripts more generic
2024-04-09 13:30:59 +01:00
dependabot[bot] b67f7e370a build(deps): bump pkg/fedora from 2822a03 to 3f8c38e
Bumps pkg/fedora from `2822a03` to `3f8c38e`.

---
updated-dependencies:
- dependency-name: pkg/fedora
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-09 12:23:52 +02:00
Daan De Meyer 07d52c7a46 mkosi: Drop out-of-date comment 2024-04-09 11:57:38 +02:00
Daan De Meyer 1a2374a3f6 mkosi: Unify initrd post-install scripts
Just like we already have $SYSTEMD_PACKAGES for systemd packages to
re-install in the main image, let's add $INITRD_PACKAGES for all
systemd packages to re-install in the initrd.
2024-04-09 11:57:16 +02:00
Daan De Meyer e4c8e9dcbd mkosi: Install openSUSE-release instead of distribution-release
distribution-release is a virtual package that is by default satisfied
by the openSUSE MicroOS-release package. Let's make sure we pull in the
generic openSUSE-release package instead by installing
patterns-base-minimal_base which has a Suggests dependency on
openSUSE-release which makes sure it takes priority over the MicroOS one.
2024-04-09 11:57:06 +02:00