logind: add missing check for conflicting operation v.s. scheduled shutdown
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Mon, 21 Aug 2017 10:49:25 +0000 (11:49 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 24 Aug 2017 11:42:17 +0000 (12:42 +0100)
commitb498d6ea9f72520c579035928d16c527d992bca8
tree52a9f77b1c08a5fd5935586a92c103520e0cd8ba
parentf8169e62dfc9ea903bc880064a5d384cdc68db3e
logind: add missing check for conflicting operation v.s. scheduled shutdown

> We don't want to shutdown while a suspend is running, and vice versa.
> This would be confusing and could lead to data loss in the worst case.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1441253/comments/4

According to the above comment, if the conflicting operation is hung,
we don't want to force things when the admin has not passed a force option.

Similarly if you're not an admin, you probably shouldn't get to sneak
around this check by using a scheduled shutdown instead of an unscheduled
one.  (And no-one so far thought it necessary to add such a permission in
PolKit).

Note that if the conflicting operation was _not_ hung, and we lost the
race with suspend, the system might not have shut down at the scheduled
time anyway.  Which is no good if you were scheduling a power outage.
And scheduling a shutdown for an arbitrary time when the system is resumed,
does not seem a very useful semantic.  More likely, scheduled shutdowns are
useful on systems which do not use suspend, such as multi-user servers.
(In which case even PolKit defaults likely don't let the users trigger
suspend).
src/login/logind-dbus.c