[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 28/32: shepherd: Do not change to the client directory when e
From: |
Ludovic Courtès |
Subject: |
[shepherd] 28/32: shepherd: Do not change to the client directory when executing a command. |
Date: |
Wed, 30 Mar 2022 11:01:33 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 1a8d686b7fa617d9b1df33858957a240b7e11787
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] 01/32: tests: Remove 'nofiles' test file when cleaning up., (continued)
- [shepherd] 01/32: tests: Remove 'nofiles' test file when cleaning up., Ludovic Courtès, 2022/03/30
- [shepherd] 02/32: README: Mention copyright year ranges., Ludovic Courtès, 2022/03/30
- [shepherd] 03/32: Remove 'QUESTIONS' file., Ludovic Courtès, 2022/03/30
- [shepherd] 07/32: Use Fibers., Ludovic Courtès, 2022/03/30
- [shepherd] 13/32: shepherd: Encode log as UTF-8 unconditionally., Ludovic Courtès, 2022/03/30
- [shepherd] 14/32: service: 'make-forkexec-constructor' spawns a logging fiber., Ludovic Courtès, 2022/03/30
- [shepherd] 08/32: README: Update requirements., Ludovic Courtès, 2022/03/30
- [shepherd] 21/32: service: Add systemd constructor and destructor., Ludovic Courtès, 2022/03/30
- [shepherd] 22/32: service: Add 'start-in-the-background'., Ludovic Courtès, 2022/03/30
- [shepherd] 25/32: service: Add #:handle-termination slot., Ludovic Courtès, 2022/03/30
- [shepherd] 28/32: shepherd: Do not change to the client directory when executing a command.,
Ludovic Courtès <=
- [shepherd] 31/32: doc: Clarify which instance 'herd' talks to., Ludovic Courtès, 2022/03/30
- [shepherd] 09/32: build: Capture the source and object directories of Fibers., Ludovic Courtès, 2022/03/30
- [shepherd] 11/32: service: 'read-pid-file' no longer blocks., Ludovic Courtès, 2022/03/30
- [shepherd] 10/32: shepherd: Use one fiber for signal handling, and one for clients., Ludovic Courtès, 2022/03/30
- [shepherd] 15/32: doc: Fix inetutils cross-reference., Ludovic Courtès, 2022/03/30
- [shepherd] 12/32: service: 'read-pid-file' uses (@ (guile) sleep) when it's not suspendable., Ludovic Courtès, 2022/03/30
- [shepherd] 18/32: service: Add the #:transient? slot., Ludovic Courtès, 2022/03/30
- [shepherd] 17/32: service: Remove unused 'make-init.d-service'., Ludovic Courtès, 2022/03/30
- [shepherd] 24/32: shepherd: "shepherd -s -" replies to the current output port., Ludovic Courtès, 2022/03/30
- [shepherd] 26/32: service: Add #:max-connections to 'make-inetd-constructor'., Ludovic Courtès, 2022/03/30