Commit graph

913 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 819c0dcbf5 meson: use status-unit-format-default=name in developer mode
I think developers are particularly unlikely to find the descriptions
useful, and would benefit from being able to copy&paste unit names.
Let's make this choice automatically.
2022-06-10 13:51:17 +02:00
Zbigniew Jędrzejewski-Szmek 79dec86add meson: add status unit format to summary 2022-06-10 13:51:17 +02:00
Daan De Meyer 8239002226 meson: Build with frame pointers in developer mode
Profiling tools tend to work better when binaries and libraries
are compiled with frame pointers as without them there's no easy
and fast way to get the current stacktrace.
2022-06-09 17:44:26 +01:00
Daan De Meyer a22f518676 meson: Add nspawn-locale meson option
https://github.com/systemd/systemd/pull/23192 caused breakage in
Arch Linux's build tooling. Let's give users an opt-out aside from
reverting the patch. It's hardly any maintenance work on our side
and gives users an easy way to revert the locale change if needed.

Of course, by default we still pick C.UTF-8 if the option is not
specified.
2022-06-09 13:08:27 +09:00
Mike Gilbert e91119c3a4 meson: adjust rootlibdir default for multiarch
On Debian, libdir is commonly something like 'lib/x86_64-linux-gnu'.

The result of get_option('libdir') is normalized to a prefix-relative
path by meson, so we can just append it to rootprefixdir.

Fixes https://github.com/systemd/systemd/issues/23648.
2022-06-07 12:26:38 +02:00
Michael Biebl 5fb225615b meson: install libsystemd-shared into rootpkglibdir
Introduce rootpkglibdir for installing libsystemd-{shared,core}.so.
The benefit over using rootlibexecdir is that this path can be
multiarch aware, i.e. this path can be architecture qualified.

This is something we'd like to make use of in Debian/Ubuntu to make
libsystemd-shared co-installable, e.g. for i386 the path would be
/usr/lib/i386-linux-gnu/systemd/libsystemd-shared-*.so and for amd64
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-*.so.
This will allow for example to install and run systemd-boot/i386 on an
amd64 host. It also simplifies/enables cross-building/bootstrapping.

For more infos about Multi-Arch see https://wiki.debian.org/Multiarch.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990547
2022-06-07 10:04:43 +02:00
Daan De Meyer c9bd01ae90 meson: Switch default-locale default to C.UTF-8
We're already using C.UTF-8 as the default locale for nspawn. Let's
make the same change for the default-locale option instead of deciding
what to use based on the locale used by the host system. Users can
still override the locale using the default-locale option if needed.
2022-06-04 05:08:37 +09:00
Zbigniew Jędrzejewski-Szmek 3a2a0806f5
Merge pull request #23297 from medhefgo/trivial-auto-var-init
meson: Compile with -ftrivial-auto-var-init
2022-06-03 15:27:51 +02:00
Yu Watanabe a71278840b test: add dlopen test for pam_systemd_home 2022-06-03 13:40:14 +01:00
Yu Watanabe 0dd4876815 sd-bus: drop D-Bus version 2 format support
It seems the format is used only by kdbus.
2022-06-01 03:41:15 +09:00
Yu Watanabe ba780ccd5f
Merge pull request #23542 from medhefgo/attributes
meson: Document why -Wimplicit-fallthrough is not used with clang
2022-05-30 04:07:41 +09:00
Evgeny Vereshchagin 8739f309f3 meson: exclude pcre2 when dependencies are skipped 2022-05-29 06:44:45 +00:00
Michael Biebl 003a676161 Move homectl and userdbctl to bindir
Those binaries aren't needed during early boot.
2022-05-28 18:47:53 +02:00
Jan Janssen c0f5d58c9a meson: Document why -Wimplicit-fallthrough is not used with clang
This changes the macro to ensure proper fallthrough attributes are
used with clang in case this option is added in the future.
2022-05-28 12:44:08 +02:00
Zbigniew Jędrzejewski-Szmek 2f9b7186e3
Merge pull request #23414 from keszybz/analyze-vercmp
systemd-analyze compare-versions
2022-05-23 09:14:51 +02:00
Luca Boccassi 1f9aa3d2a6 resolved: default to OpenSSL
If both gnutls and openssl are available, prefer openssl.
We are gradually moving toward supporting openssl only as the
crypto library, and the resolved gnutls backend will be dropped
at some point, so start nudging users toward the openssl one.
2022-05-21 18:13:38 +02:00
Benjamin Franzke a8c03388f8 tree-wide: Update homepage to systemd.io 2022-05-21 14:33:24 +02:00
Zbigniew Jędrzejewski-Szmek 4e8295f42d test-compare-versions: basic test for systemd-analyze compare-versions 2022-05-19 11:07:28 +02:00
Mike Gilbert 48139c7c57 meson: add 'pam' install_tag to pam modules 2022-05-16 17:58:27 +01:00
Yu Watanabe 4645074e6f meson: use fs.name() and fs.parent()
Follow-up for 1bd0cc452c.
2022-05-16 04:27:27 +09:00
Yu Watanabe 4a5bdeac7d meson: always use ExternalProgram.path()
Even if we use meson >= 0.55, using path() does not produce any error or
warning if the required version is below 0.55.

Let's convert path() with full_path() when we requires meson >= 0.55.
2022-05-16 03:39:38 +09:00
Yu Watanabe 3d954ef147 meson: disable bpf if skip-deps is enabled 2022-05-16 03:37:21 +09:00
Yu Watanabe cf2dc69062 meson: use boolean for configuration_data.set10()
Setting with number is deprecated:
```
meson.build:1008: DEPRECATION: configuration_data.set10 with number. the `set10` method should only be used with booleans
```
2022-05-16 03:37:21 +09:00
Eli Schwartz ac3eda3489 meson: use better shellscript argument passing
Passing potentially arbitrary data into a shellscript is potentially
very broken if you do not correctly quote it for use. This quoting must
be done as part of the interpretation of the data itself, e.g. python's
shlex.quote; simply formatting it into a string with double quotes is
NOT sufficient.

An alternative is to communicate the data reliably via argv to the shell
process, and allow the shell to internally handle it via `"$1"`, which
is quote-safe and will expand the data from argv as a single tokenized
word.
2022-05-16 03:04:16 +09:00
Mike Gilbert 35d17e15dc meson: add 'nss' install_tag to nss modules 2022-05-14 11:59:13 -04:00
Jan Janssen 1a4e392760 meson: Compile with -ftrivial-auto-var-init=zero in release mode 2022-05-13 17:15:03 +02:00
Zbigniew Jędrzejewski-Szmek c4f883b78e fuzzers: ignore size limits when compiled standalone
This way we can still call fuzzers on old samples, but oss-fuzz will not waste
its and our time finding overly large inputs.
2022-05-12 14:57:07 +02:00
Zbigniew Jędrzejewski-Szmek 011a03a3fa meson: turn on log-message-verification by default in developer builds
I'm not _quite_ convinced that this a good idea… I'm at least keeping
it separate to make it easy to revert ;)
2022-05-11 18:18:59 +02:00
Zbigniew Jędrzejewski-Szmek b9ce5cf9ca Optionally call printf on LOG_MESSAGE() arguments
With an intentional mistake:

../src/login/logind-dbus.c: In function ‘bus_manager_log_shutdown’:
../src/login/logind-dbus.c:1542:39: error: format ‘%s’ expects a matching ‘char *’ argument [-Werror=format=]
 1542 |                           LOG_MESSAGE("%s %s", message),
      |                                       ^~~~~~~
2022-05-11 16:47:40 +02:00
Yu Watanabe af2ff171e0
Merge pull request #23272 from keszybz/logind-man-and-rules
Logind man and rules
2022-05-07 04:23:02 +09:00
Zbigniew Jędrzejewski-Szmek e8a5b13e45 meson: move vconsole rules to rules.d/ 2022-05-05 11:51:44 +02:00
Jan Janssen 14056a52c6 meson: Use meson test suite feature
This makes it easier to only test a subset of tests without having
to specify them all on the command line:
    meson test -C build --suite headers
2022-05-04 16:11:34 +02:00
Jan Janssen 911c15087c meson: Remove check-compilation.sh
No need to involve a trivial shell script for this.

We could call the compiler directly, but test() expects arguments
to be passed separately and cc.cmd_array() can contain arguments
itself. Using env is easier than manually slicing the array because
meson has no builtins for that.
2022-05-04 15:59:51 +02:00
Jonathan Lebon 93651582ae manager: optionally, do a full preset on first boot
A compile time option is added to select behaviour: by default
UNIT_FILE_PRESET_ENABLE_ONLY is still used, but the intent is to change to
UNIT_FILE_PRESET_FULL at some point in the future. Distros that want to
opt-in can use the config option to change the behaviour.

(The option is just a boolean: it would be possible to make it multi-valued,
and allow full, enable-only, disable-only, none. But so far nobody has asked
for this, and it's better not to complicate things needlessly.)

With the configuration option flipped, instead of only doing enablements,
perform a full preset on first boot. The reason is that although
`/etc/machine-id` might be missing, there may be other files provisioned in
`/etc` (in fact, this use case is mentioned in `log_execution_mode`). Some of
those possible files include enablement symlinks even if presets dictate it
should be disabled.

Such a seemingly contradictory situation occurs in {RHEL,Fedora} CoreOS,
where we ship `/etc` as if `preset-all` were called. However, we want to
allow users to disable default-enabled services via Ignition, which does
this by creating preset dropins before switchroot. (For why we do
`preset-all` at compose time, see:
https://github.com/coreos/fedora-coreos-config/pull/77).

For example, the composed FCOS image has a `enable zincati.service`
preset and an enablement for that in `/etc`, while at boot time when we
switch root, there may be a `disable zincati.service` preset with higher
precedence. In that case, we want systemd to disable the service.

This is essentially a revert of 304b3079a2. It seems like systemd
*used* to do this, but it was changed to try to make the container
workflow a bit faster.

Resolves: https://github.com/coreos/fedora-coreos-tracker/issues/392

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2022-05-04 09:10:54 +02:00
Zbigniew Jędrzejewski-Szmek b528a62863 meson: also check c_args to maybe add -Wno-maybe-uninitialized
People (and build systems) sometimes set flags through -Dc_args=… or $CFLAGS.
Let's catch this common case too. meson will set c_args from $CFLAGS, so we
only need to check the former.
2022-04-29 20:03:11 +01:00
Luca Boccassi 0a5e638cc7 meson: add install_tag to sd-boot, libsystemd and libudev
Allows to 'meson install --tags systemd-boot --no-rebuild' to install only the EFI
binaries, skipping the rest, for a very quick build:

$ ninja src/boot/efi/linuxx64.efi.stub
[21/21] Generating src/boot/efi/linuxx64.efi.stub with a custom command
$ ninja src/boot/efi/systemd-bootx64.efi
[10/10] Generating src/boot/efi/systemd-bootx64.efi with a custom command
$ DESTDIR=/tmp/foo meson install --tags systemd-boot --no-rebuild
Installing src/boot/efi/systemd-bootx64.efi to /tmp/foo/usr/lib/systemd/boot/efi

Requires Meson 0.60 to be used, prints a warning for unknown keyword
in earlier versions, but there's no failure

https://mesonbuild.com/Installing.html#installation-tags
2022-04-27 22:24:53 +01:00
Yu Watanabe 1788c6f3c0 meson: also use COMPRESSION_NONE for default compression 2022-04-27 20:49:17 +09:00
Yu Watanabe 9798deaf46 meson: show default compression method in summary 2022-04-27 20:47:38 +09:00
Lennart Poettering acc50c92eb basic: move compress.[ch] → src/basic/
The compression helpers are used both in journal code and in coredump
code, and there's a good chance we'll use them later for other stuff.

Let's hence move them into src/basic/, to make them a proper internal
API we can use from everywhere where that's desirable. (pstore might be
a candidate, for example)

No real code changes, just some moving around, build system
rearrangements, and stripping of journal-def.h inclusion.
2022-04-26 21:45:03 +02:00
Zbigniew Jędrzejewski-Szmek ee00684c50 meson: use a single constant for default compression setting
Suggested by Daniele Nicolodi:
https://github.com/systemd/systemd/pull/23160#discussion_r855853716

This is possible only if the macro is never used in #if, but only in C code.
This means that all places that use #if have to be refactored into C, but we
reduce the duplication a bit, and C is nicer to read than preprocessor
conditionals.
2022-04-22 15:08:28 +02:00
Zbigniew Jędrzejewski-Szmek 1d997b8114 meson: simplify setting of default compression
Follow-up for da13d2ca07. Instead of having
separate definitions of the bitmask flags, just define DEFAULT_COMPRESSION_FOO=0|1
directly.

(It *should* be possible to do this more simply, but the problem is that
anything that is used in #if cannot refer to C constants or enums. This is the
simplest I could come up with that preserves the property that we don't use #ifdef.)

The return value from compress_blob() is changed to propagate the error instead
of always returning -EOPNOTSUPP. The callers don't care about the specific error
value. compress_blob_*() are changed to return the compression method on success, so
that compress_blob() can be simplified. compress_stream_*() and compress_stream() are
changed in the same way for consistency, even though the callers do not currently use
this information (outside of tests).
2022-04-22 12:02:29 +02:00
Luca Boccassi da13d2ca07 compression: add separate pre-processor definitions
Follow-up for cd3c6322db

journal-def.h should be self-contained too, as it represents the journal object ABI.
Duplicate the enums, as they also need to be in config.h for it to be self-contained,
and enums are not available to the preprocessor. Use an assert to ensure they don't
diverge.
2022-04-19 23:18:19 +02:00
Luca Boccassi cd3c6322db compression: add build-time option to select default
Compression and decompression are controlled by the same build flag,
so if one wants to use, say, LZ4 to compress, ZSTD has to be disabled,
which means one loses the ability to read zstd-compressed journals.

Add a default-compression meson option, that allows to select any of
the available compression algorithms as the default.
2022-04-18 05:43:59 +09:00
Mike Gilbert bf93f24ad8 Add test support for systemd-tmpfiles.standalone 2022-04-18 01:27:09 +09:00
Frantisek Sumsal 7e43be7d0e meson: explicitly include coverage tweaks when built w/ --coverage
To make sure we don't miss any _exit() calls let's move the
coverage-related tweaks into a separate header file and include it
explicitly on the compiler command line using -include when a coverage
build is requested.

Follow-up to c6552ad381.
2022-04-09 00:02:30 +09:00
Frantisek Sumsal 673d1f4ab9
Merge pull request #23000 from mrc0mmand/coverage__exit
macro: call __gcov_dump() before _exit() w/ coverage enabled
2022-04-07 13:08:55 +00:00
Frantisek Sumsal c6552ad381 macro: call __gcov_dump() before _exit() w/ coverage enabled
_exit() skips at-exit hooks, causing lost coverage from processes
utilizing it.

Hopefully resolves systemd/systemd-centos-ci#482
2022-04-07 10:06:44 +02:00
Zbigniew Jędrzejewski-Szmek 99d8cbceff meson: make kernel-install a template file, add --version, add to tests
In --help output, change "$0" → "kernel-install". We generally don't include
the full path in --help output, and let's not do this here either.

kernel-install is now in build/ directly, not in the subdirectory.
2022-04-05 22:18:31 +02:00
Zbigniew Jędrzejewski-Szmek 8f04a1ca2b meson: also allow setting GIT_VERSION via templates
GIT_VERSION is not available as a config.h variable, because it's rendered
into version.h during builds. Let's rework jinja2 rendering to also
parse version.h. No functional change, the new variable is so far unused.

I guess this will make partial rebuilds a bit slower, but it's useful
to be able to use the full version string.
2022-04-05 22:18:31 +02:00
Zbigniew Jędrzejewski-Szmek 3761002eea test: do --help/--version checks for systemd, firstboot, cryptenroll, s-n-w-o
I basically went by the list in systemd.directives for --help/-h.
kernel-install is also listed there, but will be added in a later commit.
2022-04-05 22:18:31 +02:00
Zbigniew Jędrzejewski-Szmek ffb7406ba9 tests: add a smoke test for --version option in binaries
This is very similar to (and directly based on) the test for --help. I think
it's nice to do this: the test is very quick, but it'll catch cases where we
forgot to hook up the option, or forgot to exit after printing --version, and
it'll also increase our test coverage a bit.
2022-04-05 22:18:31 +02:00
Frantisek Sumsal 9b264c1dfa partition: use udevadm wait 2022-04-04 15:59:40 +02:00
Franck Bui f887eab1da meson: build kernel-install man page when necessary 2022-03-31 21:12:05 +09:00
Zbigniew Jędrzejewski-Szmek 53877d0385
Merge pull request #22649 from keszybz/symlink-enablement-yet-again-punish-me-harder
Fixups to the unit enablement logic
2022-03-29 21:10:03 +02:00
Zbigniew Jędrzejewski-Szmek a6ea4dc13e meson: bump numbers for v251-rc1 2022-03-29 19:46:47 +02:00
Zbigniew Jędrzejewski-Szmek 2a2d002fb0 test-systemctl-enable: also use freshly-built systemd-id128
Tests were failing on centos7 because systemd-id128 is not in path.
2022-03-29 16:17:57 +02:00
Zbigniew Jędrzejewski-Szmek 50c5f5a3d9 test: add test for systemctl link & enable
This test has overlap with test-install-root, but it tests things at a
different level, so I think it's useful to add. It immediately shows various
bugs which will be fixed in later patches.
2022-03-29 16:17:56 +02:00
наб 53350c7bba Use new default-user-shell option instead of hard-coding bash in nspawn and user-record
Defaults to /bin/bash, no changes in the default configuration

The fallback shell for non-root users is as-specified,
and the interactive shell for nspawn sessions is started as
  exec(default-user-shell, "-" + basename(default-user-shell), ...)
before falling through to bash and sh
2022-03-28 14:24:46 +02:00
Heiko Becker 43a5fd98a5 meson: Detect python instead of hard-coding python3
It allows to specify the desired python executable (and version) via
meson's native file if there are multiple versions available.
2022-03-23 22:15:23 +09:00
Zbigniew Jędrzejewski-Szmek 77d45f1f83 meson: replace sh+find with an internal glob in the python helper
As suggested in https://github.com/systemd/systemd/pull/22810#discussion_r831708052

This makes the whole thing simpler. A glob is passed to helper which then resolves
it on its own. This way it's trivial to call the helper with a different
set of files for testing.
2022-03-23 11:37:35 +09:00
Lennart Poettering 43cc7a3ef4 sysupdate: add new component "sysupdate" 2022-03-19 00:13:55 +01:00
Yu Watanabe 2b2dbcbbeb meson: move to c_std=gnu11
Recently, the kernel communitiy started to discuss to move C11 (gnu11) [1],
and it seems to come near future.
Let's also move to c_std=gnu11. Unlike the kernel, we already uses
gnu99, hence hopefully we can move to C11 without changing anything.

[1] https://lore.kernel.org/lkml/CAHk-=wiyCH7xeHcmiFJ-YgXUy2Jaj7pnkdKpcovt8fYbVFW3TA@mail.gmail.com/
2022-03-11 15:13:29 +09:00
Yu Watanabe a17e54783a tree-wide: fix typo 2022-03-07 15:32:22 +09:00
Daan De Meyer baec7d782b meson: Drop required libfdisk version to 2.32
We initially pinned this to 2.33 in
e71f5585b9 because libfdisk 2.32 in
CentOS 8 didn't have
2f35c1ead6
backported.

If we check now, we can see it has been backported
(https://git.centos.org/rpms/util-linux/blob/c8s/f/SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch)
which means we can drop the required version to 2.32 instead of 2.33.
2022-02-24 20:06:55 +00:00
Evgeny Vereshchagin 678ba02033 meson: allow skipping optional dependencies
mostly to make sure that systemd is buildable without some dependencies
but other than that it should make it easier to build it with MSan without
having to compile all the dependencies with MSan.
2022-02-22 11:17:21 +00:00
Luca Boccassi 0628d48ec2 meson: disable export-dbus-interfaces target when cross-compiling
ERROR:
Cannot use target systemd as a generator because it is built for the
host machine and no exe wrapper is defined or needs_exe_wrapper is
true. You might want to set `native: true` instead to build it for
the build machine.
2022-02-09 14:31:44 +01:00
James Hilliard e3759ac43a meson: use bpftool based strip when available
This should be useable in bpftool v5.13 or newer based on:
d80b2fcbe0
2022-01-31 16:42:07 +09:00
James Hilliard 408832e603 meson: set minimum clang/llvm versions for bpf support
The minimum clang/llvm-strip version needed for building libbpf based
programs is 10.0.0, this is documented here:
https://github.com/libbpf/libbpf/tree/v0.6.1#bpf-co-re-compile-once--run-everywhere

Using an older version such as 9.0.0 will generate objects that
bpftool will not be able to generate skeletons for.
2022-01-31 14:27:11 +09:00
Jan Janssen b2ba8511e6 meson: Remove test-efi-create-disk.sh
The script was probably not used for a very long time. It is currently
passed systemd_boot.so as boot loader, which cannot work. The test
entries it creates are all pointing at non-existant efi/linux binaries,
which means they would not even show up in the menu if the created image
were actually booted. There is also nothing that actually tries to run
the image in the first place.

If we end up creating a proper systemd-boot test suite, it would be
better to start from scratch. In the meantime, mkosi already covers
the bare minimum with a simple bootup test.
2022-01-26 14:40:51 +01:00
Daan De Meyer e93ada9821 meson: Add missing test dependencies
Currently, running "meson build" followed by "meson test -C build"
will result in many failed tests due to missing dependencies. This
commit adds the missing dependencies to make sure no tests fail.
2022-01-22 01:56:03 +09:00
Yu Watanabe 30b6f7d714 meson: skip to search clang, llvm-string, and bpftool, if libbpf not found
Prompted by https://github.com/systemd/systemd/pull/22093#issuecomment-1016254914.
2022-01-19 14:23:41 +03:00
Zbigniew Jędrzejewski-Szmek ba900c1719
Merge pull request #22093 from yuwata/meson-bpftool-version
meson: require bpftool version >= 5.6
2022-01-18 15:09:47 +01:00
Evgeny Vereshchagin 691db9a718 meson: force ctags to use absolute paths
Looks like https://github.com/mesonbuild/meson/issues/957 was
reintroduced in meson-0.57.0 (and looking and https://mesonbuild.com/Release-notes-for-0-57-0.html
I'm not sure whether it was intentional or not) so run_command can no
longer be used to get around
https://github.com/mesonbuild/meson/issues/3589. Let's just force
ctags to always use absolute paths to fix it once and for all.
2022-01-18 15:07:11 +01:00
Zbigniew Jędrzejewski-Szmek 2979c8b7fc meson: drop unused SYSTEMD_STDIO_BRIDGE_BINARY_PATH
The whole point of systemd-stdio-bridge is to be executed on "foreign" systems
where the path might be different, so we use $PATH to find the binary everywhere.
2022-01-17 11:59:08 +01:00
Yu Watanabe dc7e9c1bc4 meson: use the compiler command array as is
Also check if the flags used when building bpf are supported by clang.
2022-01-14 17:01:58 +09:00
Yu Watanabe a6ac8b5a4d meson: check if clang supports bpf 2022-01-14 16:43:31 +09:00
Yu Watanabe ea78d2fb11 meson: require bpftool version >= 5.6
Closes #22051.
2022-01-14 16:43:31 +09:00
Jan Janssen bbec46c817 meson: Use files() for fuzzers
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Jan Janssen e1eeebbb11 meson: Use files() for tests
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Evgeny Vereshchagin e8635fd370 meson: no longer skip dependencies when fuzzers are built locally
to make it easier to fuzz code that uses external libraries like libelf/libdw.

The dependencies are skipped on OSS-Fuzz because they aren't available
at runtime if they aren't linked statically. This restriction can safely
be lifted when the fuzzers are built locally with all the dependencies
installed. As far as I know there is at least one fuzz target in the systemd
repository that can benefit from this: https://github.com/systemd/systemd/issues/11018
2022-01-10 09:42:38 +01:00
Yu Watanabe 8cc8a073a8 test: add test cases for fstab-generator 2022-01-07 00:58:50 +09:00
Michael Biebl cfd4c84add oomd: move oomctl to bindir
We don't really need oomctl during early boot, so bindir seems like a
more suitable place for the binary.
2022-01-06 12:52:01 +09:00
Zbigniew Jędrzejewski-Szmek aac8071730 meson: fix detection of libcryptsetup functions
Meson would generate the following compile test:

  #define crypt_set_metadata_size meson_disable_define_of_crypt_set_metadata_size

  #include <limits.h>
  #undef crypt_set_metadata_size

  #ifdef __cplusplus
  extern "C"
  #endif
  char crypt_set_metadata_size (void);

  #if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
  fail fail fail this function is not going to work
  #endif

  int main(void) {
    return crypt_set_metadata_size ();
  }

This works fine when the identifier being queried is an actual function. But
crypt_token_max() is an inline function, so getting the address would fail,
leading to a false negative result. Complation would fail because the function
would be defined twice.

With this patch, the check is changed to include the header:

  #include <libcryptsetup.h>
  #include <limits.h>

  #if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
  fail fail fail this function is not going to work
  #endif

  int main(void) {
    void *a = (void*) &crypt_set_metadata_size;
    long long b = (long long) a;
    return (int) b;
  }

which seems to work correctly.
2021-12-31 07:02:29 +09:00
Yu Watanabe 1bd0cc452c meson: obtain dbus directories from pkg-config 2021-12-28 23:00:58 +09:00
Yu Watanabe 7e560e79eb meson: show dbus interfaces directory in summary 2021-12-28 22:52:24 +09:00
James Hilliard 4b7b73c714 meson: don't try to guess versioned clang/llvm-strip bins for cross compile
This should simplify overriding the program locations as the binary
names should now not change if cross compiling.

It's likely any attempts at autodetecting these in cross environments will
be brittle at best so lets just disable it.
2021-12-25 22:37:04 +09:00
Zbigniew Jędrzejewski-Szmek a2b0cd3f5a meson: allow specifying a custom "tag" for the private shared libaries
We have /usr/lib/systemd/libsystemd-{shared,core}-nnn.so. With this
path the 'nnn' part can be changed to something different. The idea
is that during a package build this will be set to the package version.

This way during in-place upgrades with the same major version both
the new and old libraries can cooexit. This should fix the issue
when systemd programs are called during package upgrades and fail
to exec because the expect different symbols in the library they
are linked to.

This should fix https://bugzilla.redhat.com/show_bug.cgi?id=1906010.
2021-12-25 15:18:50 +09:00
Zbigniew Jędrzejewski-Szmek 4287c85589 meson: create new libsystemd-core.so private shared library
The scheme is very similar to libsystemd-shared.so: instead of building a
static library, we build a shared library from the same objects and link the
two users to it. Both systemd and systemd-analyze consist mostly of the fairly
big code in libcore, so we save a bit on the installation:

(-0g, no strip)
-rwxr-xr-x 5238864 Dec 14 12:52 /var/tmp/inst1/usr/lib/systemd/systemd
-rwxr-xr-x 5399600 Dec 14 12:52 /var/tmp/inst1/usr/bin/systemd-analyze
-rwxr-xr-x  244912 Dec 14 13:17 /var/tmp/inst2/usr/lib/systemd/systemd
-rwxr-xr-x  461224 Dec 14 13:17 /var/tmp/inst2/usr/bin/systemd-analyze
-rwxr-xr-x 5271568 Dec 14 13:17 /var/tmp/inst2/usr/lib/systemd/libsystemd-core-250.so

(-0g, strip)
-rwxr-xr-x 2522080 Dec 14 13:19 /var/tmp/inst1/usr/lib/systemd/systemd
-rwxr-xr-x 2604160 Dec 14 13:19 /var/tmp/inst1/usr/bin/systemd-analyze
-rwxr-xr-x  113304 Dec 14 13:19 /var/tmp/inst2/usr/lib/systemd/systemd
-rwxr-xr-x  207656 Dec 14 13:19 /var/tmp/inst2/usr/bin/systemd-analyze
-rwxr-xr-x 2648520 Dec 14 13:19 /var/tmp/inst2/usr/lib/systemd/libsystemd-core-250.so

So for systemd itself we grow a bit (2522080 → 2648520+113304=2761824), but
overall we save. The most is saved on all the test files that link to libcore,
if they are installed, because there's 15 of them:

$ du -s /var/tmp/inst?
220096	/var/tmp/inst1
122960	/var/tmp/inst2

I also considered making systemd-analyze a symlink to /usr/lib/systemd/systemd
and turning systemd into a multicall binary. We did something like this with
udevd and udevadm. But that solution doesn't fit well in this case.
systemd-analyze has a bunch of functionality that is not used in systemd,
so the systemd binary would need to grow quite a bit. And we're likely to
add new types of verification or introspection features in analyze, and this
baggage would only grow. In addition, there are the test binaries which also
benefit from this.
2021-12-25 15:18:47 +09:00
Yu Watanabe 2588920059
Merge pull request #21868 from lucab/ups/factory-locale-conf
factory: populate /etc/locale.conf with systemd build-time setting
2021-12-25 15:09:35 +09:00
Stephen Hemminger 7c4bd9ac98
bus-dump: change capture output to use pcapng (#21738)
This patch changes busctl capture to generate pcapng format
instead of the legacy pcap format files. It includes basic
meta-data in the file and still uses microsecond time
resolution. In future, more things can be added such as
high resolution timestams, statistics, etc.

PCAP Next Generation capture file format is what tshark uses
and is in process of being standardized in IETF. It is also
readable with libpcap.

$ capinfos /tmp/new.pcapng
File name:           /tmp/new.pcapng
File type:           Wireshark/... - pcapng
File encapsulation:  D-Bus
File timestamp precision:  microseconds (6)
Packet size limit:   file hdr: (not set)
Packet size limit:   inferred: 4096 bytes
Number of packets:   22
File size:           21kB
Data size:           20kB
Capture duration:    0.005694 seconds
First packet time:   2021-12-11 11:57:42.788374
Last packet time:    2021-12-11 11:57:42.794068
Data byte rate:      3,671kBps
Data bit rate:       29Mbps
Average packet size: 950.27 bytes
Average packet rate: 3,863 packets/s
SHA256:              b85ed8b094af60c64aa6d9db4a91404e841736d36b9e662d707db9e4096148f1
RIPEMD160:           81f9bac7ec0ec5cd1d55ede136a5c90413894e3a
SHA1:                8400822ef724b934d6000f5b7604b9e6e91be011
Strict time order:   True
Capture oper-sys:    Linux 5.14.0-0.bpo.2-amd64
Capture application: systemd 250 (250-rc2-33-gdc79ae2+)
Number of interfaces in file: 1
Interface #0 info:
                     Encapsulation = D-Bus (146 - dbus)
                     Capture length = 4096
                     Time precision = microseconds (6)
                     Time ticks per second = 1000000
                     Number of stat entries = 0
                     Number of packets = 22
2021-12-25 15:07:40 +09:00
Yu Watanabe d3d6b38f46
Merge pull request #21871 from keszybz/meson-sbat-report
Report sbat settings in meson summary
2021-12-25 15:03:50 +09:00
Yu Watanabe 9bcf483b11 meson: fix build with -Dcryptolib=openssl -Ddns-over-tls=false
Previously, when -Ddns-over-tls=false, libopenssl was missing in the
dependency of resolved.
Also, this drops libgpg_error when it is not necessary.

Replaces #21878.
2021-12-24 15:23:39 +00:00
Zbigniew Jędrzejewski-Szmek 3f871f1205 meson: move efi summary() section to src/boot/efi
This way we can add the entries more naturally in the same place where
they are defined.
2021-12-23 13:52:33 +01:00
Luca BRUNO 623370e643
factory: populate /etc/locale.conf with systemd build-time setting
This adds /etc/locale.conf to the set of configuration files
populated by tmpfiles.d factory /etc handling.
In particular, the build-time locale configuration in systemd is
now wired to a /usr factory file, and installed to the system.
On boot, if other locale customization tools did not write
/etc/locale.conf on the system, the factory default file gets
copied to /etc by systemd-tmpfiles.
This is done in order to avoid skews between different system
components when no locale settings are configured. At that point,
systemd can safely act as the fallback owner of /etc/locale.conf.
2021-12-23 11:01:12 +00:00
Evgeny Vereshchagin d2c3f14fed meson: make it compatible with AFL and honggfuzz again
afl-clang and hufzz-clang try to instrument the code and the
underlying compilers don't like it. It should probably be
fixed in both afl and honggfuzz eventually but until then
let's just use "raw" clang to build bpf-skeletons.

It's a follow-up to https://github.com/systemd/systemd/pull/21607
2021-12-22 15:03:18 +00:00
Yu Watanabe 3112d756a3 meson: fix cross compiling 2021-12-21 14:19:00 +00:00
Mike Gilbert 9a723ed6e8 basic: add a size check to format timex members properly
As of glibc-2.34, the size of members in struct timex varies depending on
the _TIME_BITS macro.

Fixes: https://github.com/systemd/systemd/issues/21826
2021-12-20 12:36:59 +09:00
наб 641e2124de kernel-install: replace 00-entry-directory with K_I_LAYOUT in k-i
341890de86 made "bootctl install" create
ESP\MID, in preparation of cf73f65089 that
followed it and created 00-entry-directory.install to make ESP\MID\KVER
if ESP\MID existed ‒ this meant that "bootctl install" followed by
"kernel-install $(uname -r) /boot/vml*$(uname -r) /boot/ini*$(uname -r)"
actually installed the kernel correctly.

Later, 31e57550b5 reverted the first
commit, meaning, that now running those two commands first installs
sd-boot, but then does nothing. Everything appears to work right,
nothing errors out, but no changes are actually done. To the untrained
eye (all of them), even running with -v appears to work:
all the hooks are run, as is depmod, but, again, nothing happens.

This is horrible. Nothing in either manpage suggests what to do
(nor should it, really), but the user is left with a bootloader that
appears fully funxional, since nothing suggests a failure in the output,
but with an unbootable machine, /no way to boot it/, even if they drop
to an EFI shell, since the boot bundle isn't present on the ESP,
and no real recourse even if they boot into a recovery system,
apart from installing like GRUB or whatever.

00- is purely instrumentation for 90-,
and separating one from the other has led to downstream dissatisfaxion
(indeed, the last mentioned commit cited cited exactly that as the
 reversion reason), while creating $ENTRY_DIR_ABS is only required
for bootloaders using the BLS, and shouldn't itself toggle anything.

To that end, introduce an /{e,l}/k/install.conf file that allows
overriding the detected layout, and detect it as "bls" if
$BOOT_ROOT/$MACHINE_ID ($ENTRY_DIR_ABS/..) exists, otherwise "other" ‒
if a user wishes to select a different bootloader,
like GRUB, they (or, indeed, the postinst script) can specify
layout=grub. This disables 90- and $ENTRY_DIR_ABS manipulation.
2021-12-17 14:57:56 +01:00
Yu Watanabe d9338387d9
Merge pull request #21786 from keszybz/dirent-work
Make FOREACH_DIRENT and FOREACH_DIRENT_ALL declare the iterator variables
2021-12-17 04:07:35 +09:00
Zbigniew Jędrzejewski-Szmek c01543fdd5 meson: drop three more single-use convenience libraries
The way that the cryptsetup plugins were built was unnecessarilly complicated.
We would build three static libraries that would then be linked into dynamic
libraries. No need to do this.

While at it, let's use a convenience library to avoid compiling the shared code
more than once.

We want the output .so files to be located in the main build directory,
like with all consumable build artifacts, so we need to maintain the split
between src/cryptsetup/cryptsetup-token/meson.build and the main meson.build
file.

AFAICT, the build artifacts are the same: exported and undefined symbols are
identical. There is a tiny difference in size, but I think it might be caused
by a different build directory name.
2021-12-16 11:51:40 +01:00