Commit Graph

35318 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek d00de84373
Merge pull request #10164 from poettering/btrfs-resize-fix
btrfs resize fix
2018-09-25 09:24:14 +02:00
Lennart Poettering 614a8274f2 udev: fix some type sloppiness
We use strtoul() which returns an "unsigned long", but then assign this
to int or unsigned in, i.e. drop 32bit silently on 64bit systems. Let's
clean this up a bit, and retain the right types.
2018-09-25 09:20:16 +02:00
Lennart Poettering 6ac386855c logind: fix blacklist/whitelist confusion in comment (#10165)
Triggered by this:

602a41c22a (r30575293)
2018-09-25 07:02:41 +09:00
Lennart Poettering 7fe96758d1 docs: fix CONTRIBUTING path (#10160) 2018-09-25 06:25:48 +09:00
Lennart Poettering 7e69127871 btrfs: log at debug log when we ignore errors
This stuff is likely to fail in many setups (for example when quota is
not supported by the btrfs version), hence only log at debug
level. Previously we'd silently ignore things altogether which makes
things pretty hard to debug.
2018-09-24 19:47:42 +02:00
Lennart Poettering de89949a71 btrfs: fix loopback resizing code
This corrects the block device to use, to the right path, as it was
before 553e15f21b.

Replaces: #10153
2018-09-24 19:44:06 +02:00
Lennart Poettering bd1b3f75e8 update TODO 2018-09-24 19:25:49 +02:00
Lennart Poettering a942661787 inhibit: use format-table to format systemd-inhibit --list
This changes the output a bit, as the previous multi-line output of each
inhibitor is changed to a single line, but it does unify the output look
with the one of our other tools. Moreover this adds proper sorting.
2018-09-24 19:21:00 +02:00
Lennart Poettering 2f47ef04ea inhibit: normalize variable types
When we parse an "u" from an sd_bus_message then we need to do that into
a uint32_t, not a pid_t or uid_t, even if this is likely the same.

Also, let's count objects we keep in memory as size_t as usual.
2018-09-24 19:21:00 +02:00
Lennart Poettering 0e6872cdfc inhibit: normalize when we log about failures to list inhibitors
let's print log messages about all types of errors inside of the
function, since otherwise we might sometimes log twice about some
specific cases.
2018-09-24 19:21:00 +02:00
Yu Watanabe 6c9c51e5e2 fs-util: make symlink_idempotent() optionally create relative link 2018-09-24 18:52:53 +03:00
Zbigniew Jędrzejewski-Szmek bee13f2e49
Merge pull request #9989 from yuwata/sd-device-enoent
sd-device: make sd_device_get_*() return -ENOENT if the values are not set
2018-09-24 17:27:49 +02:00
Zbigniew Jędrzejewski-Szmek 7e86bd73a4 seccomp: tighten checking of seccomp filter creation
In seccomp code, the code is changed to propagate errors which are about
anything other than unknown/unimplemented syscalls. I *think* such errors
should not happen in normal usage, but so far we would summarilly ignore all
errors, so that part is uncertain. If it turns out that other errors occur and
should be ignored, this should be added later.

In nspawn, we would count the number of added filters, but didn't use this for
anything. Drop that part.

The comments suggested that seccomp_add_syscall_filter_item() returned negative
if the syscall is unknown, but this wasn't true: it returns 0.

The error at this point can only be if the syscall was known but couldn't be
added. If the error comes from our internal whitelist in nspawn, treat this as
error, because it means that our internal table is wrong. If the error comes
from user arguments, warn and ignore. (If some syscall is not known at current
architecture, it is still silently ignored.)
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek b54f36c604 seccomp: reduce logging about failure to add syscall to seccomp
Our logs are full of:
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldstat() / -10037, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call get_thread_area() / -10076, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call set_thread_area() / -10079, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldfstat() / -10034, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldolduname() / -10036, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldlstat() / -10035, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call waitpid() / -10073, ignoring: Numerical argument out of domain
...
This is pointless and makes debug logs hard to read. Let's keep the logs
in test code, but disable it in nspawn and pid1. This is done through a function
parameter because those functions operate recursively and it's not possible to
make the caller to log meaningfully.


There should be no functional change, except the skipped debug logs.
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek f09da7ccbc test-seccomp: log function names
Various tests produce similar output, and the function names make it
easier to see where the output is generated.
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek 23e12f8e6c test-seccomp: move two similar tests closer 2018-09-24 17:19:11 +02:00
Zbigniew Jędrzejewski-Szmek f5acf84dbe run-unit-tests: add option to run unsafe tests too 2018-09-24 15:42:50 +02:00
Zbigniew Jędrzejewski-Szmek 3762f8e316 tests: add a runner for installed tests
We have "installed tests", but don't provide an easy way to run them.

The protocol is very simple: each test must return 0 for success, 77 means
"skipped", anything else is an error. In addition, we want to print test
output only if the test failed.

I wrote this simple script. It is pretty basic, but implements the functions
listed above. Since it is written in python it should be easy to add option
parsing (like running only specific tests, or running unsafe tests, etc.)

I looked at the following alternatives:
- Ubuntu root-unittests: this works, but just dumps all output to the terminal,
  has no coloring.
- @ssahani's test runner [2]
  It uses the unittest library and the test suite was implented as a class, and
  doesn't implement any of the functions listed above.
- cram [3,4]
  cram runs our tests, but does not understand the "ignore the output" part,
  has not support for our magic skip code (it uses hardcoded 80 instead),
  and seems dead upstream.
- meson test
  Here the idea would be to provide an almost-empty meson.build file under
  /usr/lib/systemd/tests/ that would just define all the tests. This would
  allow us to reuse the test runner we use normally. Unfortunately meson requires
  a build directory and configuration to be done before running tests. This
  would be possible, but seems a lot of effort to just run a few binaries.

[1] 242c96addb/debian/tests/root-unittests
[2] https://github.com/systemd/systemd-fedora-ci/blob/master/upstream/systemd-upstream-tests.py
[3] https://bitheap.org/cram/
[4] https://pypi.org/project/pytest-cram/

Fixes #10069.
2018-09-24 15:42:50 +02:00
Zbigniew Jędrzejewski-Szmek 465815aaa7 test-udev: use _cleanup_ and modernize style 2018-09-24 15:42:50 +02:00
Zbigniew Jędrzejewski-Szmek c745d2bfa0 basic/mount-util: reword debug message
"because blacklisted" is not grammatical, it should be something like
"becuase it is blacklisted", which in turn in too verbose. Let's use
a shorter form.
2018-09-24 15:42:50 +02:00
Zbigniew Jędrzejewski-Szmek 0532f2bb5d
Merge pull request #10087 from keszybz/xnox/fix-test-functions
test/test-functions: drop all prefixes
2018-09-24 15:15:23 +02:00
Dimitri John Ledkov a3156a8ee4 core: execute generators with manager's environmnet 2018-09-24 13:40:50 +01:00
Dimitri John Ledkov ea368f0bd2 core: execute environment_generators with manager's environment 2018-09-24 13:40:10 +01:00
Dimitri John Ledkov 78ec1bb436 exec-util: in execute_directories, support initial exec environment 2018-09-24 13:40:10 +01:00
Zbigniew Jędrzejewski-Szmek f11aae7151
Merge pull request #10082 from porrided/udev-ipoib
Introduce predictable naming for IP-over-InfiniBand NICs
2018-09-24 13:14:06 +02:00
Zbigniew Jędrzejewski-Szmek 54e6f0a38f
Merge pull request #9981 from pfl/dhcp6_pd_other_information_quirk
DHCPv6 PD other information quirk
2018-09-24 13:02:24 +02:00
Yu Watanabe c679e12af1 tree-wide: drop unnecessary initializations 2018-09-23 17:18:50 +09:00
Yu Watanabe 2c740afd16 tree-wide: do not assign unused return values 2018-09-23 17:18:50 +09:00
Yu Watanabe 8a80712bcd logind-acl: replace strdup()+set_consume() by set_put_strdup() 2018-09-23 17:18:50 +09:00
Yu Watanabe 8090b41ed5 gpt-auto-generator: do not assign '*ret' on error 2018-09-23 17:18:50 +09:00
Yu Watanabe 403660c508 tree-wide: use streq() instead of streq_ptr() 2018-09-23 17:18:50 +09:00
Yu Watanabe dcfbde3a43 sd-device: make sd_device_get_*() return -ENOENT if the values are not set 2018-09-23 17:18:19 +09:00
Yu Watanabe feae122f3e test-udev: use LOG_REALM_UDEV
Otherwise, even if SYSTEMD_LOG_LEVEL=debug is specified, the test does
not show most debug messages.
2018-09-22 09:56:40 +02:00
Yu Watanabe 51b006e18d udevadm: show only version number for '--version' option
This effectively reverts 2bc54be485
and relevant changes in #9920, as it is used to determine the version
of udev, e.g., dracut.

Fixes dracutdevs/dracut#468.
2018-09-21 10:58:54 +02:00
Zbigniew Jędrzejewski-Szmek 298950d055
Merge pull request #10135 from yuwata/log-skipped-tests
test: add log messages when some tests are skipped
2018-09-20 23:07:48 +02:00
Yu Watanabe 642d1a6d6e test-execute: skip several tests when running in container 2018-09-21 00:45:00 +09:00
Yu Watanabe 738c74d7b1 test-execute: also check python3 is installed or not 2018-09-21 00:45:00 +09:00
Yu Watanabe 767eab4750 test-process-util: skip several verifications when running in unprivileged container 2018-09-21 00:44:29 +09:00
Yu Watanabe 9590065f37 test-fs-util: skip some tests when running in unprivileged container 2018-09-21 00:44:29 +09:00
Yu Watanabe cd90ec7544 test-seccomp: add log messages when skipping tests 2018-09-21 00:32:44 +09:00
Yu Watanabe 92f6a1b6bc test-process-util: logs something when skipping tests 2018-09-21 00:32:36 +09:00
Zbigniew Jędrzejewski-Szmek 2e7e76af99 bus-util: drop now-unused functions 2018-09-20 16:52:02 +02:00
Zbigniew Jędrzejewski-Szmek b8b20f5a6a timesyncd: no need to reload dbus now 2018-09-20 16:52:02 +02:00
Zbigniew Jędrzejewski-Szmek 696fc8360d Revert "network: set DynamicUser= to systemd-networkd.service"
This reverts commit d4e9e574ea.
(systemd.conf.m4 part was already reverted in 5b5d82615011b9827466b7cd5756da35627a1608.)

Together those reverts should "fix" #10025 and #10011. ("fix" is in quotes
because this doesn't really fix the underlying issue, which is combining
DynamicUser= with strict container sandbox, but it avoids the problem by not
using that feature in our default installation.)

Dynamic users don't work well if the service requires matching configuration in
other places, for example dbus policy. This is true for those three services.
In effect, distros create the user statically [1, 2]. Dynamic users make more
sense for "add-on" services where not creating the user, or more precisely,
creating the user lazily, can save resources. For "basic" services, if we are
going to create the user on package installation anyway, setting DynamicUser=
just creates unneeded confusion. The only case where it is actually used is
when somebody forgets to do system configuration. But it's better to have the
service fail cleanly in this case too. If we want to turn on some side-effect
of DynamicUser=yes for those services, we should just do that directly through
fine-grained options. By not using DynamicUser= we also avoid the need to
restart dbus.

[1] bd9bf30727
[2] 48ac1cebde/f/systemd.spec (_473)
(Fedora does not create systemd-timesync user.)
2018-09-20 16:52:02 +02:00
Zbigniew Jędrzejewski-Szmek 62fb7e80fc Revert "resolve: enable DynamicUser= for systemd-resolved.service"
This reverts commit 0187368cad.
(systemd.conf.m4 part was already reverted in 5b5d82615011b9827466b7cd5756da35627a1608.)
2018-09-20 16:52:02 +02:00
Yu Watanabe 80f1b34442 sd-hwdb: initialize variable
The variable 'fn' was not initialized on compat mode.

Fixes CID#1395731.
2018-09-20 14:28:03 +02:00
João Paulo Rechi Vita 5c86583cf8 tmpfiles: Order tmpfiles-setup after journald
systemd-tmpfiles-setup.service needs to be ordered after
systemd-journald.service, so entries in /run/log/journal are already
created when systemd-tmpfiles tries to adjust its permissions.

This is specially problematic for setups using a volatile journal where
the initrd does not ship a machine-id (i.e. OSTree-based systems), where
logs from the initrd will be inaccessible for users in the
systemd-journal group. It also has a side effect of `journalctl --user`
failing with "No journal files were opened due to insufficient
permissions".

Fixes #10128.
2018-09-20 13:20:41 +02:00
Zbigniew Jędrzejewski-Szmek 3f491cccef meson: fix dirname/basename confusion in meson-and-wants.sh install helper (#10126)
We would create a useless empty directory under build/.
It seems we were lucky and all symlinks were installed into directories
which were alredy created because we installed something into the same
location earlier.

While at it, also add '-v' to 'mkdir -p'. This will print the names of
directories as they are created (just once), making it easier to see all of
what the install script is doing.
2018-09-20 16:01:58 +09:00
Patrik Flykt 65dd5e3105 networkd-manager: Fix route removals on shutdown
In order to shut down networkd properly, the delegated routes added
need to be removed properly, and as error reporting is wanted, the
network link is needed in the debug output.

Solve this by calling manager_dhcp6_prefix_remove_all(), which will
remove each prefix stored in the Manager structure, and while doing
that reference each link so that it isn't freed before the route
removal callback is called. This in turn causes the network link to
be referenced once more, and an explicit hashmap_remove() must be
called to remove the network link from the m->links hashmap.

Also, since the registered callback is not called when the DHCPv6
client is stopped with sd_dhcp6_client_stop(), an explicit call
to dhcp6_lease_pd_prefix_lost() needs to be made to clean up any
unreachable routes set up for the delegated prefixes.
2018-09-19 13:45:18 -06:00
Patrik Flykt e1d737ef9d networkd-manager: Update logging of route additions and removals
Log route additions and removals when the action is to be done, as
the reply rtnl message may contain only a success or failure.
2018-09-19 13:45:18 -06:00