[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/07: services: anonip: Bail out when the input is not a FIFO.
From: |
guix-commits |
Subject: |
03/07: services: anonip: Bail out when the input is not a FIFO. |
Date: |
Tue, 4 Oct 2022 12:17:25 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit f83622f17d21d684e431fe14731349b952411368
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Oct 4 09:44:18 2022 +0200
services: anonip: Bail out when the input is not a FIFO.
* gnu/services/web.scm (anonip-shepherd-service)[start]: Accept zero
arguments. Define 'spawn'. Print a message and return #f when #$INPUT
does not denote a FIFO.
---
gnu/services/web.scm | 60 +++++++++++++++++++++++++++++-----------------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index e347f5dbcc..e5ab1a1180 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -1438,32 +1438,40 @@ files.")
(documentation
"Anonimyze the given log file location with anonip.")
(start
- #~(lambda _
- (unless (file-exists? #$input)
- (mknod #$input 'fifo #o600 0))
- (let ((pid
- (fork+exec-command
- (append
- (list #$(file-append (anonip-configuration-anonip config)
- "/bin/anonip")
- (string-append "--input=" #$input)
- (string-append "--output=" #$output))
- (if #$(anonip-configuration-skip-private? config)
- '("--skip-private") (list))
- '#$(optional anonip-configuration-column "--column")
- '#$(optional anonip-configuration-ipv4mask "--ipv4mask")
- '#$(optional anonip-configuration-ipv6mask "--ipv6mask")
- '#$(optional anonip-configuration-increment "--increment")
- '#$(optional anonip-configuration-replacement
- "--replacement")
- '#$(optional anonip-configuration-delimiter "--delimiter")
- '#$(optional anonip-configuration-regex "--regex"))
- ;; Run in a UTF-8 locale
- #:environment-variables
- (list (string-append "GUIX_LOCPATH=" #$glibc-utf8-locales
- "/lib/locale")
- "LC_ALL=en_US.utf8"))))
- pid)))
+ #~(lambda ()
+ (define (spawn)
+ (fork+exec-command
+ (append
+ (list #$(file-append (anonip-configuration-anonip config)
+ "/bin/anonip")
+ (string-append "--input=" #$input)
+ (string-append "--output=" #$output))
+ (if #$(anonip-configuration-skip-private? config)
+ '("--skip-private") (list))
+ '#$(optional anonip-configuration-column "--column")
+ '#$(optional anonip-configuration-ipv4mask "--ipv4mask")
+ '#$(optional anonip-configuration-ipv6mask "--ipv6mask")
+ '#$(optional anonip-configuration-increment "--increment")
+ '#$(optional anonip-configuration-replacement
+ "--replacement")
+ '#$(optional anonip-configuration-delimiter "--delimiter")
+ '#$(optional anonip-configuration-regex "--regex"))
+ ;; Run in a UTF-8 locale
+ #:environment-variables
+ (list (string-append "GUIX_LOCPATH=" #$glibc-utf8-locales
+ "/lib/locale")
+ "LC_ALL=en_US.utf8")))
+
+ (let ((stat (stat #$input #f)))
+ (cond ((not stat)
+ (mknod #$input 'fifo #o600 0)
+ (spawn))
+ ((eq? 'fifo (stat:type stat))
+ (spawn))
+ (else
+ (format #t "'~a' is not a FIFO; bailing out~%"
+ #$input)
+ #f)))))
(stop #~(make-kill-destructor))))))
(define anonip-service-type
- branch master updated (7030f592c6 -> ecee392ef1), guix-commits, 2022/10/04
- 01/07: gnu: guix: Update to 17134b9., guix-commits, 2022/10/04
- 03/07: services: anonip: Bail out when the input is not a FIFO.,
guix-commits <=
- 02/07: channels: Warn about missing introductions., guix-commits, 2022/10/04
- 04/07: gnu: Add python-property-manager., guix-commits, 2022/10/04
- 05/07: gnu: Add python-executor., guix-commits, 2022/10/04
- 06/07: gnu: Add awscli-2., guix-commits, 2022/10/04
- 07/07: gnu: eog-plugins: Fix source URL., guix-commits, 2022/10/04