[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 23/24: shepherd: Do not change to the client directory when e
From: |
Ludovic Courtès |
Subject: |
[shepherd] 23/24: shepherd: Do not change to the client directory when executing a command. |
Date: |
Mon, 28 Mar 2022 17:24:48 -0400 (EDT) |
civodul pushed a commit to branch wip-fibers
in repository shepherd.
commit 7b1832557bc67cf77701bc2e2b5ff83bf7bbd336
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Mar 28 22:08:20 2022 +0200
shepherd: Do not change to the client directory when executing a command.
This mechanism was mostly useless and potentially unsafe.
* modules/shepherd.scm (process-command): Remove
'with-directory-excursion' use.
* tests/basic.sh: Adjust test to pass an absolute file name to 'herd
load root'.
---
modules/shepherd.scm | 20 ++++++++++----------
tests/basic.sh | 5 ++---
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 16c242e..63a0a2c 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -445,7 +445,8 @@ already ~a threads running, disabling 'signalfd' support")
"Interpret COMMAND, a command sent by the user, represented as a
<shepherd-command> object. Send the reply to PORT."
(match command
- (($ <shepherd-command> the-action service-symbol (args ...) dir)
+ (($ <shepherd-command> the-action service-symbol (args ...)
+ directory) ;ignored
;; We have to catch `quit' so that we can send the terminator
;; line to herd before we actually quit.
@@ -478,15 +479,14 @@ already ~a threads running, disabling 'signalfd' support")
port)))
(define result
- (with-directory-excursion dir
- (case the-action
- ((start) (apply start service-symbol args))
- ((stop) (apply stop service-symbol args))
- ((enforce) (apply enforce service-symbol args))
-
- ;; Actions which have the semantics of `action' are
- ;; handled there.
- (else (apply action service-symbol the-action args)))))
+ (case the-action
+ ((start) (apply start service-symbol args))
+ ((stop) (apply stop service-symbol args))
+ ((enforce) (apply enforce service-symbol args))
+
+ ;; Actions which have the semantics of `action' are
+ ;; handled there.
+ (else (apply action service-symbol the-action args))))
(write-reply (command-reply command result #f (get-messages))
port))))
diff --git a/tests/basic.sh b/tests/basic.sh
index 5ef1fb0..10bace8 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -1,5 +1,5 @@
# GNU Shepherd --- Test basic communication capabilities.
-# Copyright © 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2013-2014, 2016-2019, 2022 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
# Copyright © 2014 Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
#
@@ -183,8 +183,7 @@ EOF
if $herd status test-loaded
then false; else true; fi
-# Pass a relative file name and makes sure it's properly resolved.
-(cd "$confdir" && herd -s "../$socket" load root "some-conf.scm")
+$herd load root "$confdir/some-conf.scm"
rm "$confdir/some-conf.scm"
# The new service should be loaded now.
- [shepherd] 20/24: service: Add #:handle-termination slot., (continued)
- [shepherd] 20/24: service: Add #:handle-termination slot., Ludovic Courtès, 2022/03/28
- [shepherd] 22/24: service: 'make-inetd-constructor' lets the caller specify socket ownership., Ludovic Courtès, 2022/03/28
- [shepherd] 06/24: service: 'read-pid-file' no longer blocks., Ludovic Courtès, 2022/03/28
- [shepherd] 09/24: service: 'make-forkexec-constructor' spawns a logging fiber., Ludovic Courtès, 2022/03/28
- [shepherd] 16/24: service: Add systemd constructor and destructor., Ludovic Courtès, 2022/03/28
- [shepherd] 11/24: support: 'l10n' accepts plural forms., Ludovic Courtès, 2022/03/28
- [shepherd] 01/24: shepherd: Factorize out the main loop., Ludovic Courtès, 2022/03/28
- [shepherd] 04/24: build: Capture the source and object directories of Fibers., Ludovic Courtès, 2022/03/28
- [shepherd] 07/24: service: 'read-pid-file' uses (@ (guile) sleep) when it's not suspendable., Ludovic Courtès, 2022/03/28
- [shepherd] 21/24: service: Add #:max-connections to 'make-inetd-constructor'., Ludovic Courtès, 2022/03/28
- [shepherd] 23/24: shepherd: Do not change to the client directory when executing a command.,
Ludovic Courtès <=
- [shepherd] 24/24: shepherd: Gracefully handle failure to open the socket., Ludovic Courtès, 2022/03/28