]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agologind: use pid_is_valid() where appropriate 6975/head
Alan Jenkins [Tue, 3 Oct 2017 11:26:02 +0000 (12:26 +0100)] 
logind: use pid_is_valid() where appropriate

These two sites _do_ match the definition of pid_is_valid(); they don't
provide any special handling for the invalid PID value 0.  (They're used
by dbus methods, so the PID value 0 is handled with reference to the dbus
client creds, outside of these functions).

6 years agosystemctl: use pid_is_valid() where appropriate
Alan Jenkins [Tue, 3 Oct 2017 11:13:06 +0000 (12:13 +0100)] 
systemctl: use pid_is_valid() where appropriate

This was the one valid site in commit
ee043777be58251e7441b4f04594e9e3792d7fb2.

The second part of this hunk, avoiding using `%m`
when we didn't actually have `errno` set, seems
like a nice enough cleanup to be worthwhile on
it's own.

Also use PID_FMT to improve the error message we print
(pid_t is signed).

6 years agoRevert "tree-wide: use pid_is_valid() at more places"
Alan Jenkins [Tue, 3 Oct 2017 11:05:24 +0000 (12:05 +0100)] 
Revert "tree-wide: use pid_is_valid() at more places"

This reverts commit ee043777be58251e7441b4f04594e9e3792d7fb2.

It broke almost everywhere it touched.  The places that
handn't been converted, were mostly followed by special
handling for the invalid PID `0`.  That explains why they
tested for `pid < 0` instead of `pid <= 0`.

I think that one was the first commit I reviewed, heh.

6 years agoMerge pull request #6941 from andir/use-in_set
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 13:08:10 +0000 (15:08 +0200)] 
Merge pull request #6941 from andir/use-in_set

use IN_SET where possible

6 years agoMinor line wrapping adjustment 6941/head
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 12:52:12 +0000 (14:52 +0200)] 
Minor line wrapping adjustment

6 years agoMerge pull request #6932 from poettering/notify-pam
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 12:40:10 +0000 (14:40 +0200)] 
Merge pull request #6932 from poettering/notify-pam

fix handling of cgroup empty events for Type=notify services

6 years agotree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
Andreas Rammhold [Fri, 29 Sep 2017 07:58:22 +0000 (09:58 +0200)] 
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`

The included cocci was used to generate the changes.

Thanks to @flo-wer for pointing this case out.

6 years agotree-wide: use IN_SET where possible
Andreas Rammhold [Thu, 28 Sep 2017 22:37:23 +0000 (00:37 +0200)] 
tree-wide: use IN_SET where possible

In addition to the changes from #6933 this handles cases that could be
matched with the included cocci file.

6 years agoman: document that PAMName= and NotifyAccess=all don't mix well. 6932/head
Lennart Poettering [Fri, 29 Sep 2017 14:56:51 +0000 (16:56 +0200)] 
man: document that PAMName= and NotifyAccess=all don't mix well.

See: #6045

6 years agoservice: accept the fact that the three xyz_good() functions return ints
Lennart Poettering [Fri, 29 Sep 2017 14:41:34 +0000 (16:41 +0200)] 
service: accept the fact that the three xyz_good() functions return ints

Currently, all three of cgroup_good(), main_pid_good(),
control_pid_good() all return an "int" (two of them propagate errors).
It's a good thing to keep the three functions similar, so let's leave it
at that, but then let's clean up the invocation of the three functions
so that they always clearly acknowledge that the return value is not a
bool, but potentially negative.

6 years agoservice: drop _pure_ decorator on static function
Lennart Poettering [Fri, 29 Sep 2017 14:39:46 +0000 (16:39 +0200)] 
service: drop _pure_ decorator on static function

The compiler should be good enough to figure this out on its own if this
is a static function, and it makes control_pid_good() an outlier anyway,
and decorators like this tend to bitrot. Hence, to keep things simple
and automatic, let's just drop the decorator.

6 years agoservice: a cgroup empty notification isn't reason enough to go down
Lennart Poettering [Wed, 27 Sep 2017 17:56:57 +0000 (19:56 +0200)] 
service: a cgroup empty notification isn't reason enough to go down

The processes associated with a service are not just the ones in its
cgroup, but also the control and main processes, which might possibly
live outside of it, for example if they transitioned into their own
cgroups because they registered a PAM session of their own. Hence, if we
get a cgroup empty notification always check if the main PID is still
around before taking action too eagerly.

Fixes: #6045
6 years agoservice: add explanatory comments to control_pid_good() and cgroup_good()
Lennart Poettering [Mon, 2 Oct 2017 10:57:03 +0000 (12:57 +0200)] 
service: add explanatory comments to control_pid_good() and cgroup_good()

Let's add a similar comment to each as we already have for
main_pid_good(), emphasizing that these functions are supposed to be
have very similar.

6 years agoservice: fix main_pid_good() comment
Lennart Poettering [Wed, 27 Sep 2017 17:56:36 +0000 (19:56 +0200)] 
service: fix main_pid_good() comment

We don't actually return -1, don't claim that.

6 years agocatalog: update Polish translation (#6947)
Piotr Drąg [Sat, 30 Sep 2017 12:39:29 +0000 (14:39 +0200)] 
catalog: update Polish translation (#6947)

6 years agoMerge pull request #6942 from keszybz/remove-sys
Lennart Poettering [Fri, 29 Sep 2017 13:48:23 +0000 (15:48 +0200)] 
Merge pull request #6942 from keszybz/remove-sys

Remove sys if necessary

6 years agosys-script: remove output directory if it exists 6942/head
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2017 10:28:25 +0000 (12:28 +0200)] 
sys-script: remove output directory if it exists

meson will occasionally call us even though the output directory
exists. Let's just nuke and recreate in that case.

6 years agocreate-sys-script: adapt to separate build dir, modernize, add more checks
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2017 10:27:21 +0000 (12:27 +0200)] 
create-sys-script: adapt to separate build dir, modernize, add more checks

The script wasn't apparently used since the switch to meson, because
it required the sys subdirectory to be present in the same subdirectory
where the output script is located.

Let's use f-strings to make the whole thing more readable. Add some
extra checks.

6 years agoman: move non-target units together (#6934)
John Lin [Thu, 28 Sep 2017 17:56:50 +0000 (01:56 +0800)] 
man: move non-target units together (#6934)

6 years agomeson: move library version defines to the top (#6939)
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2017 17:24:16 +0000 (19:24 +0200)] 
meson: move library version defines to the top (#6939)

6 years agoMerge pull request #6936 from poettering/news-235
Lennart Poettering [Thu, 28 Sep 2017 17:22:55 +0000 (19:22 +0200)] 
Merge pull request #6936 from poettering/news-235

News 235

6 years agoMerge pull request #6933 from yuwata/use_in_set
Lennart Poettering [Thu, 28 Sep 2017 17:22:09 +0000 (19:22 +0200)] 
Merge pull request #6933 from yuwata/use_in_set

use IN_SET macro

6 years agomeson: bump release to 235 6936/head
Lennart Poettering [Thu, 28 Sep 2017 09:29:52 +0000 (11:29 +0200)] 
meson: bump release to 235

6 years agoadd some more things to TODO
Lennart Poettering [Thu, 28 Sep 2017 09:26:11 +0000 (11:26 +0200)] 
add some more things to TODO

6 years agoprepare NEWS for 235
Lennart Poettering [Thu, 28 Sep 2017 09:26:02 +0000 (11:26 +0200)] 
prepare NEWS for 235

6 years agolibsystemd: use IN_SET macro 6933/head
Yu Watanabe [Thu, 28 Sep 2017 08:17:04 +0000 (17:17 +0900)] 
libsystemd: use IN_SET macro

6 years agoMerge pull request #6924 from andir/vrf-dhcpv4
Lennart Poettering [Thu, 28 Sep 2017 07:46:03 +0000 (09:46 +0200)] 
Merge pull request #6924 from andir/vrf-dhcpv4

networkd: use VRFs routing table for DHCP routes

6 years agoudev-rules: all values can contain escaped double quotes now (#6890)
Franck Bui [Thu, 28 Sep 2017 06:53:46 +0000 (08:53 +0200)] 
udev-rules: all values can contain escaped double quotes now (#6890)

This is primarly useful to support escaped double quotes in PROGRAM or
IMPORT{program} directives.

The only possibilty before this patch was to use an external shell script but
this seems too cumbersome for trivial logics such as

 PROGRAM=="/bin/sh -c 'FOO=\"%s{model}\"; echo ${FOO:0:4}'"

or any similar shell constructs that needs to deals with patterns including
whitespaces.

As it's the case for single quote and for directives running a program, words
within escaped double quotes will be considered as a single argument.

Fixes: #6835
6 years agoMerge pull request #6928 from poettering/cgroup-empty-race
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2017 06:48:21 +0000 (08:48 +0200)] 
Merge pull request #6928 from poettering/cgroup-empty-race

rework cgroup empty notification handling (i.e. a fix for #6608)

6 years agonetworkd: use assert_not_reached()
Yu Watanabe [Thu, 28 Sep 2017 06:38:50 +0000 (15:38 +0900)] 
networkd: use assert_not_reached()

6 years agonetworkd: use IN_SET macro
Yu Watanabe [Thu, 28 Sep 2017 06:37:38 +0000 (15:37 +0900)] 
networkd: use IN_SET macro

6 years agoman/systemd.network: Updated documentation about VRF traffic redirection 6924/head
Andreas Rammhold [Tue, 26 Sep 2017 23:54:20 +0000 (01:54 +0200)] 
man/systemd.network: Updated documentation about VRF traffic redirection

Starting with kernel version 4.8 the kernel has a single `l3mdev` rule
that handles this. This rule will be created when the first VRF device
is added.

6 years agoman/systemd.network: Added documentation about the DHCP.RouteTable behaviour with...
Andreas Rammhold [Tue, 26 Sep 2017 23:52:07 +0000 (01:52 +0200)] 
man/systemd.network: Added documentation about the DHCP.RouteTable behaviour with VRFs

6 years agonetworkd: use VRFs routing table for DHCP routes
Andreas Rammhold [Thu, 7 Sep 2017 09:08:39 +0000 (11:08 +0200)] 
networkd: use VRFs routing table for DHCP routes

When an interface has been enslaved to a VRF the received routes should
be added to the VRFs RT instead of the main table.

This change modifies the default behaviour of routes in the case where a
network belongs to an VRF.  When the user does not configure a
`DHCP.RouteTable` in a `systemd.network` file and the interface belongs
to a VRF, the VRFs routing table is used instead of RT_TABLE_MAIN.

When the user has configured a custom routing table for DHCP the VRFs
table is ignored and the users preference takes precedence.

6 years agoMerge pull request #6922 from poettering/symlink-sockets
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 17:37:25 +0000 (19:37 +0200)] 
Merge pull request #6922 from poettering/symlink-sockets

Fixes for Symlinks= handling in socket units

6 years agocore: log unit failure with type-specific result code 6928/head
Lennart Poettering [Tue, 26 Sep 2017 21:35:58 +0000 (23:35 +0200)] 
core: log unit failure with type-specific result code

This slightly changes how we log about failures. Previously,
service_enter_dead() would log that a service unit failed along with its
result code, and unit_notify() would do this again but without the
result code. For other unit types only the latter would take effect.

This cleans this up: we keep the message in unit_notify() only for debug
purposes, and add type-specific log lines to all our unit types that can
fail, and always place them before unit_notify() is invoked.

Or in other words: the duplicate log message for service units is
removed, and all other unit types get a more useful line with the
precise result code.

6 years agocore: free_and_strdup() FTW!
Lennart Poettering [Tue, 26 Sep 2017 20:49:23 +0000 (22:49 +0200)] 
core: free_and_strdup() FTW!

6 years agocgroup: IN_SET() FTW!
Lennart Poettering [Tue, 26 Sep 2017 20:49:09 +0000 (22:49 +0200)] 
cgroup: IN_SET() FTW!

6 years agocgroup: after determining that a cgroup is empty, asynchronously dispatch this
Lennart Poettering [Tue, 26 Sep 2017 20:43:08 +0000 (22:43 +0200)] 
cgroup: after determining that a cgroup is empty, asynchronously dispatch this

This makes sure that if we learn via inotify or another event source
that a cgroup is empty, and we checked that this is indeed the case (as
we might get spurious notifications through inotify, as the inotify
logic through the "cgroups.event" is pretty unspecific and might be
trigger for a variety of reasons), then we'll enqueue a defer event for
it, at a priority lower than SIGCHLD handling, so that we know for sure
that if there's waitid() data for a process we used it before
considering the cgroup empty notification.

Fixes: #6608
6 years agocore: rename cgroup_queue → cgroup_realize_queue
Lennart Poettering [Tue, 26 Sep 2017 20:15:02 +0000 (22:15 +0200)] 
core: rename cgroup_queue → cgroup_realize_queue

We are about to add second cgroup-related queue, called
"cgroup_empty_queue", hence let's rename "cgroup_queue" to
"cgroup_realize_queue" (as that is its purpose) to minimize confusion
about the two queues.

Just a rename, no functional changes.

6 years agounit: remove unused fields from Unit structure
Lennart Poettering [Tue, 26 Sep 2017 18:24:30 +0000 (20:24 +0200)] 
unit: remove unused fields from Unit structure

6 years agonetwork: change log level when sd_rtnl_message_get_family() returns invalid family...
Yu Watanabe [Wed, 27 Sep 2017 15:55:13 +0000 (00:55 +0900)] 
network: change log level when sd_rtnl_message_get_family() returns invalid family (#6923)

From bce67bbee359eec19e6778619b6651100a1c1477, systemd-networkd always shows
```
rtnl: received address with invalid family type 32, ignoring.
```
during boot-up. In the code, there are log_warning() and log_debug() for the
same situation, and the log_debug() is never called. So, let's lower the
log level and remove never called function.

6 years agocore/cgroup: add a helper macro for a common pattern (#6926)
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 15:54:06 +0000 (17:54 +0200)] 
core/cgroup: add a helper macro for a common pattern (#6926)

6 years agosocket: if RemoveOnStop= is turned on for a socket, try to unlink() pre-existing... 6922/head
Lennart Poettering [Wed, 27 Sep 2017 15:48:28 +0000 (17:48 +0200)] 
socket: if RemoveOnStop= is turned on for a socket, try to unlink() pre-existing symlinks

Normally, Symlinks= failing is not considered fatal nor destructive.
Let's slightly alter behaviour here if RemoveOnStop= is turned on. In
that case the use in a way opted for destructive behaviour and we do
unlink all sockets and symlinks when the socket unit goes down. And that
means we might as well unlink any pre-existing if this mode is selected.

Yeah, it's a bit of a stretch to do this, but @OhNoMoreGit is right: if
RemoveOnStop= is on we are destructive regarding any pre-existing
symlinks on stop, and it would be quite weird if we wouldn't be on
start.

6 years agoman: document that inability to execute Symlinks= is not fatal
Lennart Poettering [Tue, 26 Sep 2017 16:36:41 +0000 (18:36 +0200)] 
man: document that inability to execute Symlinks= is not fatal

Fixes: #6920
6 years agosocket: create leading directories for socket symlinks
Lennart Poettering [Tue, 26 Sep 2017 16:27:56 +0000 (18:27 +0200)] 
socket: create leading directories for socket symlinks

It really doesn't hurt creating prefix directories if necessary, as we
tend to do that for other file nodes we create, too.

Fixes: #6920
6 years agosocket: make sure we warn loudly about symlinks we can't create
Lennart Poettering [Tue, 26 Sep 2017 16:27:09 +0000 (18:27 +0200)] 
socket: make sure we warn loudly about symlinks we can't create

Note that this change does not make symlink creation failing fatal. I am
not entirely sure about whether it should be, but I am leaning towards
not making it fatal for two reasons: symlinks like this tend to be a
compatibility feature, and hence unlikely to be essential for operation,
in a way this breaks compatibility, and while doing that is not off the
table, we should probably avoid it if we are not entirely sure it's a
good thing.

Note that this also changes plain symlink() to symlink_idempotent() so
that existing symlinks with the right destination are nothing we log
about.

Fixes: #6920
6 years agofs-util: propagate EEXIST error in symlink_idempotent() as EEXIST
Lennart Poettering [Tue, 26 Sep 2017 16:26:20 +0000 (18:26 +0200)] 
fs-util: propagate EEXIST error in symlink_idempotent() as EEXIST

We really shouldn't silently translate the error code here for no
reason.

6 years agoMerge pull request #6919 from poettering/ebpf-followup
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 09:23:02 +0000 (11:23 +0200)] 
Merge pull request #6919 from poettering/ebpf-followup

Some minor follow-ups for the ebpf/cgroup PR

6 years agoMerge pull request #6915 from poettering/log-execute
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 09:16:24 +0000 (11:16 +0200)] 
Merge pull request #6915 from poettering/log-execute

make execute.c logging a bit less special

6 years agoudev: proc_cmdline_get_key() FTW! (#6925)
Lennart Poettering [Wed, 27 Sep 2017 07:25:25 +0000 (09:25 +0200)] 
udev: proc_cmdline_get_key() FTW! (#6925)

Let's use proc_cmdline_get_key() instead of some strstr() logic to find
a kernel command line key. Using strstr() gets confused by similarly
named keys, and we should reuse our own code as much as we can anyway...

Fixes: #6330
6 years agocatalog: split out the one German language entry we have in systemd.catalog into... 6919/head
Lennart Poettering [Tue, 26 Sep 2017 14:46:17 +0000 (16:46 +0200)] 
catalog: split out the one German language entry we have in systemd.catalog into its own file

All other languages have their own file, let's make sure German does
too.

6 years agocatalog: add two recent message ID additions to catalog
Lennart Poettering [Tue, 26 Sep 2017 14:42:02 +0000 (16:42 +0200)] 
catalog: add two recent message ID additions to catalog

Just brief texts for now, so that we have something

(And in the long rung we should beef all this up, and add a test that
every ID listed in sd-messages.h is accompanied by a matching catalog
entry)

6 years agorun: also show IP traffic accounting data on "systemd-run --wait"
Lennart Poettering [Tue, 26 Sep 2017 14:33:03 +0000 (16:33 +0200)] 
run: also show IP traffic accounting data on "systemd-run --wait"

If we collect we should show it.

6 years agocore: improve dbus-cgroup error message
Lennart Poettering [Tue, 26 Sep 2017 14:18:50 +0000 (16:18 +0200)] 
core: improve dbus-cgroup error message

As suggested by @keszybz in the review of #6764

6 years agoMerge pull request #6912 from poettering/mount-kill-control
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 20:38:02 +0000 (22:38 +0200)] 
Merge pull request #6912 from poettering/mount-kill-control

mount unit state engine fixes

6 years agoRevert "units: don't kill the emergency shell when sysinit.target is triggered (...
Alan Jenkins [Tue, 26 Sep 2017 17:47:50 +0000 (18:47 +0100)] 
Revert "units: don't kill the emergency shell when sysinit.target is triggered (#6765)" (#6904)

This reverts commit f1e24a259ca182b6cd8a723a56da43435ce48aac.  Oops.

# systemctl emergency
Failed to start emergency.target: Transaction order is cyclic. See syste...
See system logs and 'systemctl status emergency.target' for details.
# systemctl status emergency.target
● emergency.target - Emergency Mode
   Loaded: loaded (/usr/lib/systemd/system/emergency.target; static; vendor preset: disabled)
   Active: inactive (dead) since Mon 2017-09-25 10:43:02 BST; 2h 42min ago
     Docs: man:systemd.special(7)

systemd[1]: sysinit.target: Found dependency on sysinit.target/stop
sysinit.target: Unable to break cycle starting with sysinit.target/stop
network.target: Found ordering cycle on wpa_supplicant.service/stop
network.target: Found dependency on sysinit.target/stop
network.target: Found dependency on emergency.target/start
network.target: Found dependency on emergency.service/start
network.target: Found dependency on serial-getty@ttyS0.service/stop
network.target: Found dependency on systemd-user-sessions.service/stop
network.target: Found dependency on network.target/stop
network.target: Unable to break cycle starting with network.target/stop

IMO #6509 is ugly enough that we should aim to answer it.  But it could
take some time to investigate, so let's re-open the issue as a first step.

6 years agoMerge pull request #6902 from keszybz/two-property-printing-fixes
Lennart Poettering [Tue, 26 Sep 2017 16:09:23 +0000 (18:09 +0200)] 
Merge pull request #6902 from keszybz/two-property-printing-fixes

Two property printing fixes

6 years agoupdate TODO 6915/head
Lennart Poettering [Tue, 26 Sep 2017 16:00:38 +0000 (18:00 +0200)] 
update TODO

6 years agoexecute: let's close glibc syslog channels too
Lennart Poettering [Tue, 26 Sep 2017 15:52:25 +0000 (17:52 +0200)] 
execute: let's close glibc syslog channels too

Just in case something opened them, let's make sure glibc invalidates
them too.

Thankfully so far no library opened log channels behind our back, at
least as far as I know, hence this is actually a NOP, but let's better
be safe than sorry.

6 years agoexecute: normalize logging in execute.c
Lennart Poettering [Tue, 26 Sep 2017 15:47:27 +0000 (17:47 +0200)] 
execute: normalize logging in execute.c

Now that logging can implicitly reopen the log streams when needed we
can log errors without any special magic, hence let's normalize things,
and log the same way we do everywhere else.

6 years agoexecute: drop explicit log_open()/log_close() now that it is unnecessary
Lennart Poettering [Tue, 26 Sep 2017 15:41:53 +0000 (17:41 +0200)] 
execute: drop explicit log_open()/log_close() now that it is unnecessary

6 years agoexecute: make use of the new logging mode in execute.c
Lennart Poettering [Tue, 26 Sep 2017 15:45:32 +0000 (17:45 +0200)] 
execute: make use of the new logging mode in execute.c

6 years agolog: add a mode where we open the log fds for every single log message
Lennart Poettering [Tue, 26 Sep 2017 15:45:09 +0000 (17:45 +0200)] 
log: add a mode where we open the log fds for every single log message

This we can then make use in execute.c to make error logging a bit less
special when preparing for process execution, as we can still log but
don't have any fds open continously.

6 years agolog: let's make use of the fact that our functions return the negative error code...
Lennart Poettering [Mon, 25 Sep 2017 18:26:47 +0000 (20:26 +0200)] 
log: let's make use of the fact that our functions return the negative error code for log_oom() too

6 years agoexecute: downgrade a log message ERR → WARNING, since we proceed ignoring its result
Lennart Poettering [Tue, 26 Sep 2017 15:42:17 +0000 (17:42 +0200)] 
execute: downgrade a log message ERR → WARNING, since we proceed ignoring its result

6 years agoexecute: rework logging in setup_keyring() to include unit info
Lennart Poettering [Tue, 26 Sep 2017 15:42:57 +0000 (17:42 +0200)] 
execute: rework logging in setup_keyring() to include unit info

Let's use log_unit_error() instead of log_error() everywhere (and
friends).

6 years agoswap: introduce SWAP_STATE_WITH_PROCESS() similar to MOUNT_STATE_WITH_PROCESS() 6912/head
Lennart Poettering [Mon, 25 Sep 2017 17:57:52 +0000 (19:57 +0200)] 
swap: introduce SWAP_STATE_WITH_PROCESS() similar to MOUNT_STATE_WITH_PROCESS()

6 years agoswap: adjust swap.c in a similar way to what we just did to mount.c
Lennart Poettering [Mon, 25 Sep 2017 17:53:19 +0000 (19:53 +0200)] 
swap: adjust swap.c in a similar way to what we just did to mount.c

Also drop the redundant states and make all similar changes too.
Thankfully the swap.c state engine is much simpler than mount.c's, hence
this should be easier to digest.

6 years agomount: rename mount_state_active() → MOUNT_STATE_WITH_PROCESS()
Lennart Poettering [Mon, 25 Sep 2017 17:25:50 +0000 (19:25 +0200)] 
mount: rename mount_state_active() → MOUNT_STATE_WITH_PROCESS()

The function returns true for all states that have a control process
running, and each time we call it that's what we want to know, hence
let's rename it accordingly. Moreover, the more generic unit states have
an ACTIVE state, and it is defined quite differently from the set of
states this function returns true for, hence let's avoid confusion and
not reuse the word "ACTIVE" here in a different context.

Finally, let's uppercase this, since in most ways it's pretty much
identical to a macro

6 years agomount: rework mount state engine
Lennart Poettering [Mon, 25 Sep 2017 17:13:37 +0000 (19:13 +0200)] 
mount: rework mount state engine

This changes the mount unit state engine in the following ways:

1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed.
   They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and
   MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been
   the same as well: the unit is stopped. Hence, let's simplify things a
   bit, and merge them. Note that we keep
   MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a
   different outcome: the unit remains started.

2. mount_enter_signal() will now honour the SendSIGKILL= option of the
   mount unit if it was set. This was previously done already when we
   entered the signal states through a timeout, and was simply missing
   here.

3. A new helper function mount_enter_dead_or_mounted() is added that
   places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED,
   depending on what the kernel thinks about the mount's state. This
   function is called at various places now, wherever we finished an
   operation, and want to make sure our own state reflects again what
   the kernel thinks. Previously we had very similar code in a number of
   places and in other places didn't recheck the kernel state. Let's do
   that with the same logic and function at all relevant places now.

4. Rework mount_stop(): never forget about running control processes.
   Instead: when we have a start (i.e. a /bin/mount) process running,
   and are asked to stop, then enter the kill states for it, so that it
   gets cleaned up. This fixes #6048. Moreover, when we have a reload
   process running convert the possible states into the relevant
   unmounting states, so that we can properly execute the requested
   operation.

Fixes #6048

6 years agomount: clean up reload_result management a bit
Lennart Poettering [Mon, 25 Sep 2017 16:56:19 +0000 (18:56 +0200)] 
mount: clean up reload_result management a bit

Let's only collect the first failure in the load result, and let's clear
it explicitly when we are about to enter a new reload operation. This
makes it more alike the handling of the main result value (which also
only stores the first failure), and also the handling of service.c's
reload state.

6 years agoservice: rework service_kill_control_processes()
Lennart Poettering [Mon, 25 Sep 2017 15:17:30 +0000 (17:17 +0200)] 
service: rework service_kill_control_processes()

Let's make sure we explicitly also kill any control process we know of,
given that it might have moved outside of our control group.

6 years agoset: add new helper set_make() which is like set_new() + multiple set_put() in vararg
Lennart Poettering [Mon, 25 Sep 2017 15:15:59 +0000 (17:15 +0200)] 
set: add new helper set_make() which is like set_new() + multiple set_put() in vararg

6 years agotest-cpu-set-util.c: fix typo in comment (#6916)
Jan Synacek [Tue, 26 Sep 2017 14:07:34 +0000 (16:07 +0200)] 
test-cpu-set-util.c: fix typo in comment (#6916)

6 years agobasic/log: fix return value from log_struct_iovec_internal()
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 14:04:33 +0000 (16:04 +0200)] 
basic/log: fix return value from log_struct_iovec_internal()

This returned value so far wasn't used anywhere, so there's no change
in behaviour.

6 years agoMerge pull request #6917 from keszybz/restore-some-tests
Lennart Poettering [Tue, 26 Sep 2017 14:00:28 +0000 (16:00 +0200)] 
Merge pull request #6917 from keszybz/restore-some-tests

Restore some tests

6 years agotest-cpu-set-util.c: fix typo in comment (#6916)
Jan Synacek [Tue, 26 Sep 2017 11:50:31 +0000 (13:50 +0200)] 
test-cpu-set-util.c: fix typo in comment (#6916)

6 years agomeson: hook up hwdb-test.sh again 6917/head
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 11:44:04 +0000 (13:44 +0200)] 
meson: hook up hwdb-test.sh again

The motivation for the ./systemd-hwdb is the same as in the grandparent
for systemd-sysv-generator.

6 years agomeson: hook up udev-test.pl again
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 11:39:43 +0000 (13:39 +0200)] 
meson: hook up udev-test.pl again

Seems it was dropped along with the automake rules in
72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.

6 years agosysv-generator-test: do not query $builddir
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 11:34:55 +0000 (13:34 +0200)] 
sysv-generator-test: do not query $builddir

This variable is not set by meson, so let's not try to use it.

We could use some more elaborate scheme (e.g. based on $MESON_BUILD_ROOT and
$MESON_SUBDIR) to find the path to systemd-sysv-generator, but it seems
that plain ./systemd-sysv-generator works just as well and has the advantage
that it's easy to invoke the test by hand (as long as one cd's to the
meson build dir).

6 years agosysv-generator-test: drop python2 work-around
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 09:59:08 +0000 (11:59 +0200)] 
sysv-generator-test: drop python2 work-around

We require python3 for meson anyway, so support python2 doesn't seem
useful anymore.

6 years agojournal-verfiy: add a couple of missing le64toh() calls (#6888)
Lennart Poettering [Mon, 25 Sep 2017 20:26:10 +0000 (22:26 +0200)] 
journal-verfiy: add a couple of missing le64toh() calls (#6888)

Apparently BE users don't verify their journals...

Noticed as result of #6887

6 years agostring-util: use size_t for strjoina macro (#6914)
Jonathan Lebon [Mon, 25 Sep 2017 19:56:57 +0000 (15:56 -0400)] 
string-util: use size_t for strjoina macro (#6914)

`strlen` returns a `size_t` and `alloca` expects a `size_t`.

6 years agoinstall: drop left-over debug message (#6913)
Zbigniew Jędrzejewski-Szmek [Mon, 25 Sep 2017 17:59:49 +0000 (19:59 +0200)] 
install: drop left-over debug message (#6913)

6 years agoshared/bus-util: format uid==-1 and gid==-1 as [not set] 6902/head
Zbigniew Jędrzejewski-Szmek [Mon, 25 Sep 2017 09:23:59 +0000 (11:23 +0200)] 
shared/bus-util: format uid==-1 and gid==-1 as [not set]

$ systemctl show systemd-journald -p UID,GID
UID=4294967295
GID=4294967295



$ systemctl show systemd-journald -p UID,GID
UID=[not set]
GID=[not set]

Just seeing the number is very misleading.

Fixes #6511.

6 years agobasic/cap-list: report empty capability set as ""
Zbigniew Jędrzejewski-Szmek [Mon, 25 Sep 2017 09:09:57 +0000 (11:09 +0200)] 
basic/cap-list: report empty capability set as ""

$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=(null)



$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=

Partially fixes #6511. Add some basic tests for the printing function.

6 years agoMerge pull request #6893 from poettering/cgroup-delegate-yay
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 18:53:04 +0000 (20:53 +0200)] 
Merge pull request #6893 from poettering/cgroup-delegate-yay

cgroup delegation fixes, as well as socket unit slice assignment

6 years agoMerge pull request #6891 from poettering/read-line
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 18:51:01 +0000 (20:51 +0200)] 
Merge pull request #6891 from poettering/read-line

add read_line() helper as bounded getline() and make use of it at some places

6 years agoMerge pull request #6887 from rantala/6447
Lennart Poettering [Sun, 24 Sep 2017 17:52:07 +0000 (19:52 +0200)] 
Merge pull request #6887 from rantala/6447

journal: add object sanity check to journal_file_move_to_object() (#6447)

6 years agofileio: return 0 from read_one_line_file on success 6891/head
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 12:27:21 +0000 (14:27 +0200)] 
fileio: return 0 from read_one_line_file on success

Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.

6 years agojournal: add missing le64toh() calls in journal_file_check_object() 6887/head
Tommi Rantala [Sun, 24 Sep 2017 08:56:52 +0000 (11:56 +0300)] 
journal: add missing le64toh() calls in journal_file_check_object()

Lennart Poettering noticed missing le64toh() calls.

6 years agotest-fileio: also test read_line() with actual files
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 07:10:48 +0000 (09:10 +0200)] 
test-fileio: also test read_line() with actual files

Just in case the real FILE and the one from fmemopen weren't exactly
the same.

6 years agotest-fileio: close two leaked file handles
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 06:59:49 +0000 (08:59 +0200)] 
test-fileio: close two leaked file handles

6 years agoman: add missing verb in timedatectl(1) (#6896)
Zbigniew Jędrzejewski-Szmek [Sat, 23 Sep 2017 14:51:41 +0000 (16:51 +0200)] 
man: add missing verb in timedatectl(1) (#6896)

As noted by Michael Biebl.

6 years agoMerge pull request #6894 from poettering/read-full-file-optimize
Zbigniew Jędrzejewski-Szmek [Sat, 23 Sep 2017 11:31:02 +0000 (13:31 +0200)] 
Merge pull request #6894 from poettering/read-full-file-optimize

fileio: various fixes

6 years agoMerge pull request #6892 from keszybz/enablement-work
Lennart Poettering [Sat, 23 Sep 2017 10:44:49 +0000 (12:44 +0200)] 
Merge pull request #6892 from keszybz/enablement-work

Fix various issues with enabled/disabled units

6 years agotest-conf-parser: add tests for the new long lines, including overflow handling
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 12:36:12 +0000 (14:36 +0200)] 
test-conf-parser: add tests for the new long lines, including overflow handling

6 years agotest-conf-parser: use _cleanup_
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 10:02:49 +0000 (12:02 +0200)] 
test-conf-parser: use _cleanup_

6 years agofileio: use _cleanup_ for FILE unlocking
Zbigniew Jędrzejewski-Szmek [Sat, 23 Sep 2017 08:48:09 +0000 (10:48 +0200)] 
fileio: use _cleanup_ for FILE unlocking