]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoMerge pull request #15297 from poettering/homed-no-fallocate
Anita Zhang [Fri, 3 Apr 2020 22:49:43 +0000 (15:49 -0700)] 
Merge pull request #15297 from poettering/homed-no-fallocate

homed: fall back to ftruncate() if fallocate() is not supported on ba…

4 years agoMerge pull request #15315 from DaanDeMeyer/deprecate-sd-bus-priority
Zbigniew Jędrzejewski-Szmek [Fri, 3 Apr 2020 16:07:54 +0000 (18:07 +0200)] 
Merge pull request #15315 from DaanDeMeyer/deprecate-sd-bus-priority

sd-bus: Deprecate priority functions

4 years agocapability: don't skip ambient caps setup if we actually have something to set
Lennart Poettering [Thu, 2 Apr 2020 15:20:47 +0000 (17:20 +0200)] 
capability: don't skip ambient caps setup if we actually have something to set

Follow-up for 7ea4392f1e444388caa706d6bd64fb7b30dc2903

Let's not hide errors needlessly aggressively.

4 years agoMerge pull request #15310 from poettering/repart-no-enable
Zbigniew Jędrzejewski-Szmek [Fri, 3 Apr 2020 15:44:47 +0000 (17:44 +0200)] 
Merge pull request #15310 from poettering/repart-no-enable

make systemd-repart static again, but condition it out if no config

4 years agoshared/dissect-image: log messages from cryptsetup
Topi Miettinen [Thu, 2 Apr 2020 13:57:26 +0000 (16:57 +0300)] 
shared/dissect-image: log messages from cryptsetup

Before:
```
write(2, "Device /dev/loop1p1 is too small.\n", 34) = -1 ENOTCONN (Transport
endpoint is not connected)
```

After:
```
$ journalctl -b -e | grep 'too small'
Apr 02 16:53:30 loora systemd[343579]: Device /dev/loop1p1 is too small.
```

4 years agoresolve: reload /etc/hosts on inode change
Giedrius Statkevičius [Sun, 22 Mar 2020 20:40:18 +0000 (22:40 +0200)] 
resolve: reload /etc/hosts on inode change

On certain distributions such as NixOS the mtime of `/etc/hosts` is
locked to a fixed value. In such cases, only checking the last mtime of
`/etc/hosts` is not enough - we also need to check if the st_ino/st_dev
match up. Thus, let's make sure make sure that systemd-resolved also
rereads `/etc/hosts` if the inode or the device containing `/etc/hosts` changes.

Test script:

```bash
hosts="/etc/hosts"
echo "127.0.0.1 testpr" > "hosts_new"
mv "hosts_new" "$hosts"
resolvectl query testpr || exit 1
mtime="$(stat -c %y "$hosts")"
echo "127.0.0.1 newhost" > "hosts_tmp"
touch -d "$mtime" "hosts_tmp"
install -p "hosts_tmp" "$hosts"
sleep 10
resolvectl query newhost || exit 1
rm -f "hosts_tmp"
```

Closes #14456.

4 years agoMerge pull request #15309 from poettering/strv-split
Evgeny Vereshchagin [Fri, 3 Apr 2020 03:37:54 +0000 (06:37 +0300)] 
Merge pull request #15309 from poettering/strv-split

remove dead-lock in strv_split()

4 years agosd-bus: remove unused priority logic 15315/head
Daan De Meyer [Thu, 2 Apr 2020 19:42:32 +0000 (21:42 +0200)] 
sd-bus: remove unused priority logic

4 years agosd-bus: Deprecate priority functions
Daan De Meyer [Thu, 2 Apr 2020 19:36:59 +0000 (21:36 +0200)] 
sd-bus: Deprecate priority functions

4 years agounits: run systemd-repart only if there's configuration for it 15310/head
Lennart Poettering [Thu, 2 Apr 2020 15:04:38 +0000 (17:04 +0200)] 
units: run systemd-repart only if there's configuration for it

4 years agoRevert "units: make systemd-repart.service installable"
Lennart Poettering [Thu, 2 Apr 2020 15:01:34 +0000 (17:01 +0200)] 
Revert "units: make systemd-repart.service installable"

This reverts commit 7e1ed1f3b29162df25064b33dc55ac8cf432bb0b.

systemd-repart is not a user service that should be something people
enable/disable, instead it should just work if there's configuration for
it. It's like systemd-tmpfiles, systemd-sysusers, systemd-load-modules,
systemd-binfmt, systemd-systemd-sysctl which are NOPs if they have no
configuration, and thus don't hurt, but cannot be disabled since they
are too deep part of the OS.

This doesn't mean people couldn't disable the service if they really
want to, there's after all "systemctl mask" and build-time disabling,
but those are OS developer facing instead of admin facing, that's how it
should be.

Note that systemd-repart is in particular an initrd service, and so far
enable/disable state of those is not managed anyway via "systemctl
enable/disable" but more what dracut decides to package up and what not.

4 years agoupdate TODO
Lennart Poettering [Thu, 2 Apr 2020 14:58:49 +0000 (16:58 +0200)] 
update TODO

4 years agostring-util: make clear that split() + FOREACH_WORD() should die 15309/head
Lennart Poettering [Thu, 2 Apr 2020 14:38:27 +0000 (16:38 +0200)] 
string-util: make clear that split() + FOREACH_WORD() should die

4 years agostring-util: make sure we eat even half complete words in split()
Lennart Poettering [Thu, 2 Apr 2020 14:36:33 +0000 (16:36 +0200)] 
string-util: make sure we eat even half complete words in split()

split() and FOREACH_WORD really should die, and everything be moved to
extract_first_word() and friends, but let's at least make sure that for
the remaining code using it we can't deadlock by not progressing in the
word iteration.

Fixes: #15305
4 years agostring-util: some minor coding style updates
Lennart Poettering [Thu, 2 Apr 2020 14:00:55 +0000 (16:00 +0200)] 
string-util: some minor coding style updates

4 years agoupdate TODO
Lennart Poettering [Thu, 2 Apr 2020 14:00:06 +0000 (16:00 +0200)] 
update TODO

4 years agoMerge pull request #15210 from ssahani/networkctl-up-down
Zbigniew Jędrzejewski-Szmek [Thu, 2 Apr 2020 08:43:53 +0000 (10:43 +0200)] 
Merge pull request #15210 from ssahani/networkctl-up-down

Merging by hand because github refuses merging because "Rebasing the commits of
this branch on top of the base branch cannot be performed automatically as this
would create a different result than a regular merge.".

4 years agosd-bus: add va_list variants of variadic convenience functions
Vito Caputo [Tue, 31 Mar 2020 14:28:01 +0000 (07:28 -0700)] 
sd-bus: add va_list variants of variadic convenience functions

Consumers of the sd-bus convenience API can't make convenience
helpers of their own without va_list variants.

This commit is a mechanical change splitting out the existing function
bodies into bare va_list variants having a 'v' suffixed to the names.

The original functions now simply create the va_list before forwarding
the call on to the va_list variant, and the va_list variants dispense
with those steps.

4 years agoMerge pull request #15252 from ssahani/dhcpv6-mud
Zbigniew Jędrzejewski-Szmek [Thu, 2 Apr 2020 08:23:15 +0000 (10:23 +0200)] 
Merge pull request #15252 from ssahani/dhcpv6-mud

DHCPv6: Add support to send MUD URL

4 years agoMerge pull request #15109 from keszybz/units-make-installable
Zbigniew Jędrzejewski-Szmek [Thu, 2 Apr 2020 08:21:29 +0000 (10:21 +0200)] 
Merge pull request #15109 from keszybz/units-make-installable

Make homed/userdbd/repart services installable (to allow uninstalling)

4 years agoudev: Fix SIGSEGV in AlternativeNamesPolicy handling
Lénaïc Huard [Wed, 1 Apr 2020 21:45:08 +0000 (23:45 +0200)] 
udev: Fix SIGSEGV in AlternativeNamesPolicy handling

The function sd_device_get_property_value has some paths where it exits without
touching the n pointer. In those cases, n remained uninitialized until it was
eventually read inside isempty where it caused the segmentation fault.

Fixes #15078

4 years agoMerge pull request #15238 from rpls/canfd
Lennart Poettering [Thu, 2 Apr 2020 08:13:24 +0000 (10:13 +0200)] 
Merge pull request #15238 from rpls/canfd

network: can: add support for CAN-FD related properties

4 years agonetwork: can: add support for CAN-FD related properties 15238/head
Richard Petri [Thu, 26 Mar 2020 21:27:41 +0000 (22:27 +0100)] 
network: can: add support for CAN-FD related properties

4 years agonetwork: can: introduce a config parser function for bitrates
Richard Petri [Mon, 30 Mar 2020 21:05:56 +0000 (23:05 +0200)] 
network: can: introduce a config parser function for bitrates

For now, this function is nearly equivalent to the si_uint64 parser, except for
an additional range check as Linux only takes 32-bit values as bitrates. In
future, this may also be used to introduce fancier bitrate config formats.

4 years agohomed: fall back to ftruncate() if fallocate() is not supported on backing fs 15297/head
Lennart Poettering [Wed, 1 Apr 2020 16:06:25 +0000 (18:06 +0200)] 
homed: fall back to ftruncate() if fallocate() is not supported on backing fs

This means "discard" mode is enabled implicitly on such simpler backing
fs.

Fixes: #15059
4 years agonetwork: DHCPv6 Add support to send MUD URL 15252/head
Susant Sahani [Mon, 30 Mar 2020 14:31:10 +0000 (16:31 +0200)] 
network: DHCPv6 Add support to send MUD URL

4 years agosd-dhcpv6: Add support to set request MUD URL
Susant Sahani [Mon, 30 Mar 2020 14:30:46 +0000 (16:30 +0200)] 
sd-dhcpv6: Add support to set request MUD URL

4 years agoMerge pull request #15253 from DaanDeMeyer/object-vtable-error-docs
Zbigniew Jędrzejewski-Szmek [Wed, 1 Apr 2020 10:25:34 +0000 (12:25 +0200)] 
Merge pull request #15253 from DaanDeMeyer/object-vtable-error-docs

sd-bus: Add error handling info to sd_bus_add_object_vtable docs

4 years agoMerge pull request #15278 from vcaputo/more-trivial-cleanups
Zbigniew Jędrzejewski-Szmek [Tue, 31 Mar 2020 22:16:56 +0000 (00:16 +0200)] 
Merge pull request #15278 from vcaputo/more-trivial-cleanups

Expand use of _cleanup_close_ where trivial

4 years agoman: mention that stdout logging works the same as stderr logging
Lennart Poettering [Tue, 31 Mar 2020 13:59:29 +0000 (15:59 +0200)] 
man: mention that stdout logging works the same as stderr logging

Apparently people wondered about that:

https://lists.freedesktop.org/archives/systemd-devel/2020-March/044091.html

4 years agosd-bus: sd_bus_call docs improvements
Daan De Meyer [Tue, 31 Mar 2020 17:50:53 +0000 (19:50 +0200)] 
sd-bus: sd_bus_call docs improvements

4 years agosd-bus: Add sd_bus_get/set_priority docs + fixes
Daan De Meyer [Tue, 31 Mar 2020 19:06:02 +0000 (21:06 +0200)] 
sd-bus: Add sd_bus_get/set_priority docs + fixes

4 years agoMerge pull request #15229 from ssahani/mud
Zbigniew Jędrzejewski-Szmek [Tue, 31 Mar 2020 22:10:13 +0000 (00:10 +0200)] 
Merge pull request #15229 from ssahani/mud

network: Introduce MUD

4 years agosd-bus: Add note about sd_bus_reply_method_return to SD_BUS_METHOD docs 15253/head
Daan De Meyer [Mon, 30 Mar 2020 19:11:42 +0000 (21:11 +0200)] 
sd-bus: Add note about sd_bus_reply_method_return to SD_BUS_METHOD docs

4 years agosd-bus: Add sd_bus_add_object and callback docs
Daan De Meyer [Mon, 30 Mar 2020 18:53:24 +0000 (20:53 +0200)] 
sd-bus: Add sd_bus_add_object and callback docs

4 years agosd-bus: Fix typos in sd_bus_add_object_vtable docs
Daan De Meyer [Sat, 28 Mar 2020 21:22:58 +0000 (22:22 +0100)] 
sd-bus: Fix typos in sd_bus_add_object_vtable docs

4 years agosd-bus: Wrap add_object_vtable docs at 100 columns
Daan De Meyer [Sat, 28 Mar 2020 21:03:19 +0000 (22:03 +0100)] 
sd-bus: Wrap add_object_vtable docs at 100 columns

4 years ago*: use _cleanup_close_ with fdopendir() where trivial 15278/head
Vito Caputo [Tue, 31 Mar 2020 09:35:00 +0000 (02:35 -0700)] 
*: use _cleanup_close_ with fdopendir() where trivial

Also convert these to use take_fdopendir().

4 years ago*: use _cleanup_close_ with fdopen() where trivial
Vito Caputo [Tue, 31 Mar 2020 09:29:37 +0000 (02:29 -0700)] 
*: use _cleanup_close_ with fdopen() where trivial

Also convert these to use take_fdopen().

4 years ago*: convert amenable fdopendir() calls to take_fdopendir()
Vito Caputo [Tue, 31 Mar 2020 09:00:44 +0000 (02:00 -0700)] 
*: convert amenable fdopendir() calls to take_fdopendir()

Some fdopendir() calls remain where safe_close() is manually
performed, those could be simplified as well by converting to
use the _cleanup_close_ machinery, but makes things less trivial
to review so left for a future cleanup.

4 years agofileio: add take_fdopendir() variant
Vito Caputo [Tue, 31 Mar 2020 08:59:33 +0000 (01:59 -0700)] 
fileio: add take_fdopendir() variant

fdopendir() wrapper analogous to take_fdopen()

4 years ago*: convert amenable fdopen calls to take_fdopen
Vito Caputo [Tue, 31 Mar 2020 08:07:21 +0000 (01:07 -0700)] 
*: convert amenable fdopen calls to take_fdopen

Mechanical change to eliminate some cruft by using the
new take_fdopen{_unlocked}() wrappers where trivial.

4 years agofileio: introduce take_fdopen{_unlocked}() variant
Vito Caputo [Tue, 31 Mar 2020 07:49:07 +0000 (00:49 -0700)] 
fileio: introduce take_fdopen{_unlocked}() variant

With the addition of _cleanup_close_ there's a repetitious
pattern of assigning -1 to the fd after a successful fdopen
to prevent its close on cleanup now that the FILE * owns the
fd.

This introduces a wrapper that instead takes a pointer to the
fd being opened, and always overwrites the fd with -1 on success.

A future commit will cleanup all the fdopen call sites to use the
wrapper and elide the manual -1 fd assignment.

4 years agoMerge pull request #15268 from poettering/sigusr1-sigusr2
Zbigniew Jędrzejewski-Szmek [Tue, 31 Mar 2020 13:32:28 +0000 (15:32 +0200)] 
Merge pull request #15268 from poettering/sigusr1-sigusr2

Doing manual merge because github thinks there's a conflict.

4 years agounits: do not pull in home.mount from systemd-homed.service
Lennart Poettering [Tue, 31 Mar 2020 09:35:08 +0000 (11:35 +0200)] 
units: do not pull in home.mount from systemd-homed.service

/home is posibly a remote file system. it makes sense to order homed
after it, so that we can properly enumerate users in it, but we probably
shouldn't pull it in ourselves, and leave that to users to configure
otherwise.

Fixes: #15102
4 years agohome: fix several typos
Vito Caputo [Tue, 31 Mar 2020 10:50:13 +0000 (03:50 -0700)] 
home: fix several typos

4 years agotest: print path to build directory on misconfiguration 15109/head
Zbigniew Jędrzejewski-Szmek [Tue, 31 Mar 2020 13:13:13 +0000 (15:13 +0200)] 
test: print path to build directory on misconfiguration

This way it's easier to see when a wrong $BUILD_DIR was passed.

4 years agounits: make systemd-userdbd.{socket,service} installable
Zbigniew Jędrzejewski-Szmek [Fri, 13 Mar 2020 17:40:54 +0000 (18:40 +0100)] 
units: make systemd-userdbd.{socket,service} installable

It's lightweight and generally useful, so it should be enabled by default. But
users might want to disable it for whatever reason, and things should be fine
without it, so let's make it installable so it can be disabled if wanted.

Fixes #15175.

4 years agounits: make systemd-homed.service installable
Zbigniew Jędrzejewski-Szmek [Fri, 13 Mar 2020 17:38:09 +0000 (18:38 +0100)] 
units: make systemd-homed.service installable

Fixes #15083. Users might want to disable homed if not used to save resources.

4 years agounits: make systemd-repart.service installable
Zbigniew Jędrzejewski-Szmek [Fri, 13 Mar 2020 17:33:44 +0000 (18:33 +0100)] 
units: make systemd-repart.service installable

This essentially adds another layer of configurability:
build disable, this, presence of configuration. The default is
set to enabled, because the service does nothing w/o config.

4 years agouser-util: switch order of checks in valid_user_group_name_or_id_full()
Lennart Poettering [Mon, 30 Mar 2020 19:46:01 +0000 (21:46 +0200)] 
user-util: switch order of checks in valid_user_group_name_or_id_full()

When we are supposed to accept numeric UIDs formatted as string, then
let's check that first, before passing things on to
valid_user_group_name_full(), since that might log about, and not the
other way round.

See: #15201
Follow-up for: 93c23c9297e48e594785e0bb9c51504aae5fbe3e

4 years agohome: narrow scope of 'size_t n'
Vito Caputo [Tue, 31 Mar 2020 07:29:26 +0000 (00:29 -0700)] 
home: narrow scope of 'size_t n'

trivial cosmetic cleanup

4 years agohomectl: fix a typo
Piero La Terza [Mon, 30 Mar 2020 19:21:21 +0000 (21:21 +0200)] 
homectl: fix a typo

stroage -> storage

4 years agonetwork: DHCPv4 - introduce The Manufacturer Usage Description (MUD) 15229/head
Susant Sahani [Mon, 30 Mar 2020 14:43:28 +0000 (16:43 +0200)] 
network: DHCPv4 - introduce The Manufacturer Usage Description (MUD)

4 years agosd-dhcpv4: introduce The Manufacturer Usage Description (MUD)
Susant Sahani [Mon, 30 Mar 2020 14:42:48 +0000 (16:42 +0200)] 
sd-dhcpv4: introduce The Manufacturer Usage Description (MUD)

4 years agoMerge pull request #15197 from ssahani/smtp-dhcp
Lennart Poettering [Mon, 30 Mar 2020 16:58:26 +0000 (18:58 +0200)] 
Merge pull request #15197 from ssahani/smtp-dhcp

DHCP4: Add support to emit and receive SMTP servers.

4 years agoMerge pull request #13084 from ddstreet/log_time
Lennart Poettering [Mon, 30 Mar 2020 15:57:34 +0000 (17:57 +0200)] 
Merge pull request #13084 from ddstreet/log_time

log: add support for prefixing console log messages with current timestamp

4 years agoMerge pull request #15194 from keur/import_pull_etag
Lennart Poettering [Mon, 30 Mar 2020 15:34:06 +0000 (17:34 +0200)] 
Merge pull request #15194 from keur/import_pull_etag

import: Only keep RO copy if ETag header is set

4 years agoMerge pull request #14853 from floppym/issue9806
Lennart Poettering [Mon, 30 Mar 2020 15:27:55 +0000 (17:27 +0200)] 
Merge pull request #14853 from floppym/issue9806

safe_fork: unblock most signals before waiting for child

4 years agoMerge pull request #15251 from keszybz/coverity-fixes
Lennart Poettering [Mon, 30 Mar 2020 15:18:35 +0000 (17:18 +0200)] 
Merge pull request #15251 from keszybz/coverity-fixes

A few small fixups for stuff found by coverity

4 years agoMerge pull request #14338 from keszybz/functional-test-rework
Frantisek Sumsal [Mon, 30 Mar 2020 14:25:12 +0000 (16:25 +0200)] 
Merge pull request #14338 from keszybz/functional-test-rework

Functional test rework

4 years agouserwork: fix signal worker sends to manager requesting more workers 15268/head
Lennart Poettering [Mon, 30 Mar 2020 13:42:02 +0000 (15:42 +0200)] 
userwork: fix signal worker sends to manager requesting more workers

That's what you get for changing these signals around, after checking
everything works, not before.

Bad, Lennart, bad!

Fixes: #15085
4 years agoci: turn off FuzzBuzz
Evgeny Vereshchagin [Mon, 30 Mar 2020 06:42:19 +0000 (06:42 +0000)] 
ci: turn off FuzzBuzz

I don't think anyone uses it.

4 years agotravis: install ninja with pip
Evgeny Vereshchagin [Sun, 29 Mar 2020 23:32:00 +0000 (23:32 +0000)] 
travis: install ninja with pip

https://mesonbuild.com/Release-notes-for-0-54-0.html#ninja-version-requirement-bumped-to-17
https://github.com/mesonbuild/meson/issues/6867

4 years agonetworkctl: Add support to display DHCP SMTP servers 15197/head
Susant Sahani [Mon, 23 Mar 2020 09:42:00 +0000 (10:42 +0100)] 
networkctl: Add support to display DHCP SMTP servers

4 years agosd-network: Add support to emit and receive SMTP server information
Susant Sahani [Mon, 23 Mar 2020 09:41:33 +0000 (10:41 +0100)] 
sd-network: Add support to emit and receive SMTP server information

4 years agonetwork: DHCP - add support to emit and receive SMTP server information
Susant Sahani [Mon, 23 Mar 2020 09:40:49 +0000 (10:40 +0100)] 
network: DHCP - add support to emit and receive SMTP server information

4 years agoMerge pull request #15217 from keszybz/beef-up-sd-path
Zbigniew Jędrzejewski-Szmek [Sun, 29 Mar 2020 20:57:53 +0000 (22:57 +0200)] 
Merge pull request #15217 from keszybz/beef-up-sd-path

Export sd-path functions and beef up systemd-path to show more items

4 years agosd-bus: Fix pointer alignment
Daan De Meyer [Sun, 29 Mar 2020 19:42:50 +0000 (21:42 +0200)] 
sd-bus: Fix pointer alignment

4 years agosd-bus: Add sd_bus_slot_get_current_* docs
Daan De Meyer [Sat, 28 Mar 2020 22:19:58 +0000 (23:19 +0100)] 
sd-bus: Add sd_bus_slot_get_current_* docs

4 years agoREADME.md: add repology badge
Topi Miettinen [Sat, 28 Mar 2020 11:29:35 +0000 (13:29 +0200)] 
README.md: add repology badge

Show downstream usage for various versions of systemd.

4 years agobasic: Fix capability_ambient_set_apply for kernels < 4.3
Kevin Kuehler [Fri, 27 Mar 2020 22:57:02 +0000 (15:57 -0700)] 
basic: Fix capability_ambient_set_apply for kernels < 4.3

https://github.com/systemd/systemd/pull/14133 made
capability_ambient_set_apply() acquire capabilities that were explicitly
asked for and drop all others. This change means the function is called
even with an empty capability set, opening up a code path for users
without ambient capabilities to call this function. This function will
error with EINVAL out on kernels < 4.3 because PR_CAP_AMBIENT is not
understood. This turns capability_ambient_set_apply() into a noop for
kernels < 4.3

Fixes https://github.com/systemd/systemd/issues/15225

4 years agoMerge pull request #15233 from msekletar/device-dbus
Zbigniew Jędrzejewski-Szmek [Sun, 29 Mar 2020 18:52:31 +0000 (20:52 +0200)] 
Merge pull request #15233 from msekletar/device-dbus

device: make sure we don't generate bogus PropertiesChanged signals

4 years agodevice: don't emit PropetiesChanged needlessly 15233/head
Michal Sekletár [Thu, 26 Mar 2020 12:35:11 +0000 (13:35 +0100)] 
device: don't emit PropetiesChanged needlessly

Functions called from device_setup_unit() already make sure that unit is
enqueued in case it is a new unit or properties exported on the bus have
changed.

This should prevent unnecessary DBus wakeups and associated DBus traffic
when device_setup_unit() was called while reparsing /proc/self/mountinfo
due to the mountinfo notifications. Note that we parse
/proc/self/mountinfo quite often on the busy systems (e.g. k8s container
hosts) but majority of the time mounts didn't change, only some mount
got added. Thus we don't need to generate PropertiesChanged for devices
associated with the mounts that didn't change.

Thanks to Renaud Métrich <rmetrich@redhat.com> for debugging the
problem and providing draft version of the patch.

4 years agodevice: make sure we emit PropertiesChanged signal once we set sysfs
Michal Sekletár [Thu, 26 Mar 2020 12:34:20 +0000 (13:34 +0100)] 
device: make sure we emit PropertiesChanged signal once we set sysfs

4 years agonss-systemd: use _cleanup_ for pthread_mutex_{lock,unlock} 15251/head
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 12:26:25 +0000 (13:26 +0100)] 
nss-systemd: use _cleanup_ for pthread_mutex_{lock,unlock}

v2: separate the declaration from the assignment to appease clang.

4 years agobasic: add _cleanup_ wrappers for pthread_mutex_{lock,unlock}
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 12:24:44 +0000 (13:24 +0100)] 
basic: add _cleanup_ wrappers for pthread_mutex_{lock,unlock}

I put the helper functions in a separate header file, because they don't fit
anywhere else. pthread_mutex_{lock,unlock} is used in two places: nss-systemd
and hashmap. I don't indent to convert hashmap to use the helpers, because
there it'd make the code more complicated. Is it worth to create a new header
file even if the only use is in nss-systemd.c? I think yes, because it feels
clean and also I think it's likely that pthread_mutex_{lock,unlock} will be
used in other places later.

4 years agonss-systemd: add missing jump to unlock mutex
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 12:03:06 +0000 (13:03 +0100)] 
nss-systemd: add missing jump to unlock mutex

CID#1412415.

4 years agotest-strv: add missing oom check
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 11:46:52 +0000 (12:46 +0100)] 
test-strv: add missing oom check

CID#1420259.

4 years agotest: print test of name in output 14338/head
Zbigniew Jędrzejewski-Szmek [Wed, 25 Mar 2020 12:15:37 +0000 (13:15 +0100)] 
test: print test of name in output

4 years agomeson: use find_program() for add-git-hook.sh
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 08:30:51 +0000 (09:30 +0100)] 
meson: use find_program() for add-git-hook.sh

On azure systemd.systemd ci, the build would fail with:
meson.build:53:0: ERROR: Program or command '/home/appuser/fuzzer/tools/add-git-hook.sh' not found or not executable

We use find_program() for all helpers, so let's do it for this one too.
This should solve the issue, whatever it exactly is.

4 years agotest: run unittests with newlines in /proc/cmdline
Zbigniew Jędrzejewski-Szmek [Fri, 13 Dec 2019 13:20:35 +0000 (14:20 +0100)] 
test: run unittests with newlines in /proc/cmdline

This should help catch this class of errors.

4 years agotest: stop caching loopdev
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 19:17:11 +0000 (20:17 +0100)] 
test: stop caching loopdev

It is more trouble than it is worth. The setup is of a loopback device
is very quick, so it's better to always create it when needed and
immediately drop afterwards.

4 years agotest: perform partial cleanup after each test is run
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 18:09:35 +0000 (19:09 +0100)] 
test: perform partial cleanup after each test is run

This causes the unprivileged-nspawn-root directory to be removed
after running one test. The advantage is that we reduce the maximum
disk-space use quite a bit (47*400 MB → about 18GB).

4 years agotest: simplify the Makefiles
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 17:31:10 +0000 (18:31 +0100)] 
test: simplify the Makefiles

has-overflow was a temporary hack that was removed in
844da987ef8b8c98f837d3328eeb3ed481f43835 (Oct. 2016). All the makefiles
can be the same, and all the targets can be handled identically.

4 years agotest: run tests directly from the loopback device
Zbigniew Jędrzejewski-Szmek [Fri, 13 Dec 2019 13:21:31 +0000 (14:21 +0100)] 
test: run tests directly from the loopback device

Before, we'd copy the test tree into nspawn-root, and run the tests from there.
This is OK, and doesn't actually take much extra time. But it uses quite a lot
of extra disk space. So let's make things a bit more efficient by running
directly from the image file.

We still run the unprivileged nspawn tests from a copy. Once the kernel
implements fs shift, we can do away with that too.

4 years agotest: wipe journal files after test
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 16:46:04 +0000 (17:46 +0100)] 
test: wipe journal files after test

Otherwise they accumulate and create noise.

4 years agotest: echo a message when the tests fails
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 16:16:30 +0000 (17:16 +0100)] 
test: echo a message when the tests fails

Sometimes it is not clear from the preceding output that there was a
failure.

4 years agotest/TEST-01: allow running w/o -Dinstall-tests=true
Zbigniew Jędrzejewski-Szmek [Tue, 17 Dec 2019 11:52:35 +0000 (12:52 +0100)] 
test/TEST-01: allow running w/o -Dinstall-tests=true

This is useful for sanitizer builds under CI, see
https://github.com/systemd/systemd-centos-ci/pull/202#issuecomment-566476592.

4 years agotest: rework how images are created
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2019 08:37:19 +0000 (09:37 +0100)] 
test: rework how images are created

Before, we'd create a separate image for each test, in
/var/tmp/systemd-test.XXXXX/rootdisk.img. Most of the images
where very similar, except that each one had some unit files installed
specifically for the test. The installation of those custom unit files
was removed in previous commits (all the unit files are always installed).

The new approach is to only create as few distinct images as possible.
We have:
default.img: the "normal" image suitable for almost all the tests
basic.img: the same as default image but doesn't mask any services
cryptsetup.img: p2 is used for encrypted /var
badid.img: /etc/machine-id is overwritten with stuff
selinux.img: with selinux added for fun and fun
and a few others:

ls -l build/test/*img
lrwxrwxrwx 1 root root 38 Mar 21 21:23 build/test/badid.img -> /var/tmp/systemd-test.PJFFeo/badid.img
lrwxrwxrwx 1 root root 38 Mar 21 21:17 build/test/basic.img -> /var/tmp/systemd-test.na0xOI/basic.img
lrwxrwxrwx 1 root root 43 Mar 21 21:18 build/test/cryptsetup.img -> /var/tmp/systemd-test.Tzjv06/cryptsetup.img
lrwxrwxrwx 1 root root 40 Mar 21 21:19 build/test/default.img -> /var/tmp/systemd-test.EscAsS/default.img
lrwxrwxrwx 1 root root 39 Mar 21 21:22 build/test/nspawn.img -> /var/tmp/systemd-test.HSebKo/nspawn.img
lrwxrwxrwx 1 root root 40 Mar 21 21:20 build/test/selinux.img -> /var/tmp/systemd-test.daBjbx/selinux.img
lrwxrwxrwx 1 root root 39 Mar 21 21:21 build/test/test08.img -> /var/tmp/systemd-test.OgnN8Z/test08.img

I considered trying to use the same image everywhere. It would probably be
possible, but it would be very brittle. By using separate images where it is
necessary we keep various orthogonal modifications independent.

The way that images are cached is complicated by the fact that we still
want to keep them in /var/tmp. Thus, an image is created on first use and
linked to from build/test/ so it can be found by other tests.

Tests cannot be run in parallel. I think that is an acceptable limitation.
Creation of the images was probably taking more resources then the actual
tests, so we should be better off anyway.

4 years agosemaphoreci: trivial cleanup
Zbigniew Jędrzejewski-Szmek [Tue, 17 Dec 2019 09:34:31 +0000 (10:34 +0100)] 
semaphoreci: trivial cleanup

4 years agotest/TEST-28: avoid race in handling of /testok
Zbigniew Jędrzejewski-Szmek [Tue, 17 Dec 2019 09:35:37 +0000 (10:35 +0100)] 
test/TEST-28: avoid race in handling of /testok

4 years agotest: make sure to reset state before starting integration tests
Zbigniew Jędrzejewski-Szmek [Fri, 13 Dec 2019 11:34:41 +0000 (12:34 +0100)] 
test: make sure to reset state before starting integration tests

4 years agotest: mount root rw and drop /etc/fstab
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2019 14:17:30 +0000 (15:17 +0100)] 
test: mount root rw and drop /etc/fstab

We had an fstab for the sole purpose of remounting "/" rw. Mounting root ro
is a pointless excercise in obsolete approaches. More importantly, the nspawn
image is now the same as the qemu one.

4 years agotest: drop cargo-cult line
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2019 07:35:20 +0000 (08:35 +0100)] 
test: drop cargo-cult line

p2 is only used in the cryptsetup test...

4 years agotest: improve reporting a bit
Zbigniew Jędrzejewski-Szmek [Tue, 10 Dec 2019 16:33:58 +0000 (17:33 +0100)] 
test: improve reporting a bit

4 years agotest: de-duplicate test_setup() functions
Zbigniew Jędrzejewski-Szmek [Tue, 10 Dec 2019 15:40:31 +0000 (16:40 +0100)] 
test: de-duplicate test_setup() functions

Now we will run setup_nspawn_root() in some case where do don't need to.

4 years agotest: move TEST-47-* to static files
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 18:57:54 +0000 (19:57 +0100)] 
test: move TEST-47-* to static files

4 years agotest: move TEST-46-HOMED to static files
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 18:52:41 +0000 (19:52 +0100)] 
test: move TEST-46-HOMED to static files

4 years agotest: convert TEST-45 to a normal meson test
Zbigniew Jędrzejewski-Szmek [Fri, 20 Mar 2020 19:22:42 +0000 (20:22 +0100)] 
test: convert TEST-45 to a normal meson test

On my laptop, it now takes 0.23 s. We don't need the overhead of creating
an image and spawning a machine to mangle a file in /tmp.