emacs-daemons: string handling error

  • Open
  • quality assurance status badge
Details
One participant
  • Christopher Howard
Owner
unassigned
Submitted by
Christopher Howard
Severity
normal
C
C
Christopher Howard wrote on 2 Aug 21:51 +0200
(address . bug-guix@gnu.org)
871q36bt5n.fsf@librehacker.com
The emacs-daemons we use, which is the melpa-stable version, is very old (about 6 years out of date), and has a bug caused by a string handling issue. This occurs when "Daemons Always Sudo" is set to on, which is required if you want to view the system processes of shepherd, rather than your home processes.

Recipe:

1. Use "customize-group daemons" and set "Daemons Always Sudo" to "on". Save and set, or set for the session.
2. M-x daemons.

This will throw an error along the lines of

```
Operation on Daemons Always Sudo: 0
cd: No such directory: /sudo::/tmp/tmp.NyPiPKi1eL

```

If you look into this, you'll discover that function "daemons--sudo" does not trim the newline off the end of the result when it calls "daemons--shell-command-to-string". A slightly modified version like so will work (the same, but with string-trim inserted):

```
(with-eval-after-load 'daemons
(defun daemons--sudo ()
"Become root using TRAMP (if on local system).

Switches to a temporary directory to minimise damage potential.

Note that this only works on the local system, not remote systems. For a remote
system you need to specify your own TRAMP path with a privileged user.

e.g. /ssh:me@example.com|sudo:example.com:"
(unless (daemons--using-tramp-path-p default-directory)
(let ((tempdir (string-trim (daemons--shell-command-to-string "mktemp -d"))))
(cd (format "/sudo::%s" tempdir))))))
```

I wanted to reach out to the author/maintainer and find out if he was planning to tag another release for melpa-stable, but I don't have a github account and don't allow github javascript. I was unable to find any other contact information for him. Maybe somebody who uses github would want to reach out to him. Or if not, maybe we would want to patch the stable version.

Here is my system information:

```
christopher@theoden
-------------------
OS: Guix System x86_64
Host: OptiPlex 9020 00
Kernel: 5.15.161-gnu
Uptime: 29 days, 22 hours, 33 mins
Packages: 167 (guix-system), 251 (guix-user)
Shell: bash 5.1.16
Resolution: 1920x1080
DE: GNOME
Theme: Adwaita [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: shepherd
CPU: Intel i5-4570 (4) @ 3.600GHz
GPU: AMD ATI Radeon HD 8490 / R5 235X OEM
GPU: Intel HD Graphics
Memory: 4265MiB / 15914MiB
```

``` guix describe
Generation 137 Jul 27 2024 05:04:20 (current)
guix c6ff1d6
branch: master
commit: c6ff1d6ff761af0bd9bac5403fd834f04a14a192
```

--
? Christopher Howard
? gemini://gem.librehacker.com

?????? ??? ????? ?? ????? ??? ????
?
Your comment

Commenting via the web interface is currently disabled.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 72427
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