GNU bug report logs -
#63561
[PATCH 1/2] services: rsync: Use make-inetd-constructor.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63561 in the body.
You can then email your comments to 63561 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#63561
; Package
guix-patches
.
(Thu, 18 May 2023 01:57:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Thu, 18 May 2023 01:57:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/services/rsync.scm (rsync-shepherd-service): Use make-inetd-constructor
if available in start slot.
* gnu/tests/rsync.scm (run-rsync-test): Delete "PID file" test.
---
gnu/services/rsync.scm | 44 ++++++++++++++++++++++++++++++++++--------
gnu/tests/rsync.scm | 6 ------
2 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index aeb4275031..826b757b1c 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Oleg Pykhalov <go.wigust <at> gmail.com>
;;; Copyright © 2021, 2023 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -221,23 +222,50 @@ (define (rsync-config-file config)
(define (rsync-shepherd-service config)
"Return a <shepherd-service> for rsync with CONFIG."
+
+ ;; XXX: Predicates copied from (gnu services ssh).
+ (define inetd-style?
+ #~(and (defined? 'make-inetd-constructor)
+ (not (string=? (@ (shepherd config) Version) "0.9.0"))))
+
+ (define ipv6-support?
+ #~(catch 'system-error
+ (lambda ()
+ (let ((sock (socket AF_INET6 SOCK_STREAM 0)))
+ (close-port sock)
+ #t))
+ (const #f)))
+
(let* ((rsync (rsync-configuration-package config))
(pid-file (rsync-configuration-pid-file config))
(port-number (rsync-configuration-port-number config))
(user (rsync-configuration-user config))
(group (rsync-configuration-group config))
- (config-file (rsync-config-file config)))
+ (config-file (rsync-config-file config))
+ (rsync-command #~(list (string-append #$rsync "/bin/rsync")
+ "--config" #$config-file "--daemon")))
(list (shepherd-service
(provision '(rsync))
(documentation "Run rsync daemon.")
(actions (list (shepherd-configuration-action config-file)))
- (start #~(make-forkexec-constructor
- (list (string-append #$rsync "/bin/rsync")
- "--config" #$config-file
- "--daemon")
- #:pid-file #$pid-file
- #:user #$user
- #:group #$group))
+ (start #~(if #$inetd-style?
+ (make-inetd-constructor
+ #$rsync-command
+ (cons (endpoint
+ (make-socket-address AF_INET INADDR_ANY
+ #$port-number))
+ (if #$ipv6-support?
+ (list
+ (endpoint
+ (make-socket-address AF_INET6 IN6ADDR_ANY
+ #$port-number)))
+ '()))
+ #:user #$user
+ #:group #$group)
+ (make-forkexec-constructor #$rsync-command
+ #:pid-file #$pid-file
+ #:user #$user
+ #:group #$group)))
(stop #~(make-kill-destructor))))))
(define rsync-service-type
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
index ea53a157bb..182e5f76ff 100644
--- a/gnu/tests/rsync.scm
+++ b/gnu/tests/rsync.scm
@@ -70,12 +70,6 @@ (define* (run-rsync-test rsync-os #:optional (rsync-port 873))
(start-service 'rsync))
marionette))
- ;; Make sure the PID file is created.
- (test-assert "PID file"
- (marionette-eval
- '(file-exists? "/var/run/rsyncd/rsyncd.pid")
- marionette))
-
(test-assert "Test file copied to share"
(marionette-eval
'(begin
base-commit: 9c161c1f0def13676002ce34625ba023857b9ab2
--
2.39.2
Forcibly Merged 63561 63562.
Request was from
Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 18 May 2023 02:02:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#63561
; Package
guix-patches
.
(Thu, 18 May 2023 16:59:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 63561 <at> debbugs.gnu.org (full text, mbox):
Hi,
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
> + (make-inetd-constructor
> + #$rsync-command
> + (cons (endpoint
> + (make-socket-address AF_INET INADDR_ANY
> + #$port-number))
> + (if #$ipv6-support?
> + (list
> + (endpoint
> + (make-socket-address AF_INET6 IN6ADDR_ANY
> + #$port-number)))
> + '()))
> + #:user #$user
> + #:group #$group)
> + (make-forkexec-constructor #$rsync-command
I found it fishy that the same command could be used both in inetd mode
and in “regular” daemon mode. Turns out that rsync does something…
surprising, as noted in rsync(1):
If standard input is a socket then rsync will assume that it is being
run via inetd, otherwise it will detach from the current terminal and
become a background daemon.
So I guess this is fine, and a welcome change!
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 16 Jun 2023 11:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 330 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.