Subject: Re: bug#57052: elogind-service specifies a variable that's ignored by defualt

From: Liliana Marie Prikler <[email-masked]>
Date: Tue, 09 Aug 2022 08:34:12 +0200

Am Dienstag, dem 09.08.2022 um 03:52 +0200 schrieb [email-masked]:
> Hi Liliana,
> 
> On +2022-08-08 12:45:10 +0200, Liliana Marie Prikler wrote:
> > Am Sonntag, dem 07.08.2022 um 23:29 +0000 schrieb Cairn:
> > > "HandleLidSwitchExternalPower= is completely ignored by default
> > > (for
> > > backwards compatibility)"[1]
> > > 
> > > I noticed (with help in IRC) that my laptop wasn't suspending on
> > > lid
> > > close when plugged in and charging, which I hadn't seen happen on
> > > other systems. I now know that I can set this by configuring the
> > > `elogind-service` parameter `handle-lid-switch-external-power`.
> > > Regardless, it seems like it should default to being unset rather
> > > than set/ignored, since that would heed the line I quoted above.
> > I think you're misreading that line.  What it states is not that
> > "HandleLidSwitchExternalPower" is ignored by default, but
> > "HandleLidSwitchExternalPower=" is ignored by default, i.e. there
> > will
> > be no value unless one was provided (whichever semantics "no value"
> > has
> > later on) is only confusingly explained later on.
> > 
> > IMHO the Guix behaviour of always setting a value is the right one
> > (explicit is better than implicit after all).  As for the default
> > values, one might disagree as to which fits, but I don't think
> > ignoring lid switches while powered is harmful.
> > 
> 
> What would you advise if there's no battery power,
> or for some reason one is running on plug power only,
> for worriers that the bulding power might fail?
> 
> I'd guess a power brick would power for some milliseconds 
> and wonder if this is detectable, i.e., to do something
> at least to leave a goodbye world message somewhere if the machine
> was not suspended with sufficient state to resume after power
> restore?
> 
> Buy a UPS, and don't go away long enough for that to run out? :)
I do think that we're starting to split hairs here, but for the sake of
the argument, elogind should be able to detect whether or not the power
supply it's attached to actually delivers power.  If your laptop
doesn't have a battery, then pulling the plug on it has the same
effects as pulling the plug on a regular PC, there's nothing you can do
in elogind to make that a safe action.

Cheers