unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72427: emacs-daemons: string handling error
@ 2024-08-02 19:51 Christopher Howard
  0 siblings, 0 replies; only message in thread
From: Christopher Howard @ 2024-08-02 19:51 UTC (permalink / raw)
  To: 72427

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
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: c6ff1d6ff761af0bd9bac5403fd834f04a14a192
```

-- 
📛 Christopher Howard
🚀 gemini://gem.librehacker.com
🌐 http://gem.librehacker.com

בראשית ברא אלהים את השמים ואת הארץ




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-08-02 19:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 19:51 bug#72427: emacs-daemons: string handling error Christopher Howard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).