1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00
Commit Graph

72444 Commits

Author SHA1 Message Date
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
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
Daan De Meyer
d6f206b944 mkosi: Make scripts more generic
We might want to run the build scripts outside of mkosi as well at
some point, e.g. to build an rpm after booting the image, so let's
make them more generic by using /usr/lib/os-release to figure out
which pkg specs we should use instead of $PKG_SUBDIR. To make ubuntu
use the debian pkg spec, we add a symlink pkg/ubuntu which points to
debian/ in the same directory.
2024-04-09 11:57:05 +02:00
Daan De Meyer
0e4eba6fcb mkosi: Update to latest 2024-04-09 11:56:45 +02:00
Daan De Meyer
9c611095ca mkosi: Update pkg/arch to latest and install systemd-tests
The arch PKGBUILD now packages the tests when building for upstream
so let's make sure we install the new package.
2024-04-09 11:47:37 +02:00
Mike Yuan
52e555fa27 hibernate-resume-config: apply ENABLE_EFI ifdef correctly
Currently, validate_efi_hibernate_location is
fully conditioned out if !ENABLE_EFI, but
get_efi_hibernate_location() still calls it.
2024-04-09 09:40:21 +02:00
Daan De Meyer
ae4088b23e test: Various build environment fixes
All bets are off in build chroots, so let's handle more cases of
files or executables that might not be available in build chroots.

Specifically, these are all fixes to allow the unit tests to run
in the opensuse build chroot.
2024-04-09 09:40:03 +02:00
Ronan Pigott
73f77f38cf resolve: really always initialize aux
dns_transaction_request_dnssec_rr was already adjusted in 4001710365,
to allow for the return parameter to be passed uninitialized. However
this codepath was missed, meaning this function could sometimes return
success without having actually set the parameter.

Fixes: 4001710365 ("resolved: minor dnssec fixups")
Fixes: 47690634f1 ("resolved: don't request the SOA for every dns label")
2024-04-09 09:39:49 +02:00
Yu Watanabe
d4dae4c243 network/dhcp6: return earlier if no lease acquired
Previously, even If an interface has not acquired a DHCPv6 lease,
networkd logs a misleading message:
===
Apr 09 10:44:57 systemd-networkd[3970750]: veth99: DHCPv6 lease lost
===
The function should do nothing when no lease acquired. Let's return
earlier and suppress the log message.
2024-04-09 09:39:36 +02:00
Yu Watanabe
c848a0eef6
Merge pull request #31997 from yuwata/network-ndisc-zero-lifetime
network: fixlets for zero lifetime
2024-04-09 07:52:28 +09:00
Antonio Alvarez Feijoo
92966b3ac0 vmspawn: fix sd_bus_message_append() arguments and add missing error check 2024-04-09 06:47:48 +08:00
Daan De Meyer
957dc5f190 docs: Suggest soft-reboot to restart pid1 and all daemons in mkosi VM 2024-04-08 22:21:51 +01:00
Luca Boccassi
0f0d001254
Merge pull request #32104 from yuwata/network-ndisc-redirect
network/ndisc: add support for Redirect message
2024-04-08 20:03:32 +01:00
Mike Yuan
5b677c7dfc
Merge pull request #32156 from YHNdnzj/mountfsd-followup
Some cleanup for uid-range
2024-04-09 02:48:30 +08:00
Daan De Meyer
3b8b6910d1 mkosi: Fix debian submodule commit
This was accidentally changed in https://github.com/systemd/systemd/pull/32155
2024-04-08 17:26:16 +02:00
Usman Akinyemi
f9d273e67a I made more unit test to use the test macro 2024-04-08 16:58:52 +02:00
Mike Yuan
8ef347de67
userdbctl: correct uid_range_covers check
The third param should be the number of uids.
2024-04-08 20:24:23 +08:00
Mike Yuan
fc759fdf35
userdbctl: use FOREACH_ARRAY more 2024-04-08 20:24:02 +08:00
Mike Yuan
f48b487ddb
userdbctl: avoid NULL pointer deref
Error from uid_range_load_userns is ignored,
so 'p' could be NULL.
2024-04-08 20:20:26 +08:00
Mike Yuan
7fe28d8386
uid-range: place 'ret' param at last 2024-04-08 20:14:38 +08:00
Mike Yuan
0aec92a5cc
uid-range: use FOREACH_ARRAY at one more place 2024-04-08 20:14:38 +08:00
Mike Yuan
8953917d00
labeler: add mountfsd and nsresource 2024-04-08 20:14:37 +08:00
Daan De Meyer
e71b40fd00 docs: Add note on RuntimeBuildSources= to hacking guide 2024-04-08 11:37:34 +01:00
Daan De Meyer
bbecef795b
Merge pull request #32141 from DaanDeMeyer/mkosi
Install build dependencies into final image
2024-04-08 11:59:16 +02:00
Luca Boccassi
b1b5d7e4bf
Merge pull request #32140 from YHNdnzj/socket-per-peer-source
Minor tweaks to socket manual & shorten the code a bit
2024-04-08 10:38:07 +01:00
Daan De Meyer
44b6e43e8d mkosi: Update submodules to latest 2024-04-08 11:36:59 +02:00
Daan De Meyer
da38f93bd6 mkosi: Fix environment variable in arch prepare script 2024-04-08 11:36:40 +02:00
Daan De Meyer
8440ea8f21 Install build dependencies into final image
This allows us to build and install after booting without having to
build a new image. Together with
https://github.com/systemd/mkosi/pull/2601 and after enabling
RuntimeBuildSources=yes, after booting, "meson install -C /work/build"
can be used to do an incremental build and install. This won't build
proper packages, but will be invaluable for having a quick compile,
edit, test cycle without having to rebuild the image all the time.
2024-04-08 11:36:40 +02:00
Luca Boccassi
8826953547 Update pkg/debian/ to latest
lz4-tool, nsresourced, kmod changes
2024-04-08 11:34:30 +02:00
Luca Boccassi
9dcc2a5838 nsresource: fix FD leak
Also fix return code, namespace_open_by_type uses RET_NERRNO

CID#1542923

Follow-up for 54452c7b2a
2024-04-08 10:19:42 +01:00
Zbigniew Jędrzejewski-Szmek
f50be1870d networkd: report error if lease file cannot be loaded and ignore
On my system, networkd would report that interface ve-rawhide is "Failed"
without anything in the logs:
systemd-networkd[651095]: ve-rawhide: Trying to reconfigure the interface.
systemd-networkd[651095]: ve-rawhide: Gained IPv6LL
systemd-networkd[651095]: ve-rawhide: Link DOWN
systemd-networkd[651095]: ve-rawhide: Lost carrier
systemd-networkd[651095]: ve-rawhide: Configuring with /usr/lib/systemd/network/80-container-ve.network.
systemd-networkd[651095]: ve-rawhide: Link UP
systemd-networkd[651095]: ve-rawhide: Gained carrier
systemd-networkd[651095]: ve-rawhide: Failed

At debug level:
systemd-networkd[799993]: dhcp-server-lease/ve-rawhide:1:1: Missing object field 'Address'.

$ jq </var/lib/systemd/network/dhcp-server-lease/ve-rawhide
{
  "BootID": "5d86b34b98894322bfd4ae8443ce59b3",
  "Leases": [
    {
      "ClientId": [ ... ],
      "Address": [ 192, 168, 120, 179 ],
      "Hostname": "rawhide",
      "ExpirationUSec": 966046821158,
      "ExpirationRealtimeUSec": 1711203197266940
    }
  ]
}

I'm not sure why "Address" is missing, but anyway, in this case, we should ignore the
lease file rather than refusing to configure the interface. Also, warn at the point
where we know what the filename is.
2024-04-08 17:28:22 +09:00
Antonio Alvarez Feijoo
ef6bf96749 core: fix typo 2024-04-08 17:25:29 +09:00
Yu Watanabe
6952ebae3b tree-wide: drop several remaining license headers
And downgrade the license of utf8.c to LGPL-2.0-or-later, to follow the
original license.
2024-04-08 10:14:50 +02:00
Yu Watanabe
caaf95985f mountfsd: fix typo
Follow-up for 702a52f4b5.
2024-04-08 09:22:06 +09:00
Yu Watanabe
1ea9151e6c nsresourced: fix typo
Follow-up for 8aee931e7a.
2024-04-08 09:20:20 +09:00
Yu Watanabe
a1952a5c79 dissect: fix typo
Follow-up for 9444e54e56.
2024-04-08 09:17:53 +09:00
Yu Watanabe
693a28d748 nspawn: fix typo
Follow-up for 0af7e29434.
2024-04-08 09:12:08 +09:00
Luca Boccassi
69484aa6c2
Merge pull request #32136 from YHNdnzj/nextroot-auto-mountpoint
systemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint
2024-04-07 23:32:18 +01:00
Luca Boccassi
1b0cc135d0 test-execute: check for s390x first and duplicate test
s390x will define both s390x and s390, so exec-personality-s390.service is ran
in both cases but fails on s390x, as the personality returned is s390x.
Split the test and check specifically for s390x.
2024-04-08 07:29:06 +09:00