elogind-service specifies a variable that's ignored by defualt

  • Done
  • quality assurance status badge
Details
5 participants
  • bokr
  • Cairn
  • Liliana Marie Prikler
  • Maxim Cournoyer
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Cairn
Severity
normal
C
C
Cairn wrote on 8 Aug 2022 01:29
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
1MoJ5UI-6FMbpR2WSMjNbdVXZd4GisV-Dl1HPuLfgYLOQYl4Udg7HLNR8NDmZ47slyi4grIwH93xXL8xORLxUo4O80MR34q3wLXMmnktYH8=@pm.me
"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.

Attachment: signature.asc
L
L
Liliana Marie Prikler wrote on 8 Aug 2022 12:45
8b93b5ce9f1c9caab7a65fcc672dddd24c7ad373.camel@ist.tugraz.at
Am Sonntag, dem 07.08.2022 um 23:29 +0000 schrieb Cairn:
Toggle quote (9 lines)
> "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.

Cheers
B
Re: bug#57052: elogind-service specifies a variable that's ignored by defualt
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
20220809015243.GA19707@LionPure
Hi Liliana,

On +2022-08-08 12:45:10 +0200, Liliana Marie Prikler wrote:
Toggle quote (22 lines)
> 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? :)

Toggle quote (2 lines)
> Cheers
>
--
Regards,
Bengt Richter
L
L
Liliana Marie Prikler wrote on 9 Aug 2022 08:34
(address . bokr@bokr.com)
2427493dd6757a755b5ee6d1818da45b030af337.camel@ist.tugraz.at
Am Dienstag, dem 09.08.2022 um 03:52 +0200 schrieb bokr@bokr.com:
Toggle quote (40 lines)
> 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
C
C
Cairn wrote on 9 Aug 2022 08:42
Re: elogind-service specifies a variable that's ignored by defualt
Hn1ZMO3EcuXfolkFXd2euaROYzm7lwKwbIgeQ82pjNGbM68RunaCTpULgweXApiDu8ghd_lYyC4ntDAwaIezrahGq55_FQnT9VCXwsQ19_c=@pm.me
(Resending this email, since I forgot to add the debugs.gnu.org address as a recipient)

Toggle quote (5 lines)
> 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.

That's fair!

Well, if explicitly setting variables is the standard, then I suggest changing `handle-lid-switch-external-power` to the same value as `handle-lid-switch` ("suspend"). I agree that the current setting isn't harmful, but this change would match the default, unconfigured behavior of `elogind`. It would also be more consistent with other distros' defaults from what I've experienced.
Attachment: signature.asc
M
M
Maxim Cournoyer wrote on 9 Aug 2022 15:52
Re: bug#57052: elogind-service specifies a variable that's ignored by defualt
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
8735e5plra.fsf@gmail.com
Hi,

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

Toggle quote (21 lines)
> 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.

It can be. I have a Lenovo T430s with a partially discolored LCD from
heat after I left it closed in a backpack for a couple hours, thinking
it would have suspend (it was not). That would not have happened with
the value supposed to be default (which matches the behavior used on
most other systems).

So I'd favor having the default to suspend on any lid close.

Thanks,

Maxim
M
M
Maxim Cournoyer wrote on 9 Aug 2022 15:57
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
87wnbho6z2.fsf@gmail.com
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (33 lines)
> Hi,
>
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
>
>> 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.
>
> It can be. I have a Lenovo T430s with a partially discolored LCD from
> heat after I left it closed in a backpack for a couple hours, thinking
> it would have suspend (it was not). That would not have happened with
> the value supposed to be default (which matches the behavior used on
> most other systems).
>
> So I'd favor having the default to suspend on any lid close.

For the record, this was noticed and discussed more than a year ago, see
Message-ID: <871rens9a2.fsf@nckx>. It had fallen into the cracks, it
seems.

Maxim
T
T
Tobias Geerinckx-Rice wrote on 9 Aug 2022 16:31
Re: bug#57052: elogind-service specifi es a variable that's ignored by defualt
6AE7F282-3FD0-415F-A460-9AB1A5539A13@tobias.gr
Toggle quote (3 lines)
>For the record, this was noticed and discussed more than a year ago, see
>Message-ID: <871rens9a2.fsf@nckx>. It had fallen into the cracks

LOL. I'm the one who asked Cairn to report this. I didn't remember publicly reporting it, I only remembered noticing it and not fixing it, and didn't want it to get forgotten 'again'. Sorry for the noise!

Strongly disagree that the current Guix behaviour makes any sense, let alone better! That sounds like posthockholm rationalisation to me. If people want opinionated variants, those can be written on top of a service that properly exposes upstream behaviour.


Kind regards,

T G-R

Sent on the go. Excuse or enjoy my brevity.
C
C
Cairn wrote on 9 Aug 2022 16:42
Re: bug#57052: elogind-service specifies a variable that's ignored by defualt
(name . 57052@debbugs.gnu.org)(address . 57052@debbugs.gnu.org)
HMSUFx7BwF75cZLz5Z-zHmGqBi7aeF3zQTeTqL9mQs6k0Rp4DaPhSAjYHt2zdq5WGGZ3eDh9Z_rQ2vskJar9W-yX66kopOt68D3ovxe4YFA=@pm.me
Would it not still be explicit if variables that should go unspecified were written out, but not given a value? Maybe I'm misunderstanding the point of explicit values though.
Attachment: signature.asc
M
M
Maxim Cournoyer wrote on 10 Aug 2022 06:38
(name . Cairn)(address . cairn@pm.me)
871qton25x.fsf@gmail.com
Hello,

Cairn <cairn@pm.me> writes:

Toggle quote (4 lines)
> Would it not still be explicit if variables that should go unspecified
> were written out, but not given a value? Maybe I'm misunderstanding
> the point of explicit values though.

I made it *unspecified* in 59ee837d8b, given this service config doesn't
yet use 'define-configuration' that would have allowed for a proper
maybe-value.

Tested to work on a X200 and pushed!

Closing, at last.

Thanks,

Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 57052@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57052
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch