cbowdon/daemons.el

Privilege elevation is not done early enough

Closed this issue · 4 comments

With a systemwide installation on GuixSD of the GNU Shepherd,
invocations of any command need to be prefixed with sudo.

While daemons-always-sudo solves this problem partially, it is not invoked early enough.

The initial list is not populated, only when I call daemons again from the unpopulated daemons-buffer it works. Both times, my sudo password is required.

The workaround that I now have in my config:

  (defadvice daemons (before make-sure-sudo)
    "Make sure we actually call sudo before we start doing occult
    stuff."
    (when daemons-always-sudo
      (daemons--sudo)))
  (ad-activate 'daemons)

Hi, thanks for the detailed information. Just trying to get my head around this - is the fix as simple as moving (when daemons-always-sudo (daemons--sudo)) to the start of defun daemons (i.e. prior to creating the list buffer)?

It should, yes. I am not sure if this will lead to any other issues though, as I have only tested this on a system install of shepherd. You would have to make sure systemd and others would still continue to work as intended.

It works as expected for systemd and I don't have any reason to suspect problems with the others, so I've pushed a fix to master. Please let me know how it goes for you. If all is well and no one else raises issues over the next few weeks I'll tag a release for MELPA Stable.

Sorry for the delay; it works, very well :-)