Commit Graph

328 Commits

Author SHA1 Message Date
Lennart Poettering 1d7579c473 machine: add support for importing containers from plain directories
Fixes: #2728

This is also supposed to be preparation for doing #10234 eventually,
where a very similar operation is requested: instead of importing a tree
to /var/lib/machines it would need to be imported into
/var/lib/portables/.
2018-11-26 18:09:01 +01:00
Yu Watanabe d6601495be meson: also add option for debugging siphash 2018-11-23 00:36:35 +09:00
Yu Watanabe 20e97dd3de meson: add option for debugging udev 2018-11-23 00:28:27 +09:00
Zbigniew Jędrzejewski-Szmek d284b82b3e Move various files that don't need to be in basic/ to shared/
This doesn't have much effect on the final build, because we link libbasic.a
into libsystemd-shared.so, so in the end, all the object built from basic/
end up in libsystemd-shared. And when the static library is linked into binaries,
any objects that are included in it but are not used are trimmed. Hence, the
size of output artifacts doesn't change:

$ du -sb /var/tmp/inst*
54181861	/var/tmp/inst1    (old)
54207441	/var/tmp/inst1s   (old split-usr)
54182477	/var/tmp/inst2    (new)
54208041	/var/tmp/inst2s   (new split-usr)

(The negligible change in size is because libsystemd-shared.so is bigger
by a few hundred bytes. I guess it's because symbols are named differently
or something like that.)

The effect is on the build process, in particular partial builds. This change
effectively moves the requirements on some build steps toward the leaves of the
dependency tree. Two effects:
- when building items that do not depend on libsystemd-shared, we
  build less stuff for libbasic.a (which wouldn't be used anyway,
  so it's a net win).
- when building items that do depend on libshared, we reduce libbasic.a as a
  synchronization point, possibly allowing better parallelism.

Method:
1. copy list of .h files from src/basic/meson.build to /tmp/basic
2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less
2018-11-20 07:27:37 +01:00
Yu Watanabe 8a716f26ef missing: add ETHTOOL_LINK_MODE_* and struct ethtool_link_settings 2018-11-18 14:33:50 +09:00
Yu Watanabe a137a1c3ff sd-event: split definition of event_source to event-source.h 2018-11-16 22:57:37 +09:00
Michael Olbrich be5536a6af meson: fix building with -Ddns-over-tls=false
Assigning multiple variables in one line is no valid meson syntax.
Without this running meson with -Ddns-over-tls=false fails with:

meson.build:1191:8: ERROR:  Tried to assign an invalid value to variable.
2018-11-11 11:31:53 +01:00
Michael Olbrich 5996740a09 meson: don't build fuzzers if tests are disabled
Fuzzers are just special tests anyways and without this, building with
'-Dtests=false' fails with:

.../src/fuzz/fuzz-main.c:20: undefined reference to `test_setup_logging'
2018-11-11 11:28:41 +01:00
Tobias Jungel 99f68ef02d networkd: add missing bonding options (#10542)
Add support for bonding options system prio, port key and actor system mac.

These options exist in the linux kernel since 4.2
(torvalds/linux@171a42c38c)

Details:
https://www.kernel.org/doc/Documentation/networking/bonding.txt
2018-11-02 10:31:20 +09:00
Lennart Poettering fc03c53653
Merge pull request #10573 from faheel/master
Convert remaining docs to Markdown
2018-10-31 15:15:41 +01:00
Faheel Ahmad eea984028f docs: Update links to updated docs 2018-10-30 23:01:20 +05:30
Zbigniew Jędrzejewski-Szmek e0a1d4b049 Drop support for lz4 < 1.3.0
lz4-r130 was released on May 29th, 2015. Let's drop the work-around for older
versions. In particular, we won't test any new code against those ancient
releases, so we shouldn't pretend they are supported.
2018-10-29 21:54:42 +01:00
Yu Watanabe 80df8f2518 missing: support old linux/fou.h
linux/fou.h was introduced in 3.18.
FOU_ATTR_REMCSUM_NOPARTIAL was added in 4.0.
FOU_CMD_GET was added in 4.1.

Follow-up for 53cb501a13.
Fixes #10474.
2018-10-21 22:34:28 +09:00
Lennart Poettering f876f53789 units: add simple boot check unit
This is might be useful in some cases, but it's primarily an example for
a boot check service that can be plugged before boot-complete.target.

It's disabled by default.

All it does is check whether the failed unit count is zero
2018-10-19 22:34:50 +02:00
Lennart Poettering 8d16ed0785 add "systemd-bless-boot-generator"
This generator automatically pulls in "systemd-bless-boot.service" if
a boot with boot counting is detected.
2018-10-19 22:34:50 +02:00
Lennart Poettering 36695e880a add new systemd-bless-boot.service that marks boots as successful
This is the counterpiece to the boot counting implemented in
systemd-boot: if a boot is detected as successful we mark drop the
counter again from the booted snippet or kernel image.
2018-10-19 22:34:50 +02:00
Zbigniew Jędrzejewski-Szmek 30538ff10b meson: simplify definition of MEMORY_ACCOUNTING_DEFAULT
Let's just use the simplest form, it doesn't really matter how the define
looks after preprocessing.
2018-10-17 14:54:48 +02:00
Zbigniew Jędrzejewski-Szmek c02b6ee496 meson: define @HIGH_RLIMIT_NOFILE@ and use it everywhere 2018-10-17 14:54:48 +02:00
Lennart Poettering a8b627aaed main: bump fs.nr_open + fs.max-file to their largest possible values
After discussions with kernel folks, a system with memcg really
shouldn't need extra hard limits on file descriptors anymore, as they
are properly accounted for by memcg anyway. Hence, let's bump these
values to their maximums.

This also adds a build time option to turn thiss off, to cover those
users who do not want to use memcg.
2018-10-17 14:40:39 +02:00
Lennart Poettering 07ee5adb35 logind: change user-runtime-dir to query runtime dir size from logind via the bus
I think this is a slightly cleaner approach than parsing the
configuration file at multiple places, as this way there's only a single
reload cycle for logind.conf, and that's systemd-logind.service's
runtime.

This means that logind and dbus become a requirement of
user-runtime-dir, but given that XDG_RUNTIME_DIR is not set anyway
without logind and dbus around this isn't really any limitation.

This also simplifies linking a bit as this means user-runtime-dir
doesn't have to link against any code of logind itself.
2018-10-13 12:59:29 +02:00
Yu Watanabe be44b572f3 meson: fix '-Dstatic-libsystemd=true' or '-Dstatic-libudev=true'
Follow-up for a5d8835c78.
2018-10-12 17:54:23 +09:00
Zbigniew Jędrzejewski-Szmek 0e3cc902fa Revert "meson: use c_args in generator scripts (#10289)"
This reverts commit 56f56d5ad8.

This broke the compilation for coverity under travis. Our build script does
something like this:

$ CFLAGS='-D_Float128=long\ double -D_Float64=double -D_Float64x=long\ double -D_Float32=float -D_Float32x=double' meson cov-build -Dman=false
$ ninja -C build
...
[pid 27096] execve("/usr/bin/cc", ["/usr/bin/cc", "-D_Float128=long", "double", "-D_Float64=double", "-D_Float64x=long", "double", "-D_Float32=float", "-D_Float32x=double", "-E", "-dM", "-include", "linux/capability.h", "-include", "config.h", "-include", "../src/basic/missing.h", "-"], 0x55ab75ea4e80 /* 91 vars */) = 0
cc: error: double: No such file or directory
cc: error: double: No such file or directory
[pid 27096] +++ exited with 1 +++

I'm sure this could be fixed somehow, but since the original motivation for
56f56d5ad8 wasn't very strong, let's just revert
it as this seems to be the simplest solution.
2018-10-11 17:22:40 +02:00
Lennart Poettering 960d4b29d7
Merge pull request #10334 from keszybz/nomempool
Use mempool only in progs linked to libsystemd-shared.so
2018-10-11 13:44:34 +02:00
Zbigniew Jędrzejewski-Szmek abc8caf76c meson: use vars we already have defined in status 2018-10-11 11:10:53 +02:00
Zbigniew Jędrzejewski-Szmek a5d8835c78 mempool: only enable mempool use when linked to libsystemd-shared.so
Mempool use is enabled or disabled based on the mempool_use_allowed symbol that
is linked in.

Should fix assert crashes in external programs caused by #9792.
Replaces #10286.

v2:
- use two different source files instead of a gcc constructor
2018-10-11 11:10:37 +02:00
Zbigniew Jędrzejewski-Szmek c42c981924 meson: remove old comment
The linked page is gone, and I can't quite remember what the
warning was about. Something about recursive copying... Everything
seems to work.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek 5dbf13fa6c meson: drop workaround
It was added way back, and seems to work fine now without it.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek c09edc79ab meson: c++ is required for the fuzzer builds
The configuration would fail with an error about cpp being an unknown language
anyway, but it's nicer to fail early and explicitly.

https://github.com/systemd/systemd/pull/10339#issuecomment-428279175
2018-10-10 11:56:45 +02:00
Zbigniew Jędrzejewski-Szmek 9b0ca01903 meson: rename cpp_cmd to cxx_cmd
cpp is a really bad alias for c++ because it's also the name of the
preprocessor. Let's rename the variable.
2018-10-10 11:50:57 +02:00
Zbigniew Jędrzejewski-Szmek 1b2acaa7a6 meson: we cannot call get_compiler('cpp') if we didn't "add" it
Follow-up for f6d783ac3d.
2018-10-09 21:12:00 +02:00
Lennart Poettering 19d8c9c9b7 meson: include more build settings in status output 2018-10-09 15:42:40 +02:00
Lennart Poettering 80f39b81f3 portable: move portablectl to /usr/bin
Let's declare this a supported API. After all feedback I got at
conferences I think we are good to consider this stable now and make it
official API.
2018-10-08 18:49:45 +02:00
Yu Watanabe 56f56d5ad8 meson: use c_args in generator scripts (#10289)
May be useful in some cases.
2018-10-08 18:37:06 +02:00
Lennart Poettering 29088d374e
Merge pull request #9898 from keszybz/id128
Add a new tool 'systemd-id128'
2018-10-02 17:43:37 +02:00
Lennart Poettering c3281539da
Merge pull request #10246 from keszybz/fuzz-buss
Bus fuzzer
2018-10-02 15:45:21 +02:00
Zbigniew Jędrzejewski-Szmek 0d1d512f7f systemd-id128: a new tool to print machine/boot/invocation/app-specific ids
The raison d'etre for this program is printing machine-app-specific IDs. We
provide a library function for that, but not a convenient API. We can hardly
ask people to quickly hack their own C programs or call libsystemd through CFFI
in python or another scripting language if they just want to print an ID.

Verb 'new' was already available as 'journalctl --new-id128', but this makes
it more discoverable.

v2:
- rename binary to systemd-id128
- make --app-specific= into a switch that applies to boot-id and machine-id
2018-10-02 15:15:10 +02:00
Lennart Poettering 0bc7a22d93 docs: add a simple, auto-generated index.md
This is useful for the github pages feature
2018-10-02 10:43:54 +02:00
Zbigniew Jędrzejewski-Szmek e6bad67461 meson: treat all fuzz cases as unit tests
318/365 fuzz-bus-message:crash-26bba7182dedc8848939931d9fcefcb7922f2e56:address  OK       0.03 s
319/365 fuzz-bus-message:crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e:address  OK       0.03 s
320/365 fuzz-bus-message:crash-b88ad9ecf4aacf4a0caca5b5543953265367f084:address  OK       0.03 s
321/365 fuzz-bus-message:crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e:address  OK       0.03 s
322/365 fuzz-bus-message:crash-d8f3941c74219b4c03532c9b244d5ea539c61af5:address  OK       0.03 s
323/365 fuzz-bus-message:crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5:address  OK       0.03 s
324/365 fuzz-bus-message:leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20:address  OK       0.04 s
325/365 fuzz-bus-message:message1:address       OK       0.03 s
326/365 fuzz-bus-message:timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b:address  OK       0.03 s
327/365 fuzz-dhcp-server:discover-existing:address  OK       0.04 s
328/365 fuzz-dhcp-server:discover-new:address   OK       0.03 s
329/365 fuzz-dhcp-server:release:address        OK       0.04 s
330/365 fuzz-dhcp-server:request-existing:address  OK       0.03 s
331/365 fuzz-dhcp-server:request-new:address    OK       0.03 s
332/365 fuzz-dhcp-server:request-reboot:address  OK       0.03 s
333/365 fuzz-dhcp-server:request-renew:address  OK       0.03 s
334/365 fuzz-dns-packet:issue-7888:address      OK       0.03 s
335/365 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.03 s
336/365 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.06 s
337/365 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.04 s
338/365 fuzz-journal-remote:invalid-ts.txt:address  OK       0.04 s
339/365 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.06 s
340/365 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.04 s
341/365 fuzz-journal-remote:sample.txt:address  OK       0.07 s
342/365 fuzz-unit-file:directives.service:address  OK       0.03 s
343/365 fuzz-unit-file:empty.scope:address      OK       0.04 s
344/365 fuzz-unit-file:machine.slice:address    OK       0.03 s
345/365 fuzz-unit-file:oss-fuzz-6884:address    OK       0.05 s
346/365 fuzz-unit-file:oss-fuzz-6885:address    OK       0.03 s
347/365 fuzz-unit-file:oss-fuzz-6886:address    OK       0.04 s
348/365 fuzz-unit-file:oss-fuzz-6892:address    OK       0.03 s
349/365 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
350/365 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.04 s
351/365 fuzz-unit-file:oss-fuzz-6908:address    OK       0.05 s
352/365 fuzz-unit-file:oss-fuzz-6917:address    OK       0.06 s
353/365 fuzz-unit-file:oss-fuzz-6977:address    OK       0.08 s
354/365 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.10 s
355/365 fuzz-unit-file:oss-fuzz-7004:address    OK       0.03 s
356/365 fuzz-unit-file:oss-fuzz-8064:address    OK       0.03 s
357/365 fuzz-unit-file:oss-fuzz-8827:address    OK       0.50 s
358/365 fuzz-unit-file:proc-sys-fs-binfmt_misc.automount:address  OK       0.03 s
359/365 fuzz-unit-file:syslog.socket:address    OK       0.03 s
360/365 fuzz-unit-file:systemd-ask-password-console.path:address  OK       0.03 s
361/365 fuzz-unit-file:systemd-machined.service:address  OK       0.03 s
362/365 fuzz-unit-file:systemd-resolved.service:address  OK       0.03 s
363/365 fuzz-unit-file:systemd-tmpfiles-clean.timer:address  OK       0.03 s
364/365 fuzz-unit-file:timers.target:address    OK       0.03 s
365/365 fuzz-unit-file:var-lib-machines.mount:address  OK       0.04 s

This gives us slightly nicer coverage in the normal test run.

When in a git repo, git ls-files is used to get a list of files known to git.
This mirrors what update-man-rules does for man files. Only looking at files
known to git makes it easier to not forget to commit the test file to git,
and also makes bisecting easier if some files are left in repo.

When outside of a git repo, we expect to be unpacked from a tarball, so just
using all files reported by ls is OK.
2018-10-02 09:42:19 +02:00
Zbigniew Jędrzejewski-Szmek 243e5cecc3 meson: use .source_root() in more places
In the main meson.build file, .source_root() and .current_source_dir() are
equivalent, but it seems more appropriate to use .source_root() when we are appending
a path which is by design relative to repo root.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek fd5dec9adf meson: add -Dlog-trace to set LOG_TRACE
The justification is the same as for -Dvalgrind: setting config in
meson in this way is easier, because when the value is changed stuff
that should be rebuilt is rebuilt.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek 6bd2bc8e16 meson: drop duplicated condition
The generic check suffices for those four.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek c74a3f973e fuzz: unify the "fuzz-regressions" directory with the main corpus
There isn't really much need to keep them separate. Anything which is a good
corpus entry can be used as a smoke test, and anything which which is a
regression test can just as well be inserted into the corpus.

The only functional difference from this patch (apart from different paths in
output) is that the regression tests are now zipped together with the rest of
the corpus.

$ meson configure build -Dslow-tests=true && ninja -C build test
...
307/325 fuzz-dns-packet:issue-7888:address      OK       0.06 s
308/325 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.04 s
309/325 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.07 s
310/325 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.05 s
311/325 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.05 s
312/325 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.07 s
313/325 fuzz-unit-file:oss-fuzz-6884:address    OK       0.06 s
314/325 fuzz-unit-file:oss-fuzz-6885:address    OK       0.05 s
315/325 fuzz-unit-file:oss-fuzz-6886:address    OK       0.05 s
316/325 fuzz-unit-file:oss-fuzz-6892:address    OK       0.05 s
317/325 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
318/325 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.06 s
319/325 fuzz-unit-file:oss-fuzz-6908:address    OK       0.07 s
320/325 fuzz-unit-file:oss-fuzz-6917:address    OK       0.07 s
321/325 fuzz-unit-file:oss-fuzz-6977:address    OK       0.13 s
322/325 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.12 s
323/325 fuzz-unit-file:oss-fuzz-7004:address    OK       0.05 s
324/325 fuzz-unit-file:oss-fuzz-8064:address    OK       0.05 s
325/325 fuzz-unit-file:oss-fuzz-8827:address    OK       0.52 s
2018-10-02 09:41:25 +02:00
Thiago Macieira 044c2c7a2b Make bzip2 an optional dependency for systemd-importd
Yes, there are still a lot of users of bzip2, but it's fallen out of
favour after LZMA/xz, which can compress a lot more and often
decompresses faster than bzip2 too.
2018-09-25 10:58:09 +02:00
Zbigniew Jędrzejewski-Szmek c1cd674357 meson: drop some unneeded parens 2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 3b2bdd625a meson: always allow compilation of tests binaries 2018-09-13 12:07:34 +02:00
Yu Watanabe fd1939fbe7 meson: do not build tests by default when '-Dtests=false'
[zj: it is still possible to build tests explicitly by calling
     ninja -C build test-name. This way we have full flexibility.]
2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 938be08926 meson: disable _all_ tests when -Dtests=false
Back in 08318a2c5a, value "false" was enabled for
'-Dtests=', but various tests were not conditionalized properly. So even with
-Dtests=false -Dslow-tests=false we'd run 120 tests. Let's make this consistent.
2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek d3da291eb0 meson: disable "slow tests" too when tests are generally disabled
We would have a strange situation where after setting -Dslow-tests=true -Dtests=false
we'd get mostly the slow tests (plus some other ones which I'll fix in
subsequent commit). Let's simplify things by making -Dtests=false just
disable those tests too.
2018-09-13 12:07:34 +02:00
Filipe Brandenburger 49cdae63d1 test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIR
This makes it so that tests no longer need to know the absolute paths to the
source and build dirs, instead using the systemd-runtest.env file to get these
paths when running from the build tree.

Confirmed that test-catalog works on `ninja test`, when called standalone and
also when the environment file is not present, in which case it will use the
installed location under /usr/lib/systemd/catalog.

The location can now also be overridden for this test by setting the
$SYSTEMD_CATALOG_DIR environment variable.
2018-09-12 09:49:03 -07:00
Filipe Brandenburger e2d413707f test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA
This simplifies get_testdata_dir() to simply checking for an environment
variable, with an additional function to locate a systemd-runtest.env file in
the same directory as the test binary and reading environment variable
assignments from that file if it exists.

This makes it possible to:
- Run `ninja test` from the build dir and have it use ${srcdir}/test for
  test unit definitions.
- Run a test directly, such as `build/test-execute` and have it locate
  them correctly.
- Run installed tests (from systemd-tests package) and locate the test
  units in the installed location (/usr/lib/systemd/tests/testdata), in
  which case the absence of the systemd-runtest.env file will have
  get_testdata_dir() use the installed location hardcoded into the
  binaries.

Explicit setting of $SYSTEMD_TEST_DATA still overrides the contents of
systemd-runtest.env.
2018-09-12 09:49:03 -07:00