all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#27855] [PATCH] gnu: Add rsync service.
@ 2017-07-27 22:01 Oleg Pykhalov
  2017-07-27 22:22 ` [bug#27855] ERROR: rsync rsync://localhost/files Oleg Pykhalov
                   ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-07-27 22:01 UTC (permalink / raw)
  To: 27855

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
---
 doc/guix.texi          |  58 ++++++++++++++++++
 gnu/local.mk           |   1 +
 gnu/services/rsync.scm | 162 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 221 insertions(+)
 create mode 100644 gnu/services/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index e8c4e0eaf..a3745ae01 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15661,6 +15661,64 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection Incremental file transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+Package object of the Rsync utility for efficiently transferring and
+synchronizing files.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-choot?} (default: @var{#f})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index 724c6b675..fa514b278 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -444,6 +444,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..49c4cb7e2
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,162 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;
+;;; Rsync.
+;;;
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration make-rsync-configuration
+  rsync-configuration?
+  ;; <package>
+  (package rsync-configuration-package
+           (default rsync))
+  ;; integer
+  (port-number rsync-configuration-port-number
+               (default 873))
+  ;; string
+  (pid-file rsync-configuration-pid-file
+            (default "/var/run/rsyncd.pid"))
+  ;; string
+  (lock-file rsync-configuration-lock-file
+             (default "/var/run/rsyncd.lock"))
+  ;; string
+  (log-file rsync-configuration-log-file
+            (default "/var/log/rsyncd.log"))
+  ;; Boolean
+  (use-chroot? rsync-configuration-use-chroot?
+               (default #f))
+  ;; string
+  (share-path rsync-configuration-share-path
+              (default "/srv/rsync"))
+  ;; string
+  (share-comment rsync-configuration-share-comment
+                 (default "Rsync share"))
+  ;; Boolean
+  (read-only? rsync-configuration-read-only?
+              (default #f))
+  ;; integer
+  (timeout rsync-configuration-timeout
+           (default 300)))
+
+(define %rsync-accounts
+  ;; User account and group for rsync.
+  (list (user-group (name "rsyncd") (system? #t))
+        (user-account
+         (name "rsyncd")
+         (system? #t)
+         (group "rsyncd")
+         (comment "rsyncd privilege separation user")
+         (home-directory "/var/run/rsyncd")
+         (shell #~(string-append #$shadow "/sbin/nologin")))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-directory #$(rsync-configuration-share-path config))
+            (user (getpw "rsyncd")))
+        (and=> share-directory mkdir-p)
+        (chown share-directory
+               (passwd:uid user)
+               (group:gid user)))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (computed-file
+   "rsync.conf"
+   #~(begin
+       (call-with-output-file #$output
+         (lambda (port)
+           (display "# Generated by 'rsync-service'.\n" port)
+           (format port "pid file = ~a\n"
+                   #$(rsync-configuration-pid-file config))
+           (format port "lock file = ~a\n"
+                   #$(rsync-configuration-lock-file config))
+           (format port "log file = ~a\n"
+                   #$(rsync-configuration-log-file config))
+           (format port "port = ~a\n"
+                   #$(number->string
+                      (rsync-configuration-port-number config)))
+           (format port "use chroot = ~a\n"
+                   #$(if (rsync-configuration-use-chroot? config)
+                         "true" "false"))
+           (display "[files]\n" port)
+           (format port "path = ~a\n"
+                   #$(rsync-configuration-share-path config))
+           (format port "comment = ~a\n"
+                   #$(rsync-configuration-share-comment config))
+           (format port "read only = ~a\n"
+                   #$(if (rsync-configuration-read-only? config)
+                         "true" "false"))
+           (format port "timeout = ~a\n"
+                   #$(number->string
+                      (rsync-configuration-timeout config)))
+           #t)))))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+
+  (define rsync-command
+    #~(list (string-append #$(rsync-configuration-package config) "/bin/rsync")
+            "--daemon" "--config" #$(rsync-config-file config)))
+
+  (define pid-file
+    (rsync-configuration-pid-file config))
+
+  (define user
+    (let ((port (rsync-configuration-port-number config)))
+      (if (> port  1024)
+          "rsyncd"
+          "root")))
+
+  (list (shepherd-service
+         (provision '(rsync))
+         (documentation "Run rsync daemon.")
+         (start #~(make-forkexec-constructor #$rsync-command
+                                             #:pid-file #$pid-file
+                                             #:user #$user
+                                             #:group #$user))
+         (stop #~(make-kill-destructor)))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             rsync-shepherd-service)
+          (service-extension account-service-type
+                             (const %rsync-accounts))
+          (service-extension activation-service-type
+                             rsync-activation)))))
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] ERROR: rsync rsync://localhost/files
  2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
@ 2017-07-27 22:22 ` Oleg Pykhalov
  2017-07-28  6:45 ` [bug#27855] [PATCH] services: rsync: Fix invalid gid nobody Oleg Pykhalov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-07-27 22:22 UTC (permalink / raw)
  To: 27855

[-- Attachment #1: shepherd-rsync.scm --]
[-- Type: text/plain, Size: 771 bytes --]

(eval-when (expand load eval) (set! %load-path (cons "/gnu/store/xjv05kaa67glf1i639b3bhkib746f9ag-module-import" %load-path)) (set! %load-compiled-path (cons "/gnu/store/ya080134pjnk4jiw8j9g244rgrn8pfy9-module-import-compiled" %load-compiled-path)))(begin (use-modules (shepherd service) (oop goops) (guix build utils) (guix build syscalls)) (make <service> #:docstring (quote "Run rsync daemon.") #:provides (quote (rsync)) #:requires (quote ()) #:respawn? (quote #t) #:start (make-forkexec-constructor (list (string-append "/gnu/store/nfx98xdajm6fvnxhq8z3nmrzkb4421dl-rsync-3.1.2" "/bin/rsync") "--daemon" "--config" "/gnu/store/s2zk3kp2gjpfv61npr79rmwlp74r4yk0-rsync.conf") #:pid-file "/var/run/rsyncd.pid" #:user "root" #:group "root") #:stop (make-kill-destructor)))

[-- Attachment #2: rsync localhost --]
[-- Type: text/plain, Size: 148 bytes --]

natsu@magnolia /gnu/store$ 
@ERROR: invalid gid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] services: rsync: Fix invalid gid nobody.
  2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
  2017-07-27 22:22 ` [bug#27855] ERROR: rsync rsync://localhost/files Oleg Pykhalov
@ 2017-07-28  6:45 ` Oleg Pykhalov
  2017-07-28 22:17 ` [bug#27855] [PATCH] gnu: Add rsync service Christopher Baines
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-07-28  6:45 UTC (permalink / raw)
  To: 27855

---
 gnu/services/rsync.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index 49c4cb7e2..9cf2bc89a 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -112,6 +112,7 @@
            (format port "use chroot = ~a\n"
                    #$(if (rsync-configuration-use-chroot? config)
                          "true" "false"))
+           (display "gid = rsyncd\n" port)
            (display "[files]\n" port)
            (format port "path = ~a\n"
                    #$(rsync-configuration-share-path config))
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
  2017-07-27 22:22 ` [bug#27855] ERROR: rsync rsync://localhost/files Oleg Pykhalov
  2017-07-28  6:45 ` [bug#27855] [PATCH] services: rsync: Fix invalid gid nobody Oleg Pykhalov
@ 2017-07-28 22:17 ` Christopher Baines
  2017-07-29 11:03   ` Oleg Pykhalov
  2017-09-17  8:40 ` [bug#27855] Status: " Oleg Pykhalov
  2017-09-18  6:20 ` [bug#27855] " Christopher Baines
  4 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-07-28 22:17 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 12248 bytes --]

Hello Oleg,

I've had a quick read through the patch, and I've made a few hopefully
helpful comments below.

On Fri, 28 Jul 2017 01:01:51 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> * doc/guix.texi (Incremental file transfer): Add documentation.
> * gnu/services/rsync.scm (<rsync-configuration>): New record type.
> (rsync-accounts, rsync-shepherd-service): New service extensions.
> (rsync-service-type): New service type.
> ---
>  doc/guix.texi          |  58 ++++++++++++++++++
>  gnu/local.mk           |   1 +
>  gnu/services/rsync.scm | 162
> +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed,
> 221 insertions(+) create mode 100644 gnu/services/rsync.scm
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index e8c4e0eaf..a3745ae01 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -15661,6 +15661,64 @@ Extra options will be passed to @code{git
> daemon}, please run @end table
>  @end deftp
>  
> +@subsubsection Incremental file transfer
> +
> +The @code{(gnu services rsync)} module provides the following
> services: +
> +@subsubheading Rsync service

It would be great to give a really short explanation of what this
service can be used for here. I know what Rsync does, but I'm not quite
sure what this service does.

> +@deffn {Scheme Variable} rsync-service-type
> +This is the type for the @uref{https://rsync.samba.org} rsync daemon,
> +@command{rsync-configuration} record as in this example:
> +
> +@example
> +(service rsync-service-type
> +         (rsync-configuration))
> +@end example
> +
> +See below for details about @code{rsync-configuration}.
> +@end deffn
> +
> +@deftp {Data Type} rsync-configuration
> +Data type representing the configuration for @code{rsync-service}.
> +
> +@table @asis
> +@item @code{package} (default: @var{rsync})
> +Package object of the Rsync utility for efficiently transferring and
> +synchronizing files.

Object doesn't really fit here, if anything its a record. Also, I don't
think this needs a description of what rsync does, it's probably
clearest to just say that this is the rsync package?

> +@item @code{port-number} (default: @code{873})
> +TCP port on which @command{rsync} listens for incoming connections.
> If +port is less than @code{1024} @command{rsync} will be started as
> the +@code{root} user and group.
> +
> +@item @code{pid-file} (default: @code{"/var/run/rsyncd.pid"})
> +Name of the file where @command{rsync} writes its PID.
> +
> +@item @code{lock-file} (default: @code{"/var/run/rsyncd.lock"})
> +Name of the file where @command{rsync} writes its lock file.
> +
> +@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
> +Name of the file where @command{rsync} writes its log file.
> +
> +@item @code{use-choot?} (default: @var{#f})
> +Whether to use chroot for @command{rsync} shared directory.
> +
> +@item @code{share-path} (default: @file{/srv/rsync})
> +Location of the @command{rsync} shared directory.
> +
> +@item @code{share-comment} (default: @code{"Rsync share"})
> +Comment of the @command{rsync} shared directory.
> +
> +@item @code{read-only?} (default: @var{#f})
> +Read-write permissions to shared directory.
> +
> +@item @code{timeout} (default: @code{300})
> +I/O timeout in seconds.
> +
> +@end table
> +@end deftp
> +
>  @node Setuid Programs
>  @subsection Setuid Programs
>  
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 724c6b675..fa514b278 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -444,6 +444,7 @@ GNU_SYSTEM_MODULES
> =				\
> %D%/services/shepherd.scm			\
> %D%/services/herd.scm				\
> %D%/services/pm.scm				\
> +  %D%/services/rsync.scm			\
>    %D%/services/sddm.scm				\
>    %D%/services/spice.scm				\
>    %D%/services/ssh.scm				\
> diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
> new file mode 100644
> index 000000000..49c4cb7e2
> --- /dev/null
> +++ b/gnu/services/rsync.scm
> @@ -0,0 +1,162 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it +;;; under the terms of the GNU General Public License as
> published by +;;; the Free Software Foundation; either version 3 of
> the License, or (at +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu services rsync)
> +  #:use-module (gnu services)
> +  #:use-module (gnu services base)
> +  #:use-module (gnu services shepherd)
> +  #:use-module (gnu system shadow)
> +  #:use-module (gnu packages rsync)
> +  #:use-module (gnu packages admin)
> +  #:use-module (guix records)
> +  #:use-module (guix gexp)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:use-module (ice-9 match)
> +  #:export (rsync-configuration
> +            rsync-configuration?
> +            rsync-service-type))
> +
> +;;;
> +;;; Rsync.
> +;;;
> +
> +(define-record-type* <rsync-configuration>
> +  rsync-configuration make-rsync-configuration
> +  rsync-configuration?
> +  ;; <package>
> +  (package rsync-configuration-package
> +           (default rsync))
> +  ;; integer
> +  (port-number rsync-configuration-port-number
> +               (default 873))
> +  ;; string
> +  (pid-file rsync-configuration-pid-file
> +            (default "/var/run/rsyncd.pid"))
> +  ;; string
> +  (lock-file rsync-configuration-lock-file
> +             (default "/var/run/rsyncd.lock"))
> +  ;; string
> +  (log-file rsync-configuration-log-file
> +            (default "/var/log/rsyncd.log"))
> +  ;; Boolean
> +  (use-chroot? rsync-configuration-use-chroot?
> +               (default #f))
> +  ;; string
> +  (share-path rsync-configuration-share-path
> +              (default "/srv/rsync"))
> +  ;; string
> +  (share-comment rsync-configuration-share-comment
> +                 (default "Rsync share"))
> +  ;; Boolean
> +  (read-only? rsync-configuration-read-only?
> +              (default #f))
> +  ;; integer
> +  (timeout rsync-configuration-timeout
> +           (default 300)))
> +
> +(define %rsync-accounts
> +  ;; User account and group for rsync.
> +  (list (user-group (name "rsyncd") (system? #t))
> +        (user-account
> +         (name "rsyncd")
> +         (system? #t)
> +         (group "rsyncd")
> +         (comment "rsyncd privilege separation user")
> +         (home-directory "/var/run/rsyncd")
> +         (shell #~(string-append #$shadow "/sbin/nologin")))))
> +
> +(define (rsync-activation config)
> +  "Return the activation GEXP for CONFIG."
> +  #~(begin
> +      (use-modules (guix build utils))
> +      (let ((share-directory #$(rsync-configuration-share-path
> config))
> +            (user (getpw "rsyncd")))
> +        (and=> share-directory mkdir-p)
> +        (chown share-directory
> +               (passwd:uid user)
> +               (group:gid user)))))
> +
> +(define (rsync-config-file config)
> +  "Return the rsync configuration file corresponding to CONFIG."
> +  (computed-file
> +   "rsync.conf"
> +   #~(begin
> +       (call-with-output-file #$output
> +         (lambda (port)
> +           (display "# Generated by 'rsync-service'.\n" port)
> +           (format port "pid file = ~a\n"
> +                   #$(rsync-configuration-pid-file config))
> +           (format port "lock file = ~a\n"
> +                   #$(rsync-configuration-lock-file config))
> +           (format port "log file = ~a\n"
> +                   #$(rsync-configuration-log-file config))
> +           (format port "port = ~a\n"
> +                   #$(number->string
> +                      (rsync-configuration-port-number config)))
> +           (format port "use chroot = ~a\n"
> +                   #$(if (rsync-configuration-use-chroot? config)
> +                         "true" "false"))
> +           (display "[files]\n" port)
> +           (format port "path = ~a\n"
> +                   #$(rsync-configuration-share-path config))
> +           (format port "comment = ~a\n"
> +                   #$(rsync-configuration-share-comment config))
> +           (format port "read only = ~a\n"
> +                   #$(if (rsync-configuration-read-only? config)
> +                         "true" "false"))
> +           (format port "timeout = ~a\n"
> +                   #$(number->string
> +                      (rsync-configuration-timeout config)))
> +           #t)))))

It might be neater here to use mixed-text-file here. It might look
something like...

(define (rsync-config-file config)
  "Return the rsync configuration file corresponding to CONFIG."
  (match config
    (($ <rsync-configuration> package port-number pid-file lock-file
                              log-file use-chroot? share-path
                              share-comment read-only? timeout)
     (mixed text-file "rsync.conf"
      "# Generated by 'rsync-service'.\n"
      "pid file = " pid-file "\n"
      "lock file = " lock-file "\n"
      "log file = " log-file "\n"
      "port = " (number->string port-number) "\n"
      "use chroot = " (if use-chroot? "true" "false") "\n"
      "[files]\n"
      "path = " share-path "\n"
      "comment = " share-comment "\n"
      "read only = " (if read-only? "true" "false") "\n"
      "timeout = " (number->string timeout) "\n"))))
     

One thing I tried with the Tailon service, was to define a
gexp-compiler for the record type representing the configuration file.
One really big advantage in the case of Tailon is that it easily allows
the use of a custom file, just by providing a different gexp.

Here however, I can see that you are using some values from the
configuration (the port-number, package and share-path), which don't
make that possible. The use of the port-number and package could
probably be elegantly separated out, but I can't figure out what could
be done about the share path, and its use in the service activation.

> +
> +(define (rsync-shepherd-service config)
> +  "Return a <shepherd-service> for rsync with CONFIG."
> +
> +  (define rsync-command
> +    #~(list (string-append #$(rsync-configuration-package config)
> "/bin/rsync")
> +            "--daemon" "--config" #$(rsync-config-file config)))
> +
> +  (define pid-file
> +    (rsync-configuration-pid-file config))
> +
> +  (define user
> +    (let ((port (rsync-configuration-port-number config)))
> +      (if (> port  1024)
> +          "rsyncd"
> +          "root")))
> +
> +  (list (shepherd-service
> +         (provision '(rsync))
> +         (documentation "Run rsync daemon.")
> +         (start #~(make-forkexec-constructor #$rsync-command
> +                                             #:pid-file #$pid-file
> +                                             #:user #$user
> +                                             #:group #$user))
> +         (stop #~(make-kill-destructor)))))
> +
> +(define rsync-service-type
> +  (service-type
> +   (name 'rsync)
> +   (extensions
> +    (list (service-extension shepherd-root-service-type
> +                             rsync-shepherd-service)
> +          (service-extension account-service-type
> +                             (const %rsync-accounts))
> +          (service-extension activation-service-type
> +                             rsync-activation)))))

As I understand it, the service might not use the rsyncd user, if it is
configured to bind to a low port? If that is the case, then it might be
neater to include a check for this in the account-service-type
extension, so that these only get created if they are needed?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-07-28 22:17 ` [bug#27855] [PATCH] gnu: Add rsync service Christopher Baines
@ 2017-07-29 11:03   ` Oleg Pykhalov
  2017-07-29 11:55     ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-07-29 11:03 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Hello Christopher,

Christopher Baines <mail@cbaines.net> writes:

> Hello Oleg,
>
> I've had a quick read through the patch, and I've made a few hopefully
> helpful comments below.
>
> On Fri, 28 Jul 2017 01:01:51 +0300
> Oleg Pykhalov <go.wigust@gmail.com> wrote:
>
>> * doc/guix.texi (Incremental file transfer): Add documentation.
>> * gnu/services/rsync.scm (<rsync-configuration>): New record type.
>> (rsync-accounts, rsync-shepherd-service): New service extensions.
>> (rsync-service-type): New service type.
>> ---
>>  doc/guix.texi          |  58 ++++++++++++++++++
>>  gnu/local.mk           |   1 +
>>  gnu/services/rsync.scm | 162
>> +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed,
>> 221 insertions(+) create mode 100644 gnu/services/rsync.scm
>> 
>> diff --git a/doc/guix.texi b/doc/guix.texi
>> index e8c4e0eaf..a3745ae01 100644
>> --- a/doc/guix.texi
>> +++ b/doc/guix.texi
>> @@ -15661,6 +15661,64 @@ Extra options will be passed to @code{git
>> daemon}, please run @end table
>>  @end deftp
>>  
>> +@subsubsection Incremental file transfer
>> +
>> +The @code{(gnu services rsync)} module provides the following
>> services: +
>> +@subsubheading Rsync service
>
> It would be great to give a really short explanation of what this
> service can be used for here. I know what Rsync does, but I'm not quite
> sure what this service does.

OK, I add a little description.

    You might want an rsync daemon if you have files that you want
    available so anyone (or just yourself) can download existing files
    or upload new files.

>> +@deffn {Scheme Variable} rsync-service-type
>> +This is the type for the @uref{https://rsync.samba.org} rsync daemon,
>> +@command{rsync-configuration} record as in this example:
>> +
>> +@example
>> +(service rsync-service-type
>> +         (rsync-configuration))
>> +@end example
>> +
>> +See below for details about @code{rsync-configuration}.
>> +@end deffn
>> +
>> +@deftp {Data Type} rsync-configuration
>> +Data type representing the configuration for @code{rsync-service}.
>> +
>> +@table @asis
>> +@item @code{package} (default: @var{rsync})
>> +Package object of the Rsync utility for efficiently transferring and
>> +synchronizing files.
>
> Object doesn't really fit here, if anything its a record. Also, I don't
> think this needs a description of what rsync does, it's probably
> clearest to just say that this is the rsync package?

OK, is it good?

    @code{rsync} package to use.

>> +@item @code{port-number} (default: @code{873})
>> +TCP port on which @command{rsync} listens for incoming connections.
>> If +port is less than @code{1024} @command{rsync} will be started as
>> the +@code{root} user and group.
>> +
>> +@item @code{pid-file} (default: @code{"/var/run/rsyncd.pid"})
>> +Name of the file where @command{rsync} writes its PID.
>> +
>> +@item @code{lock-file} (default: @code{"/var/run/rsyncd.lock"})
>> +Name of the file where @command{rsync} writes its lock file.
>> +
>> +@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
>> +Name of the file where @command{rsync} writes its log file.
>> +
>> +@item @code{use-choot?} (default: @var{#f})
>> +Whether to use chroot for @command{rsync} shared directory.
>> +
>> +@item @code{share-path} (default: @file{/srv/rsync})
>> +Location of the @command{rsync} shared directory.
>> +
>> +@item @code{share-comment} (default: @code{"Rsync share"})
>> +Comment of the @command{rsync} shared directory.
>> +
>> +@item @code{read-only?} (default: @var{#f})
>> +Read-write permissions to shared directory.
>> +
>> +@item @code{timeout} (default: @code{300})
>> +I/O timeout in seconds.
>> +
>> +@end table
>> +@end deftp
>> +
>>  @node Setuid Programs
>>  @subsection Setuid Programs
>>  
>> diff --git a/gnu/local.mk b/gnu/local.mk
>> index 724c6b675..fa514b278 100644
>> --- a/gnu/local.mk
>> +++ b/gnu/local.mk
>> @@ -444,6 +444,7 @@ GNU_SYSTEM_MODULES
>> =				\
>> %D%/services/shepherd.scm			\
>> %D%/services/herd.scm				\
>> %D%/services/pm.scm				\
>> +  %D%/services/rsync.scm			\
>>    %D%/services/sddm.scm				\
>>    %D%/services/spice.scm				\
>>    %D%/services/ssh.scm				\
>> diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
>> new file mode 100644
>> index 000000000..49c4cb7e2
>> --- /dev/null
>> +++ b/gnu/services/rsync.scm
>> @@ -0,0 +1,162 @@
>> +;;; GNU Guix --- Functional package management for GNU
>> +;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
>> +;;;
>> +;;; This file is part of GNU Guix.
>> +;;;
>> +;;; GNU Guix is free software; you can redistribute it and/or modify
>> it +;;; under the terms of the GNU General Public License as
>> published by +;;; the Free Software Foundation; either version 3 of
>> the License, or (at +;;; your option) any later version.
>> +;;;
>> +;;; GNU Guix is distributed in the hope that it will be useful, but
>> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
>> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +;;; GNU General Public License for more details.
>> +;;;
>> +;;; You should have received a copy of the GNU General Public License
>> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
>> +
>> +(define-module (gnu services rsync)
>> +  #:use-module (gnu services)
>> +  #:use-module (gnu services base)
>> +  #:use-module (gnu services shepherd)
>> +  #:use-module (gnu system shadow)
>> +  #:use-module (gnu packages rsync)
>> +  #:use-module (gnu packages admin)
>> +  #:use-module (guix records)
>> +  #:use-module (guix gexp)
>> +  #:use-module (srfi srfi-1)
>> +  #:use-module (srfi srfi-26)
>> +  #:use-module (ice-9 match)
>> +  #:export (rsync-configuration
>> +            rsync-configuration?
>> +            rsync-service-type))
>> +
>> +;;;
>> +;;; Rsync.
>> +;;;
>> +
>> +(define-record-type* <rsync-configuration>
>> +  rsync-configuration make-rsync-configuration
>> +  rsync-configuration?
>> +  ;; <package>
>> +  (package rsync-configuration-package
>> +           (default rsync))
>> +  ;; integer
>> +  (port-number rsync-configuration-port-number
>> +               (default 873))
>> +  ;; string
>> +  (pid-file rsync-configuration-pid-file
>> +            (default "/var/run/rsyncd.pid"))
>> +  ;; string
>> +  (lock-file rsync-configuration-lock-file
>> +             (default "/var/run/rsyncd.lock"))
>> +  ;; string
>> +  (log-file rsync-configuration-log-file
>> +            (default "/var/log/rsyncd.log"))
>> +  ;; Boolean
>> +  (use-chroot? rsync-configuration-use-chroot?
>> +               (default #f))
>> +  ;; string
>> +  (share-path rsync-configuration-share-path
>> +              (default "/srv/rsync"))
>> +  ;; string
>> +  (share-comment rsync-configuration-share-comment
>> +                 (default "Rsync share"))
>> +  ;; Boolean
>> +  (read-only? rsync-configuration-read-only?
>> +              (default #f))
>> +  ;; integer
>> +  (timeout rsync-configuration-timeout
>> +           (default 300)))
>> +
>> +(define %rsync-accounts
>> +  ;; User account and group for rsync.
>> +  (list (user-group (name "rsyncd") (system? #t))
>> +        (user-account
>> +         (name "rsyncd")
>> +         (system? #t)
>> +         (group "rsyncd")
>> +         (comment "rsyncd privilege separation user")
>> +         (home-directory "/var/run/rsyncd")
>> +         (shell #~(string-append #$shadow "/sbin/nologin")))))
>> +
>> +(define (rsync-activation config)
>> +  "Return the activation GEXP for CONFIG."
>> +  #~(begin
>> +      (use-modules (guix build utils))
>> +      (let ((share-directory #$(rsync-configuration-share-path
>> config))
>> +            (user (getpw "rsyncd")))
>> +        (and=> share-directory mkdir-p)
>> +        (chown share-directory
>> +               (passwd:uid user)
>> +               (group:gid user)))))
>> +
>> +(define (rsync-config-file config)
>> +  "Return the rsync configuration file corresponding to CONFIG."
>> +  (computed-file
>> +   "rsync.conf"
>> +   #~(begin
>> +       (call-with-output-file #$output
>> +         (lambda (port)
>> +           (display "# Generated by 'rsync-service'.\n" port)
>> +           (format port "pid file = ~a\n"
>> +                   #$(rsync-configuration-pid-file config))
>> +           (format port "lock file = ~a\n"
>> +                   #$(rsync-configuration-lock-file config))
>> +           (format port "log file = ~a\n"
>> +                   #$(rsync-configuration-log-file config))
>> +           (format port "port = ~a\n"
>> +                   #$(number->string
>> +                      (rsync-configuration-port-number config)))
>> +           (format port "use chroot = ~a\n"
>> +                   #$(if (rsync-configuration-use-chroot? config)
>> +                         "true" "false"))
>> +           (display "[files]\n" port)
>> +           (format port "path = ~a\n"
>> +                   #$(rsync-configuration-share-path config))
>> +           (format port "comment = ~a\n"
>> +                   #$(rsync-configuration-share-comment config))
>> +           (format port "read only = ~a\n"
>> +                   #$(if (rsync-configuration-read-only? config)
>> +                         "true" "false"))
>> +           (format port "timeout = ~a\n"
>> +                   #$(number->string
>> +                      (rsync-configuration-timeout config)))
>> +           #t)))))
>
> It might be neater here to use mixed-text-file here. It might look
> something like...
>
> (define (rsync-config-file config)
>   "Return the rsync configuration file corresponding to CONFIG."
>   (match config
>     (($ <rsync-configuration> package port-number pid-file lock-file
>                               log-file use-chroot? share-path
>                               share-comment read-only? timeout)
>      (mixed text-file "rsync.conf"
>       "# Generated by 'rsync-service'.\n"
>       "pid file = " pid-file "\n"
>       "lock file = " lock-file "\n"
>       "log file = " log-file "\n"
>       "port = " (number->string port-number) "\n"
>       "use chroot = " (if use-chroot? "true" "false") "\n"
>       "[files]\n"
>       "path = " share-path "\n"
>       "comment = " share-comment "\n"
>       "read only = " (if read-only? "true" "false") "\n"
>       "timeout = " (number->string timeout) "\n"))))
>      
>
> One thing I tried with the Tailon service, was to define a
> gexp-compiler for the record type representing the configuration file.
> One really big advantage in the case of Tailon is that it easily allows
> the use of a custom file, just by providing a different gexp.

So, this way you could provide your existing Tailon config as a file in
system declaration?  Nice.

> Here however, I can see that you are using some values from the
> configuration (the port-number, package and share-path), which don't
> make that possible. The use of the port-number and package could
> probably be elegantly separated out, but I can't figure out what could
> be done about the share path, and its use in the service activation.

I made rsync service inspired by openssh service.

* “package” is not really needs to be configurable.
* “port-number” needs.  It specifies will service be run by “root”.
* “share-path” needs to be configurable ofcourse.

>> +
>> +(define (rsync-shepherd-service config)
>> +  "Return a <shepherd-service> for rsync with CONFIG."
>> +
>> +  (define rsync-command
>> +    #~(list (string-append #$(rsync-configuration-package config)
>> "/bin/rsync")
>> +            "--daemon" "--config" #$(rsync-config-file config)))
>> +
>> +  (define pid-file
>> +    (rsync-configuration-pid-file config))
>> +
>> +  (define user
>> +    (let ((port (rsync-configuration-port-number config)))
>> +      (if (> port  1024)
>> +          "rsyncd"
>> +          "root")))
>> +
>> +  (list (shepherd-service
>> +         (provision '(rsync))
>> +         (documentation "Run rsync daemon.")
>> +         (start #~(make-forkexec-constructor #$rsync-command
>> +                                             #:pid-file #$pid-file
>> +                                             #:user #$user
>> +                                             #:group #$user))
>> +         (stop #~(make-kill-destructor)))))
>> +
>> +(define rsync-service-type
>> +  (service-type
>> +   (name 'rsync)
>> +   (extensions
>> +    (list (service-extension shepherd-root-service-type
>> +                             rsync-shepherd-service)
>> +          (service-extension account-service-type
>> +                             (const %rsync-accounts))
>> +          (service-extension activation-service-type
>> +                             rsync-activation)))))
>
> As I understand it, the service might not use the rsyncd user, if it is
> configured to bind to a low port? If that is the case, then it might be
> neater to include a check for this in the account-service-type
> extension, so that these only get created if they are needed?

Yes, if port lower than 1024 only “root” can bind.

I though about it.  I will try to emplement it.


Thanks!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-07-29 11:03   ` Oleg Pykhalov
@ 2017-07-29 11:55     ` Christopher Baines
  2017-08-03 15:20       ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-07-29 11:55 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 4703 bytes --]

On Sat, 29 Jul 2017 14:03:49 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> >> +@deffn {Scheme Variable} rsync-service-type
> >> +This is the type for the @uref{https://rsync.samba.org} rsync
> >> daemon, +@command{rsync-configuration} record as in this example:
> >> +
> >> +@example
> >> +(service rsync-service-type
> >> +         (rsync-configuration))
> >> +@end example
> >> +
> >> +See below for details about @code{rsync-configuration}.
> >> +@end deffn
> >> +
> >> +@deftp {Data Type} rsync-configuration
> >> +Data type representing the configuration for @code{rsync-service}.
> >> +
> >> +@table @asis
> >> +@item @code{package} (default: @var{rsync})
> >> +Package object of the Rsync utility for efficiently transferring
> >> and +synchronizing files.  
> >
> > Object doesn't really fit here, if anything its a record. Also, I
> > don't think this needs a description of what rsync does, it's
> > probably clearest to just say that this is the rsync package?  
> 
> OK, is it good?
> 
>     @code{rsync} package to use.

Yep, in my opinion, that is the right amount of information.

> >> +(define (rsync-config-file config)
> >> +  "Return the rsync configuration file corresponding to CONFIG."
> >> +  (computed-file
> >> +   "rsync.conf"
> >> +   #~(begin
> >> +       (call-with-output-file #$output
> >> +         (lambda (port)
> >> +           (display "# Generated by 'rsync-service'.\n" port)
> >> +           (format port "pid file = ~a\n"
> >> +                   #$(rsync-configuration-pid-file config))
> >> +           (format port "lock file = ~a\n"
> >> +                   #$(rsync-configuration-lock-file config))
> >> +           (format port "log file = ~a\n"
> >> +                   #$(rsync-configuration-log-file config))
> >> +           (format port "port = ~a\n"
> >> +                   #$(number->string
> >> +                      (rsync-configuration-port-number config)))
> >> +           (format port "use chroot = ~a\n"
> >> +                   #$(if (rsync-configuration-use-chroot? config)
> >> +                         "true" "false"))
> >> +           (display "[files]\n" port)
> >> +           (format port "path = ~a\n"
> >> +                   #$(rsync-configuration-share-path config))
> >> +           (format port "comment = ~a\n"
> >> +                   #$(rsync-configuration-share-comment config))
> >> +           (format port "read only = ~a\n"
> >> +                   #$(if (rsync-configuration-read-only? config)
> >> +                         "true" "false"))
> >> +           (format port "timeout = ~a\n"
> >> +                   #$(number->string
> >> +                      (rsync-configuration-timeout config)))
> >> +           #t)))))  
> >
> > It might be neater here to use mixed-text-file here. It might look
> > something like...
> >
> > (define (rsync-config-file config)
> >   "Return the rsync configuration file corresponding to CONFIG."
> >   (match config
> >     (($ <rsync-configuration> package port-number pid-file lock-file
> >                               log-file use-chroot? share-path
> >                               share-comment read-only? timeout)
> >      (mixed text-file "rsync.conf"
> >       "# Generated by 'rsync-service'.\n"
> >       "pid file = " pid-file "\n"
> >       "lock file = " lock-file "\n"
> >       "log file = " log-file "\n"
> >       "port = " (number->string port-number) "\n"
> >       "use chroot = " (if use-chroot? "true" "false") "\n"
> >       "[files]\n"
> >       "path = " share-path "\n"
> >       "comment = " share-comment "\n"
> >       "read only = " (if read-only? "true" "false") "\n"
> >       "timeout = " (number->string timeout) "\n"))))
> >      
> >
> > One thing I tried with the Tailon service, was to define a
> > gexp-compiler for the record type representing the configuration
> > file. One really big advantage in the case of Tailon is that it
> > easily allows the use of a custom file, just by providing a
> > different gexp.  
> 
> So, this way you could provide your existing Tailon config as a file
> in system declaration?  Nice.

Yep, I think something like the following should just work, but I
haven't tested it yet.

  (service tailon-service-type
           (tailon-configuration
             (config-file (local-file "../tailon.yml"))))

I bring this up, as I think it is great if this is a feature of all
services, I'm having trouble though working out how you might do that
in this case, with the use of values in the activation service
extension. I can see complicated approaches, but nothing simple and
clear enough.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-07-29 11:55     ` Christopher Baines
@ 2017-08-03 15:20       ` Oleg Pykhalov
  2017-08-03 15:29         ` Oleg Pykhalov
  2017-08-03 15:33         ` Christopher Baines
  0 siblings, 2 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-03 15:20 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 4907 bytes --]

Hello Christopher,

Christopher Baines <mail@cbaines.net> writes:

> On Sat, 29 Jul 2017 14:03:49 +0300
> Oleg Pykhalov <go.wigust@gmail.com> wrote:
>
>> >> +@deffn {Scheme Variable} rsync-service-type
>> >> +This is the type for the @uref{https://rsync.samba.org} rsync
>> >> daemon, +@command{rsync-configuration} record as in this example:
>> >> +
>> >> +@example
>> >> +(service rsync-service-type
>> >> +         (rsync-configuration))
>> >> +@end example
>> >> +
>> >> +See below for details about @code{rsync-configuration}.
>> >> +@end deffn
>> >> +
>> >> +@deftp {Data Type} rsync-configuration
>> >> +Data type representing the configuration for @code{rsync-service}.
>> >> +
>> >> +@table @asis
>> >> +@item @code{package} (default: @var{rsync})
>> >> +Package object of the Rsync utility for efficiently transferring
>> >> and +synchronizing files.  
>> >
>> > Object doesn't really fit here, if anything its a record. Also, I
>> > don't think this needs a description of what rsync does, it's
>> > probably clearest to just say that this is the rsync package?  
>> 
>> OK, is it good?
>> 
>>     @code{rsync} package to use.
>
> Yep, in my opinion, that is the right amount of information.
>
>> >> +(define (rsync-config-file config)
>> >> +  "Return the rsync configuration file corresponding to CONFIG."
>> >> +  (computed-file
>> >> +   "rsync.conf"
>> >> +   #~(begin
>> >> +       (call-with-output-file #$output
>> >> +         (lambda (port)
>> >> +           (display "# Generated by 'rsync-service'.\n" port)
>> >> +           (format port "pid file = ~a\n"
>> >> +                   #$(rsync-configuration-pid-file config))
>> >> +           (format port "lock file = ~a\n"
>> >> +                   #$(rsync-configuration-lock-file config))
>> >> +           (format port "log file = ~a\n"
>> >> +                   #$(rsync-configuration-log-file config))
>> >> +           (format port "port = ~a\n"
>> >> +                   #$(number->string
>> >> +                      (rsync-configuration-port-number config)))
>> >> +           (format port "use chroot = ~a\n"
>> >> +                   #$(if (rsync-configuration-use-chroot? config)
>> >> +                         "true" "false"))
>> >> +           (display "[files]\n" port)
>> >> +           (format port "path = ~a\n"
>> >> +                   #$(rsync-configuration-share-path config))
>> >> +           (format port "comment = ~a\n"
>> >> +                   #$(rsync-configuration-share-comment config))
>> >> +           (format port "read only = ~a\n"
>> >> +                   #$(if (rsync-configuration-read-only? config)
>> >> +                         "true" "false"))
>> >> +           (format port "timeout = ~a\n"
>> >> +                   #$(number->string
>> >> +                      (rsync-configuration-timeout config)))
>> >> +           #t)))))  
>> >
>> > It might be neater here to use mixed-text-file here. It might look
>> > something like...
>> >
>> > (define (rsync-config-file config)
>> >   "Return the rsync configuration file corresponding to CONFIG."
>> >   (match config
>> >     (($ <rsync-configuration> package port-number pid-file lock-file
>> >                               log-file use-chroot? share-path
>> >                               share-comment read-only? timeout)
>> >      (mixed text-file "rsync.conf"
>> >       "# Generated by 'rsync-service'.\n"
>> >       "pid file = " pid-file "\n"
>> >       "lock file = " lock-file "\n"
>> >       "log file = " log-file "\n"
>> >       "port = " (number->string port-number) "\n"
>> >       "use chroot = " (if use-chroot? "true" "false") "\n"
>> >       "[files]\n"
>> >       "path = " share-path "\n"
>> >       "comment = " share-comment "\n"
>> >       "read only = " (if read-only? "true" "false") "\n"
>> >       "timeout = " (number->string timeout) "\n"))))

OK, patched.

>> > One thing I tried with the Tailon service, was to define a
>> > gexp-compiler for the record type representing the configuration
>> > file. One really big advantage in the case of Tailon is that it
>> > easily allows the use of a custom file, just by providing a
>> > different gexp.  
>> 
>> So, this way you could provide your existing Tailon config as a file
>> in system declaration?  Nice.
>
> Yep, I think something like the following should just work, but I
> haven't tested it yet.
>
>   (service tailon-service-type
>            (tailon-configuration
>              (config-file (local-file "../tailon.yml"))))
>
> I bring this up, as I think it is great if this is a feature of all
> services, I'm having trouble though working out how you might do that
> in this case, with the use of values in the activation service
> extension. I can see complicated approaches, but nothing simple and
> clear enough.

I tried to apply your work in tailon service, but I have troubles as you
described.  So I just cleaned up code little bit.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] services: rsync: Clean up code. --]
[-- Type: text/x-patch, Size: 9014 bytes --]

From 2cbbf8a9bf36edb153e04445bb8d52cd056d2767 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 3 Aug 2017 18:12:48 +0300
Subject: [PATCH] services: rsync: Clean up code.

* gnu/services/rsync.scm: Clean up.
---
 gnu/services/rsync.scm | 175 +++++++++++++++++++++----------------------------
 1 file changed, 75 insertions(+), 100 deletions(-)

diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index 9cf2bc89a..e1a014a63 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -32,61 +32,59 @@
             rsync-configuration?
             rsync-service-type))
 
+;;;; Commentary:
 ;;;
-;;; Rsync.
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
 ;;;
+;;;; Code:
 
 (define-record-type* <rsync-configuration>
   rsync-configuration make-rsync-configuration
   rsync-configuration?
-  ;; <package>
-  (package rsync-configuration-package
-           (default rsync))
-  ;; integer
-  (port-number rsync-configuration-port-number
-               (default 873))
-  ;; string
-  (pid-file rsync-configuration-pid-file
-            (default "/var/run/rsyncd.pid"))
-  ;; string
-  (lock-file rsync-configuration-lock-file
-             (default "/var/run/rsyncd.lock"))
-  ;; string
-  (log-file rsync-configuration-log-file
-            (default "/var/log/rsyncd.log"))
-  ;; Boolean
-  (use-chroot? rsync-configuration-use-chroot?
-               (default #f))
-  ;; string
-  (share-path rsync-configuration-share-path
-              (default "/srv/rsync"))
-  ;; string
-  (share-comment rsync-configuration-share-comment
+  (package       rsync-configuration-package ;package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number ;integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file ;string
+                 (default "/var/run/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file ;string
+                 (default "/var/run/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file ;string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot? ;boolean
+                 (default #f))
+  (share-path    rsync-configuration-share-path ;string
+                 (default "/srv/rsync"))
+  (share-comment rsync-configuration-share-comment ;string
                  (default "Rsync share"))
-  ;; Boolean
-  (read-only? rsync-configuration-read-only?
-              (default #f))
-  ;; integer
-  (timeout rsync-configuration-timeout
-           (default 300)))
+  (read-only?    rsync-configuration-read-only? ;boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout ;integer
+                 (default 300))
+  (user          rsync-configuration-user ;string
+                 (default "rsyncd"))
+  (group         rsync-configuration-group ;string
+                 (default "rsyncd")))
 
-(define %rsync-accounts
-  ;; User account and group for rsync.
-  (list (user-group (name "rsyncd") (system? #t))
-        (user-account
-         (name "rsyncd")
-         (system? #t)
-         (group "rsyncd")
-         (comment "rsyncd privilege separation user")
-         (home-directory "/var/run/rsyncd")
-         (shell #~(string-append #$shadow "/sbin/nologin")))))
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (rsync-configuration-user config)))
+    (list (user-group (name "rsyncd") (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-user)
+           (comment "rsyncd privilege separation user")
+           (home-directory "/var/run/rsyncd")
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
 
 (define (rsync-activation config)
   "Return the activation GEXP for CONFIG."
   #~(begin
       (use-modules (guix build utils))
       (let ((share-directory #$(rsync-configuration-share-path config))
-            (user (getpw "rsyncd")))
+            (user (getpw #$(rsync-configuration-user config))))
         (and=> share-directory mkdir-p)
         (chown share-directory
                (passwd:uid user)
@@ -94,70 +92,47 @@
 
 (define (rsync-config-file config)
   "Return the rsync configuration file corresponding to CONFIG."
-  (computed-file
-   "rsync.conf"
-   #~(begin
-       (call-with-output-file #$output
-         (lambda (port)
-           (display "# Generated by 'rsync-service'.\n" port)
-           (format port "pid file = ~a\n"
-                   #$(rsync-configuration-pid-file config))
-           (format port "lock file = ~a\n"
-                   #$(rsync-configuration-lock-file config))
-           (format port "log file = ~a\n"
-                   #$(rsync-configuration-log-file config))
-           (format port "port = ~a\n"
-                   #$(number->string
-                      (rsync-configuration-port-number config)))
-           (format port "use chroot = ~a\n"
-                   #$(if (rsync-configuration-use-chroot? config)
-                         "true" "false"))
-           (display "gid = rsyncd\n" port)
-           (display "[files]\n" port)
-           (format port "path = ~a\n"
-                   #$(rsync-configuration-share-path config))
-           (format port "comment = ~a\n"
-                   #$(rsync-configuration-share-comment config))
-           (format port "read only = ~a\n"
-                   #$(if (rsync-configuration-read-only? config)
-                         "true" "false"))
-           (format port "timeout = ~a\n"
-                   #$(number->string
-                      (rsync-configuration-timeout config)))
-           #t)))))
+  (match config
+    (($ <rsync-configuration> package port-number pid-file
+                              lock-file log-file use-chroot? share-path
+                              share-comment read-only? timeout user group)
+     (mixed-text-file "rsync.conf"
+                      "# Generated by 'rsync-service'.\n"
+                      "pid file = " pid-file "\n"
+                      "lock file = " lock-file "\n"
+                      "log file = " log-file "\n"
+                      "port = " (number->string port-number) "\n"
+                      "use chroot = " (if use-chroot? "true" "false") "\n"
+                      "gid = " group "\n"
+                      "[files]\n"
+                      "path = " share-path "\n"
+                      "comment = " share-comment "\n"
+                      "read only = " (if read-only? "true" "false") "\n"
+                      "timeout = " (number->string timeout) "\n"))))
 
 (define (rsync-shepherd-service config)
   "Return a <shepherd-service> for rsync with CONFIG."
-
-  (define rsync-command
-    #~(list (string-append #$(rsync-configuration-package config) "/bin/rsync")
-            "--daemon" "--config" #$(rsync-config-file config)))
-
-  (define pid-file
-    (rsync-configuration-pid-file config))
-
-  (define user
-    (let ((port (rsync-configuration-port-number config)))
-      (if (> port  1024)
-          "rsyncd"
-          "root")))
-
-  (list (shepherd-service
-         (provision '(rsync))
-         (documentation "Run rsync daemon.")
-         (start #~(make-forkexec-constructor #$rsync-command
-                                             #:pid-file #$pid-file
-                                             #:user #$user
-                                             #:group #$user))
-         (stop #~(make-kill-destructor)))))
+  (let* ((rsync (rsync-configuration-package config))
+         (pid-file (rsync-configuration-pid-file config))
+         (port (rsync-configuration-port-number config))
+         (user (if (> port  1024) (rsync-configuration-user config) "root")))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$user))
+           (stop #~(make-kill-destructor))))))
 
 (define rsync-service-type
   (service-type
    (name 'rsync)
    (extensions
-    (list (service-extension shepherd-root-service-type
-                             rsync-shepherd-service)
-          (service-extension account-service-type
-                             (const %rsync-accounts))
-          (service-extension activation-service-type
-                             rsync-activation)))))
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-03 15:20       ` Oleg Pykhalov
@ 2017-08-03 15:29         ` Oleg Pykhalov
  2017-08-03 15:33         ` Christopher Baines
  1 sibling, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-03 15:29 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

And I probably need to add this patch too.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add group --]
[-- Type: text/x-patch, Size: 2615 bytes --]

From 468ebe35b2a2c75752661d1591d9e7f387aff83e Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 3 Aug 2017 18:28:03 +0300
Subject: [PATCH] services: rsync: Clean up code.

* gnu/services/rsync.scm: Clean up.
---
 gnu/services/rsync.scm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index e1a014a63..0612a0ea6 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -69,12 +69,13 @@
 
 (define (rsync-account config)
   "Return the user accounts and user groups for CONFIG."
-  (let ((rsync-user (rsync-configuration-user config)))
+  (let ((rsync-user (rsync-configuration-user config))
+        (rsync-group (rsync-configuration-group config)))
     (list (user-group (name "rsyncd") (system? #t))
           (user-account
            (name rsync-user)
            (system? #t)
-           (group rsync-user)
+           (group rsync-group)
            (comment "rsyncd privilege separation user")
            (home-directory "/var/run/rsyncd")
            (shell #~(string-append #$shadow "/sbin/nologin"))))))
@@ -84,11 +85,12 @@
   #~(begin
       (use-modules (guix build utils))
       (let ((share-directory #$(rsync-configuration-share-path config))
-            (user (getpw #$(rsync-configuration-user config))))
+            (user (getpw #$(rsync-configuration-user config)))
+            (group (getpw #$(rsync-configuration-group config))))
         (and=> share-directory mkdir-p)
         (chown share-directory
                (passwd:uid user)
-               (group:gid user)))))
+               (group:gid group)))))
 
 (define (rsync-config-file config)
   "Return the rsync configuration file corresponding to CONFIG."
@@ -115,7 +117,8 @@
   (let* ((rsync (rsync-configuration-package config))
          (pid-file (rsync-configuration-pid-file config))
          (port (rsync-configuration-port-number config))
-         (user (if (> port  1024) (rsync-configuration-user config) "root")))
+         (user (if (> port  1024) (rsync-configuration-user config) "root"))
+         (group (if (> port  1024) (rsync-configuration-group config) "root")))
     (list (shepherd-service
            (provision '(rsync))
            (documentation "Run rsync daemon.")
@@ -125,7 +128,7 @@
                            "--daemon")
                      #:pid-file #$pid-file
                      #:user #$user
-                     #:group #$user))
+                     #:group #$group))
            (stop #~(make-kill-destructor))))))
 
 (define rsync-service-type
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-03 15:20       ` Oleg Pykhalov
  2017-08-03 15:29         ` Oleg Pykhalov
@ 2017-08-03 15:33         ` Christopher Baines
  2017-08-03 16:20           ` Oleg Pykhalov
  1 sibling, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-03 15:33 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 5509 bytes --]

On Thu, 03 Aug 2017 18:20:31 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Hello Christopher,
> 
> Christopher Baines <mail@cbaines.net> writes:
> 
> > On Sat, 29 Jul 2017 14:03:49 +0300
> > Oleg Pykhalov <go.wigust@gmail.com> wrote:
> >  
> >> >> +@deffn {Scheme Variable} rsync-service-type
> >> >> +This is the type for the @uref{https://rsync.samba.org} rsync
> >> >> daemon, +@command{rsync-configuration} record as in this
> >> >> example: +
> >> >> +@example
> >> >> +(service rsync-service-type
> >> >> +         (rsync-configuration))
> >> >> +@end example
> >> >> +
> >> >> +See below for details about @code{rsync-configuration}.
> >> >> +@end deffn
> >> >> +
> >> >> +@deftp {Data Type} rsync-configuration
> >> >> +Data type representing the configuration for
> >> >> @code{rsync-service}. +
> >> >> +@table @asis
> >> >> +@item @code{package} (default: @var{rsync})
> >> >> +Package object of the Rsync utility for efficiently
> >> >> transferring and +synchronizing files.    
> >> >
> >> > Object doesn't really fit here, if anything its a record. Also, I
> >> > don't think this needs a description of what rsync does, it's
> >> > probably clearest to just say that this is the rsync package?    
> >> 
> >> OK, is it good?
> >> 
> >>     @code{rsync} package to use.  
> >
> > Yep, in my opinion, that is the right amount of information.
> >  
> >> >> +(define (rsync-config-file config)
> >> >> +  "Return the rsync configuration file corresponding to
> >> >> CONFIG."
> >> >> +  (computed-file
> >> >> +   "rsync.conf"
> >> >> +   #~(begin
> >> >> +       (call-with-output-file #$output
> >> >> +         (lambda (port)
> >> >> +           (display "# Generated by 'rsync-service'.\n" port)
> >> >> +           (format port "pid file = ~a\n"
> >> >> +                   #$(rsync-configuration-pid-file config))
> >> >> +           (format port "lock file = ~a\n"
> >> >> +                   #$(rsync-configuration-lock-file config))
> >> >> +           (format port "log file = ~a\n"
> >> >> +                   #$(rsync-configuration-log-file config))
> >> >> +           (format port "port = ~a\n"
> >> >> +                   #$(number->string
> >> >> +                      (rsync-configuration-port-number
> >> >> config)))
> >> >> +           (format port "use chroot = ~a\n"
> >> >> +                   #$(if (rsync-configuration-use-chroot?
> >> >> config)
> >> >> +                         "true" "false"))
> >> >> +           (display "[files]\n" port)
> >> >> +           (format port "path = ~a\n"
> >> >> +                   #$(rsync-configuration-share-path config))
> >> >> +           (format port "comment = ~a\n"
> >> >> +                   #$(rsync-configuration-share-comment
> >> >> config))
> >> >> +           (format port "read only = ~a\n"
> >> >> +                   #$(if (rsync-configuration-read-only?
> >> >> config)
> >> >> +                         "true" "false"))
> >> >> +           (format port "timeout = ~a\n"
> >> >> +                   #$(number->string
> >> >> +                      (rsync-configuration-timeout config)))
> >> >> +           #t)))))    
> >> >
> >> > It might be neater here to use mixed-text-file here. It might
> >> > look something like...
> >> >
> >> > (define (rsync-config-file config)
> >> >   "Return the rsync configuration file corresponding to CONFIG."
> >> >   (match config
> >> >     (($ <rsync-configuration> package port-number pid-file
> >> > lock-file log-file use-chroot? share-path
> >> >                               share-comment read-only? timeout)
> >> >      (mixed text-file "rsync.conf"
> >> >       "# Generated by 'rsync-service'.\n"
> >> >       "pid file = " pid-file "\n"
> >> >       "lock file = " lock-file "\n"
> >> >       "log file = " log-file "\n"
> >> >       "port = " (number->string port-number) "\n"
> >> >       "use chroot = " (if use-chroot? "true" "false") "\n"
> >> >       "[files]\n"
> >> >       "path = " share-path "\n"
> >> >       "comment = " share-comment "\n"
> >> >       "read only = " (if read-only? "true" "false") "\n"
> >> >       "timeout = " (number->string timeout) "\n"))))  
> 
> OK, patched.
> 
> >> > One thing I tried with the Tailon service, was to define a
> >> > gexp-compiler for the record type representing the configuration
> >> > file. One really big advantage in the case of Tailon is that it
> >> > easily allows the use of a custom file, just by providing a
> >> > different gexp.    
> >> 
> >> So, this way you could provide your existing Tailon config as a
> >> file in system declaration?  Nice.  
> >
> > Yep, I think something like the following should just work, but I
> > haven't tested it yet.
> >
> >   (service tailon-service-type
> >            (tailon-configuration
> >              (config-file (local-file "../tailon.yml"))))
> >
> > I bring this up, as I think it is great if this is a feature of all
> > services, I'm having trouble though working out how you might do
> > that in this case, with the use of values in the activation service
> > extension. I can see complicated approaches, but nothing simple and
> > clear enough.  
> 
> I tried to apply your work in tailon service, but I have troubles as
> you described.  So I just cleaned up code little bit.

Those changes are looking good :) Could you send the overall patch, as
that makes it easier at least for me to review and test?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-03 15:33         ` Christopher Baines
@ 2017-08-03 16:20           ` Oleg Pykhalov
  2017-08-03 16:34             ` Oleg Pykhalov
  2017-08-10  7:18             ` Christopher Baines
  0 siblings, 2 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-03 16:20 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 9884 bytes --]

From 1ca5dab9f0a05205a85cc78d9a099bbe991ce884 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
---
 doc/guix.texi          |  67 +++++++++++++++++++++++
 gnu/local.mk           |   1 +
 gnu/services/rsync.scm | 140 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 208 insertions(+)
 create mode 100644 gnu/services/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index cda131557..cb5b59615 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16528,6 +16528,73 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection File transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-choot?} (default: @var{#f})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @code{"rsyncd"})
+Privilege separation user.
+
+@item @code{group} (default: @code{"rsyncd"})
+Privilege separation group.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index f48e6638b..bc445b731 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -445,6 +445,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..b5ba68291
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,140 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package ;package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number ;integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file ;string
+                 (default "/var/run/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file ;string
+                 (default "/var/run/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file ;string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot? ;boolean
+                 (default #f))
+  (share-path    rsync-configuration-share-path ;string
+                 (default "/srv/rsync"))
+  (share-comment rsync-configuration-share-comment ;string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only? ;boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout ;integer
+                 (default 300))
+  (user          rsync-configuration-user ;string
+                 (default "rsyncd"))
+  (group         rsync-configuration-group ;string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (rsync-configuration-user config))
+        (rsync-group (rsync-configuration-group config)))
+    (list (user-group (name "rsyncd") (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory "/var/run/rsyncd")
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-path #$(rsync-configuration-share-path config))
+            (user (getpw #$(rsync-configuration-user config)))
+            (group (getpw #$(rsync-configuration-group config))))
+        (and=> share-path mkdir-p)
+        (chown share-path
+               (passwd:uid user)
+               (group:gid group)))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (match config
+    (($ <rsync-configuration> package port-number pid-file
+                              lock-file log-file use-chroot? share-path
+                              share-comment read-only? timeout user group)
+     (mixed-text-file "rsync.conf"
+                      "pid file = " pid-file "\n"
+                      "lock file = " lock-file "\n"
+                      "log file = " log-file "\n"
+                      "port = " (number->string port-number) "\n"
+                      "use chroot = " (if use-chroot? "true" "false") "\n"
+                      "gid = " group "\n"
+                      "[files]\n"
+                      "path = " share-path "\n"
+                      "comment = " share-comment "\n"
+                      "read only = " (if read-only? "true" "false") "\n"
+                      "timeout = " (number->string timeout) "\n"))))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (let* ((rsync (rsync-configuration-package config))
+         (pid-file (rsync-configuration-pid-file config))
+         (port (rsync-configuration-port-number config))
+         (user (if (> port  1024) (rsync-configuration-user config) "root"))
+         (group (if (> port  1024) (rsync-configuration-group config) "root")))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$group))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-03 16:20           ` Oleg Pykhalov
@ 2017-08-03 16:34             ` Oleg Pykhalov
  2017-08-10  7:18             ` Christopher Baines
  1 sibling, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-03 16:34 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Sorry, I forget to change commit message in “* doc/guix.texi”.

It must be:
* doc/guix.texi (File transfer): Add documentation.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-03 16:20           ` Oleg Pykhalov
  2017-08-03 16:34             ` Oleg Pykhalov
@ 2017-08-10  7:18             ` Christopher Baines
  2017-08-10 18:21               ` Christopher Baines
  1 sibling, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-10  7:18 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855


[-- Attachment #1.1: Type: text/plain, Size: 11105 bytes --]

On Thu, 03 Aug 2017 19:20:08 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> From 1ca5dab9f0a05205a85cc78d9a099bbe991ce884 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Thu, 27 Jul 2017 04:01:01 +0300
> Subject: [PATCH] gnu: Add rsync service.
> 
> * doc/guix.texi (Incremental file transfer): Add documentation.
> * gnu/services/rsync.scm (<rsync-configuration>): New record type.
> (rsync-accounts, rsync-shepherd-service): New service extensions.
> (rsync-service-type): New service type.
> ---
>  doc/guix.texi          |  67 +++++++++++++++++++++++
>  gnu/local.mk           |   1 +
>  gnu/services/rsync.scm | 140
> +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed,
> 208 insertions(+) create mode 100644 gnu/services/rsync.scm

I've got as far as successfully trying this out in a VM now. I had to
make one change that I'll note below.

> diff --git a/doc/guix.texi b/doc/guix.texi
> index cda131557..cb5b59615 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -16528,6 +16528,73 @@ Extra options will be passed to @code{git
> daemon}, please run @end table
>  @end deftp
>  
> +@subsubsection File transfer
> +
> +The @code{(gnu services rsync)} module provides the following
> services: +
> +@subsubheading Rsync service
> +
> +You might want an rsync daemon if you have files that you want
> available +so anyone (or just yourself) can download existing files
> or upload new +files.
> +
> +@deffn {Scheme Variable} rsync-service-type
> +This is the type for the @uref{https://rsync.samba.org} rsync daemon,
> +@command{rsync-configuration} record as in this example:
> +
> +@example
> +(service rsync-service-type
> +         (rsync-configuration))
> +@end example
> +
> +See below for details about @code{rsync-configuration}.
> +@end deffn
> +
> +@deftp {Data Type} rsync-configuration
> +Data type representing the configuration for @code{rsync-service}.
> +
> +@table @asis
> +@item @code{package} (default: @var{rsync})
> +@code{rsync} package to use.
> +
> +@item @code{port-number} (default: @code{873})
> +TCP port on which @command{rsync} listens for incoming connections.
> If +port is less than @code{1024} @command{rsync} will be started as
> the +@code{root} user and group.
> +
> +@item @code{pid-file} (default: @code{"/var/run/rsyncd.pid"})
> +Name of the file where @command{rsync} writes its PID.
> +
> +@item @code{lock-file} (default: @code{"/var/run/rsyncd.lock"})
> +Name of the file where @command{rsync} writes its lock file.
> +
> +@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
> +Name of the file where @command{rsync} writes its log file.
> +
> +@item @code{use-choot?} (default: @var{#f})
> +Whether to use chroot for @command{rsync} shared directory.
> +
> +@item @code{share-path} (default: @file{/srv/rsync})
> +Location of the @command{rsync} shared directory.
> +
> +@item @code{share-comment} (default: @code{"Rsync share"})
> +Comment of the @command{rsync} shared directory.
> +
> +@item @code{read-only?} (default: @var{#f})
> +Read-write permissions to shared directory.
> +
> +@item @code{timeout} (default: @code{300})
> +I/O timeout in seconds.
> +
> +@item @code{user} (default: @code{"rsyncd"})
> +Privilege separation user.
> +
> +@item @code{group} (default: @code{"rsyncd"})
> +Privilege separation group.
> +
> +@end table
> +@end deftp
> +
>  @node Setuid Programs
>  @subsection Setuid Programs
>  
> diff --git a/gnu/local.mk b/gnu/local.mk
> index f48e6638b..bc445b731 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -445,6 +445,7 @@ GNU_SYSTEM_MODULES
> =				\
> %D%/services/shepherd.scm			\
> %D%/services/herd.scm				\
> %D%/services/pm.scm				\
> +  %D%/services/rsync.scm			\
>    %D%/services/sddm.scm				\
>    %D%/services/spice.scm				\
>    %D%/services/ssh.scm				\
> diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
> new file mode 100644
> index 000000000..b5ba68291
> --- /dev/null
> +++ b/gnu/services/rsync.scm
> @@ -0,0 +1,140 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it +;;; under the terms of the GNU General Public License as
> published by +;;; the Free Software Foundation; either version 3 of
> the License, or (at +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu services rsync)
> +  #:use-module (gnu services)
> +  #:use-module (gnu services base)
> +  #:use-module (gnu services shepherd)
> +  #:use-module (gnu system shadow)
> +  #:use-module (gnu packages rsync)
> +  #:use-module (gnu packages admin)
> +  #:use-module (guix records)
> +  #:use-module (guix gexp)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:use-module (ice-9 match)
> +  #:export (rsync-configuration
> +            rsync-configuration?
> +            rsync-service-type))
> +
> +;;;; Commentary:
> +;;;
> +;;; This module implements a service that to run instance of Rsync,
> +;;; files synchronization tool.
> +;;;
> +;;;; Code:
> +
> +(define-record-type* <rsync-configuration>
> +  rsync-configuration make-rsync-configuration
> +  rsync-configuration?
> +  (package       rsync-configuration-package ;package
> +                 (default rsync))
> +  (port-number   rsync-configuration-port-number ;integer
> +                 (default 873))
> +  (pid-file      rsync-configuration-pid-file ;string
> +                 (default "/var/run/rsyncd.pid"))
> +  (lock-file     rsync-configuration-lock-file ;string
> +                 (default "/var/run/rsyncd.lock"))
> +  (log-file      rsync-configuration-log-file ;string
> +                 (default "/var/log/rsyncd.log"))
> +  (use-chroot?   rsync-configuration-use-chroot? ;boolean
> +                 (default #f))
> +  (share-path    rsync-configuration-share-path ;string
> +                 (default "/srv/rsync"))
> +  (share-comment rsync-configuration-share-comment ;string
> +                 (default "Rsync share"))
> +  (read-only?    rsync-configuration-read-only? ;boolean
> +                 (default #f))
> +  (timeout       rsync-configuration-timeout ;integer
> +                 (default 300))
> +  (user          rsync-configuration-user ;string
> +                 (default "rsyncd"))
> +  (group         rsync-configuration-group ;string
> +                 (default "rsyncd")))
> +
> +(define (rsync-account config)
> +  "Return the user accounts and user groups for CONFIG."
> +  (let ((rsync-user (rsync-configuration-user config))
> +        (rsync-group (rsync-configuration-group config)))
> +    (list (user-group (name "rsyncd") (system? #t))
> +          (user-account
> +           (name rsync-user)
> +           (system? #t)
> +           (group rsync-group)
> +           (comment "rsyncd privilege separation user")
> +           (home-directory "/var/run/rsyncd")
> +           (shell #~(string-append #$shadow "/sbin/nologin"))))))
> +
> +(define (rsync-activation config)
> +  "Return the activation GEXP for CONFIG."
> +  #~(begin
> +      (use-modules (guix build utils))
> +      (let ((share-path #$(rsync-configuration-share-path config))
> +            (user (getpw #$(rsync-configuration-user config)))
> +            (group (getpw #$(rsync-configuration-group config))))
> +        (and=> share-path mkdir-p)
> +        (chown share-path
> +               (passwd:uid user)
> +               (group:gid group)))))
> +
> +(define (rsync-config-file config)
> +  "Return the rsync configuration file corresponding to CONFIG."
> +  (match config
> +    (($ <rsync-configuration> package port-number pid-file
> +                              lock-file log-file use-chroot?
> share-path
> +                              share-comment read-only? timeout user
> group)
> +     (mixed-text-file "rsync.conf"
> +                      "pid file = " pid-file "\n"
> +                      "lock file = " lock-file "\n"
> +                      "log file = " log-file "\n"
> +                      "port = " (number->string port-number) "\n"
> +                      "use chroot = " (if use-chroot? "true"
> "false") "\n"

I needed to add "uid = " user "\n" here, otherwise I got permission
issues when copying files to the share.

> +                      "gid = " group "\n"
> +                      "[files]\n"
> +                      "path = " share-path "\n"
> +                      "comment = " share-comment "\n"
> +                      "read only = " (if read-only? "true" "false")
> "\n"
> +                      "timeout = " (number->string timeout) "\n"))))
> +
> +(define (rsync-shepherd-service config)
> +  "Return a <shepherd-service> for rsync with CONFIG."
> +  (let* ((rsync (rsync-configuration-package config))
> +         (pid-file (rsync-configuration-pid-file config))
> +         (port (rsync-configuration-port-number config))
> +         (user (if (> port  1024) (rsync-configuration-user config)
> "root"))
> +         (group (if (> port  1024) (rsync-configuration-group
> config) "root")))
> +    (list (shepherd-service
> +           (provision '(rsync))
> +           (documentation "Run rsync daemon.")
> +           (start #~(make-forkexec-constructor
> +                     (list (string-append #$rsync "/bin/rsync")
> +                           "--config" #$(rsync-config-file config)
> +                           "--daemon")
> +                     #:pid-file #$pid-file
> +                     #:user #$user
> +                     #:group #$group))
> +           (stop #~(make-kill-destructor))))))
> +
> +(define rsync-service-type
> +  (service-type
> +   (name 'rsync)
> +   (extensions
> +    (list (service-extension shepherd-root-service-type
> rsync-shepherd-service)
> +          (service-extension account-service-type rsync-account)
> +          (service-extension activation-service-type
> rsync-activation)))
> +   (default-value (rsync-configuration))))

I've attached the beginnings of a system test for this. I haven't got
as far as actually testing the service directly yet, but I'm going to
try testing it, both when running as root, and when not running as
root.

A VM start script can be created from this rsync.scm file, by running:
  guix system vm gnu/tests/rsync.scm

Also, the test itself can be run by doing:
  make check-system TESTS=rsync

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-test.patch --]
[-- Type: text/x-patch, Size: 3934 bytes --]

From 88c54c9778e72a66741fe26627d6ed00f6efe773 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Tue, 8 Aug 2017 06:56:54 +0100
Subject: [PATCH] Add test

---
 gnu/tests/rsync.scm | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 gnu/tests/rsync.scm

diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..abd3ff15d
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,104 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync))
+
+(define %rsync-os
+  ;; Operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define* (run-rsync-test #:optional (port 8873))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     %rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings `((,port . 873)))))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette)
+                       (web uri)
+                       (web client)
+                       (web response))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; rsync foo localhost::files/
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             marionette))
+
+          ;; Make sure the PID file is created.
+          (test-assert "PID file"
+            (marionette-eval
+             '(file-exists? "/var/run/rsyncd.pid")
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define %test-rsync
+  (system-test
+   (name "rsync")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test))))
+
+%rsync-os
-- 
2.14.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-10  7:18             ` Christopher Baines
@ 2017-08-10 18:21               ` Christopher Baines
  2017-08-10 18:56                 ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-10 18:21 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855


[-- Attachment #1.1: Type: text/plain, Size: 1068 bytes --]

On Thu, 10 Aug 2017 08:18:20 +0100
Christopher Baines <mail@cbaines.net> wrote:

> I've attached the beginnings of a system test for this. I haven't got
> as far as actually testing the service directly yet, but I'm going to
> try testing it, both when running as root, and when not running as
> root.
> 
> A VM start script can be created from this rsync.scm file, by running:
>   guix system vm gnu/tests/rsync.scm
> 
> Also, the test itself can be run by doing:
>   make check-system TESTS=rsync

I've now got around to actually testing the service. I've attached a
patch which creates two system tests. One which tests the service with
the default port, and one with a higher port (I randomly picked 2000).

The default port test currently passes, but the higher port one
currently fails as the rsync service can't create the PID file.

One option to fix this would be to create a /var/run/rsync directory
which is owned by the rsyncd user, and then create the PID file
as /var/run/rsync/pid.

Just let me know if you have any questions?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-test.patch --]
[-- Type: text/x-patch, Size: 5368 bytes --]

From 7a1e62a9f6238706afcdf8ac92c699e63222fe18 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Tue, 8 Aug 2017 06:56:54 +0100
Subject: [PATCH] Add test

---
 gnu/tests/rsync.scm | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 gnu/tests/rsync.scm

diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..39f03a5c2
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,139 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync-with-default-port
+            %test-rsync-with-port-2000))
+
+(define* (run-rsync-test rsync-os)
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             marionette))
+
+          ;; Make sure the PID file is created.
+          (test-assert "PID file"
+            (marionette-eval
+             '(file-exists? "/var/run/rsyncd.pid")
+             marionette))
+
+          (test-assert "Test file copied to share"
+            (marionette-eval
+             '(begin
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input" "localhost::files/")))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync" "localhost::files/input" "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define %rsync-os-with-default-port
+  ;; Operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %rsync-os-with-port-2000
+  ;; Operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number 2000))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync-with-default-port
+  (system-test
+   (name "rsync-with-default-port")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test %rsync-os-with-default-port))))
+
+(define %test-rsync-with-port-2000
+  (system-test
+   (name "rsync-with-port-2000")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test %rsync-os-with-port-2000))))
-- 
2.14.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-10 18:21               ` Christopher Baines
@ 2017-08-10 18:56                 ` Oleg Pykhalov
  2017-08-11 19:28                   ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-10 18:56 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

Hello Christopher,

Thank you for supporting this patch!

Christopher Baines <mail@cbaines.net> writes:

> On Thu, 10 Aug 2017 08:18:20 +0100
> Christopher Baines <mail@cbaines.net> wrote:
>
>> I've attached the beginnings of a system test for this. I haven't got
>> as far as actually testing the service directly yet, but I'm going to
>> try testing it, both when running as root, and when not running as
>> root.
>> 
>> A VM start script can be created from this rsync.scm file, by running:
>>   guix system vm gnu/tests/rsync.scm
>> 
>> Also, the test itself can be run by doing:
>>   make check-system TESTS=rsync
>
> I've now got around to actually testing the service. I've attached a
> patch which creates two system tests. One which tests the service with
> the default port, and one with a higher port (I randomly picked 2000).
>
> The default port test currently passes, but the higher port one
> currently fails as the rsync service can't create the PID file.
>
> One option to fix this would be to create a /var/run/rsync directory
> which is owned by the rsyncd user, and then create the PID file
> as /var/run/rsync/pid.

I'll check it later, if you'll not be faster than me.  :-)

> Just let me know if you have any questions?
…

I successfully passed you previous patch test, but the new patch one
with two “ports” fails.


[-- Attachment #2: Tests log --]
[-- Type: text/plain, Size: 79414 bytes --]

natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system TESTS=rsync-with-default-port
Compiling Scheme modules...
;;; note: source file /home/natsu/src/guix/gnu/tests/rsync.scm
;;;       newer than compiled /home/natsu/.cache/guile/ccache/2.2-LE-8-3.A/home/natsu/src/guix/gnu/tests/rsync.scm.go
Running 1 system tests...
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
The following derivations will be built:
   /gnu/store/ar4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv
   /gnu/store/g3ziw8v8bbsx9wxr1jkcf5pvm9i3hpl3-run-vm.sh.drv
@ build-started /gnu/store/g3ziw8v8bbsx9wxr1jkcf5pvm9i3hpl3-run-vm.sh.drv - x86_64-linux /var/log/guix/drvs/g3//ziw8v8bbsx9wxr1jkcf5pvm9i3hpl3-run-vm.sh.drv.bz2
@ build-succeeded /gnu/store/g3ziw8v8bbsx9wxr1jkcf5pvm9i3hpl3-run-vm.sh.drv -
@ build-started /gnu/store/ar4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv - x86_64-linux /var/log/guix/drvs/ar//4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv.bz2
Warning: vlan 0 is not connected to host network
[    0.000000] Linux version 4.12.5-gnu (nixbld@) (gcc version 5.4.0 (GCC) ) #1 SMP 1
[    0.000000] Command line: console=ttyS0 --root=/dev/vda1 --system=/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system --load=/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system/boot
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000000ffddfff] usable
[    0.000000] BIOS-e820: [mem 0x000000000ffde000-0x000000000fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014
[    0.000000] Hypervisor detected: KVM
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] e820: last_pfn = 0xffde max_arch_pfn = 0x400000000
[    0.000000] x86/PAT: PAT not supported by CPU.
[    0.000000] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
[    0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [ffff8e86800f6a90]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] RAMDISK: [mem 0x0f94d000-0x0ffcffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F68A0 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x000000000FFE154E 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x000000000FFE142A 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x000000000FFE0040 0013EA (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x000000000FFE0000 000040
[    0.000000] ACPI: APIC 0x000000000FFE149E 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x000000000FFE1516 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000000ffddfff]
[    0.000000] NODE_DATA(0) allocated [mem 0x0ffda000-0x0ffddfff]
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:ffd6001, primary cpu clock
[    0.000000] kvm-clock: using sched offset of 143713184 cycles
[    0.000000] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000]   Normal   empty
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x000000000ffddfff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] e820: [mem 0x10000000-0xfeffbfff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] percpu: Embedded 39 pages/cpu @ffff8e868f600000 s118936 r8192 d32616 u2097152
[    0.000000] KVM setup async PF for cpu 0
[    0.000000] kvm-stealtime: cpu 0, msr f60d980
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 64359
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: console=ttyS0 --root=/dev/vda1 --system=/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system --load=/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system/boot
[    0.000000] PID hash table entries: 1024 (order: 1, 8192 bytes)
[    0.000000] Memory: 231720K/261616K available (8776K kernel code, 1480K rwdata, 3640K rodata, 1700K init, 1156K bss, 29896K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 35796 entries in 140 pages
[    0.004000] Hierarchical RCU implementation.
[    0.004000] 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[    0.004000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.004000] NR_IRQS:16640 nr_irqs:256 16
[    0.004000] Console: colour VGA+ 80x25
[    0.004000] console [ttyS0] enabled
[    0.004000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.004006] tsc: Detected 3392.294 MHz processor
[    0.004364] Calibrating delay loop (skipped) preset value.. 6784.58 BogoMIPS (lpj=13569176)
[    0.004586] pid_max: default: 32768 minimum: 301
[    0.004927] ACPI: Core revision 20170303
[    0.005701] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.006167] Security Framework initialized
[    0.006456] Yama: becoming mindful.
[    0.006722] AppArmor: AppArmor initialized
[    0.007040] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
[    0.007614] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.008134] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.008612] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.009249] CPU: Physical Processor ID: 0
[    0.009557] mce: CPU supports 10 MCE banks
[    0.009900] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.010286] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.016132] Freeing SMP alternatives memory: 32K
[    0.017354] smpboot: Max logical packages: 1
[    0.017774] x2apic enabled
[    0.018104] Switched APIC routing to physical x2apic.
[    0.019021] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.020000] smpboot: CPU0: Intel QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[    0.020000] Performance Events: PMU not available due to virtualization, using software events only.
[    0.020000] smp: Bringing up secondary CPUs ...
[    0.020000] smp: Brought up 1 node, 1 CPU
[    0.020000] smpboot: Total of 1 processors activated (6784.58 BogoMIPS)
[    0.020000] sched_clock: Marking stable (16000000, 0)->(82742337, -66742337)
[    0.128115] devtmpfs: initialized
[    0.128448] x86/mm: Memory block size: 128MB
[    0.130036] evm: security.selinux
[    0.130305] evm: security.SMACK64
[    0.130571] evm: security.SMACK64EXEC
[    0.130864] evm: security.SMACK64TRANSMUTE
[    0.131186] evm: security.SMACK64MMAP
[    0.131479] evm: security.ima
[    0.131732] evm: security.capability
[    0.132087] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.132860] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.133377] pinctrl core: initialized pinctrl subsystem
[    0.133907] RTC time: 18:48:09, date: 08/10/17
[    0.134338] NET: Registered protocol family 16
[    0.134804] cpuidle: using governor ladder
[    0.135139] cpuidle: using governor menu
[    0.135458] PCCT header not found.
[    0.135761] ACPI: bus type PCI registered
[    0.136095] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.136680] PCI: Using configuration type 1 for base access
[    0.137772] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.138392] ACPI: Added _OSI(Module Device)
[    0.138734] ACPI: Added _OSI(Processor Device)
[    0.139098] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.139482] ACPI: Added _OSI(Processor Aggregator Device)
[    0.141017] ACPI: Interpreter enabled
[    0.141338] ACPI: (supports S0 S3 S4 S5)
[    0.141659] ACPI: Using IOAPIC for interrupt routing
[    0.142074] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.144559] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.145086] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    0.145630] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.146197] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[    0.147320] acpiphp: Slot [3] registered
[    0.147671] acpiphp: Slot [4] registered
[    0.148030] acpiphp: Slot [5] registered
[    0.148379] acpiphp: Slot [6] registered
[    0.148717] acpiphp: Slot [7] registered
[    0.149051] acpiphp: Slot [8] registered
[    0.149388] acpiphp: Slot [9] registered
[    0.149725] acpiphp: Slot [10] registered
[    0.150063] acpiphp: Slot [11] registered
[    0.150401] acpiphp: Slot [12] registered
[    0.150860] acpiphp: Slot [13] registered
[    0.151187] acpiphp: Slot [14] registered
[    0.151503] acpiphp: Slot [15] registered
[    0.151833] acpiphp: Slot [16] registered
[    0.152176] acpiphp: Slot [17] registered
[    0.152522] acpiphp: Slot [18] registered
[    0.152866] acpiphp: Slot [19] registered
[    0.153210] acpiphp: Slot [20] registered
[    0.153553] acpiphp: Slot [21] registered
[    0.153891] acpiphp: Slot [22] registered
[    0.154235] acpiphp: Slot [23] registered
[    0.154579] acpiphp: Slot [24] registered
[    0.154920] acpiphp: Slot [25] registered
[    0.155265] acpiphp: Slot [26] registered
[    0.155618] acpiphp: Slot [27] registered
[    0.155962] acpiphp: Slot [28] registered
[    0.156310] acpiphp: Slot [29] registered
[    0.156651] acpiphp: Slot [30] registered
[    0.156990] acpiphp: Slot [31] registered
[    0.157318] PCI host bridge to bus 0000:00
[    0.157683] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.158263] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.158797] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.159364] pci_bus 0000:00: root bus resource [mem 0x10000000-0xfebfffff window]
[    0.159954] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.165809] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.166402] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.166934] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.167505] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.168456] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    0.169056] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    0.231360] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.231935] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.232412] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.232926] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.233363] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.233807] ACPI: Enabled 2 GPEs in block 00 to 0F
[    0.234253] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.234675] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.235355] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.235820] vgaarb: loaded
[    0.236180] SCSI subsystem initialized
[    0.236548] ACPI: bus type USB registered
[    0.236910] usbcore: registered new interface driver usbfs
[    0.237358] usbcore: registered new interface driver hub
[    0.237792] usbcore: registered new device driver usb
[    0.238653] EDAC MC: Ver: 3.0.0
[    0.239076] PCI: Using ACPI for IRQ routing
[    0.239606] NetLabel: Initializing
[    0.239904] NetLabel:  domain hash size = 128
[    0.240261] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.240730] NetLabel:  unlabeled traffic allowed by default
[    0.241248] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.241818] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.242211] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.245765] clocksource: Switched to clocksource kvm-clock
[    0.252191] VFS: Disk quotas dquot_6.6.0
[    0.252592] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.253194] AppArmor: AppArmor Filesystem Enabled
[    0.253619] pnp: PnP ACPI init
[    0.254218] pnp: PnP ACPI: found 6 devices
[    0.259835] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.260621] NET: Registered protocol family 2
[    0.261097] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.261674] TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
[    0.262199] TCP: Hash tables configured (established 2048 bind 2048)
[    0.262723] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.263191] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.263716] NET: Registered protocol family 1
[    0.264076] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.264562] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.265030] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.265547] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.266287] Trying to unpack rootfs image as initramfs...
[    0.343130] Freeing initrd memory: 6668K
[    0.343660] Scanning for low memory corruption every 60 seconds
[    0.344250] audit: initializing netlink subsys (disabled)
[    0.344834] Initialise system trusted keyrings
[    0.345163] audit: type=2000 audit(1502390890.343:1): state=initialized audit_enabled=0 res=1
[    0.345747] workingset: timestamp_bits=40 max_order=16 bucket_order=0
[    0.346780] zbud: loaded
[    0.347367] Allocating IMA blacklist keyring.
[    0.348290] Key type asymmetric registered
[    0.348632] Asymmetric key parser 'x509' registered
[    0.349031] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    0.349634] io scheduler noop registered
[    0.349970] io scheduler deadline registered (default)
[    0.350403] io scheduler cfq registered
[    0.350834] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.351433] ACPI: Power Button [PWRF]
[    0.351816] GHES: HEST is not enabled!
[    0.352166] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.374690] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.376309] Linux agpgart interface v0.103
[    0.377980] brd: module loaded
[    0.378971] loop: module loaded
[    0.379967] scsi host0: ata_piix
[    0.380289] scsi host1: ata_piix
[    0.380572] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0e0 irq 14
[    0.381115] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0e8 irq 15
[    0.381902] libphy: Fixed MDIO Bus: probed
[    0.382249] tun: Universal TUN/TAP device driver, 1.6
[    0.382679] PPP generic driver version 2.4.2
[    0.383053] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.383598] ehci-pci: EHCI PCI platform driver
[    0.383967] ehci-platform: EHCI generic platform driver
[    0.384394] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.384890] ohci-pci: OHCI PCI platform driver
[    0.385250] ohci-platform: OHCI generic platform driver
[    0.385669] uhci_hcd: USB Universal Host Controller Interface driver
[    0.386380] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    0.387505] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.387927] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.388397] mousedev: PS/2 mouse device common for all mice
[    0.389029] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    0.389988] rtc_cmos 00:00: RTC can wake from S4
[    0.390538] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    0.391129] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
[    0.391770] i2c /dev entries driver
[    0.392086] device-mapper: uevent: version 1.0.3
[    0.392492] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: dm-devel@redhat.com
[    0.393172] ledtrig-cpu: registered to indicate activity on CPUs
[    0.393836] NET: Registered protocol family 10
[    0.394344] Segment Routing with IPv6
[    0.394668] NET: Registered protocol family 17
[    0.395036] Key type dns_resolver registered
[    0.395508] registered taskstats version 1
[    0.395861] Loading compiled-in X.509 certificates
[    0.396255] zswap: loaded using pool lzo/zbud
[    0.402869] Key type big_key registered
[    0.403268] Key type trusted registered
[    0.403640] Key type encrypted registered
[    0.403965] AppArmor: AppArmor sha1 policy hashing enabled
[    0.404406] ima: No TPM chip found, activating TPM-bypass! (rc=-19)
[    0.404917] evm: HMAC attrs: 0x1
[    0.405437]   Magic number: 13:460:847
[    0.405842] rtc_cmos 00:00: setting system clock to 2017-08-10 18:48:09 UTC (1502390889)
[    0.406448] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    0.406936] EDD information not available.
[    0.546280] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[    0.547090] ata2.00: configured for MWDMA2
[    0.547831] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[    0.558164] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.558745] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.559447] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    0.561173] Freeing unused kernel memory: 1700K
[    0.561551] Write protecting the kernel read-only data: 14336k
[    0.562258] Freeing unused kernel memory: 1448K
[    0.563303] Freeing unused kernel memory: 456K
GC Warning: pthread_getattr_np or pthread_attr_getstack failed for main thread
GC Warning: Couldn't read /proc/stat
Welcome, this is GNU's early boot Guile.
Use '--repl' for an initrd REPL.

loading kernel modules...
[    0.626234] usbcore: registered new interface driver usb-storage
[    0.628263] usbcore: registered new interface driver uas
[    0.629764] hidraw: raw HID events driver (C) Jiri Kosina
[    0.630583] usbcore: registered new interface driver usbhid
[    0.631049] usbhid: USB HID core driver
[    0.644149] isci: Intel(R) C600 SAS Controller Driver - version 1.2.0
[    0.659900] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    0.675680] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
[    0.691283] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
[    0.706923] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
[    0.710710]  vda: vda1 vda2
[    0.724702] FS-Cache: Loaded
[    0.726747] 9pnet: Installing 9P2000 support
[    0.727507] 9p: Installing v9fs 9p2000 file system support
[    0.728013] FS-Cache: Netfs '9p' registered for caching
[    0.731348] fuse init (API version 7.26)
[    0.734631] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
loading '/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system/boot'...
mak[    0.761608] random: fast init done
ing '/gnu/store/svj3fgi0rmyfpmvm603r26aa7va04iyw-system' the current system...
setting up setuid programs in '/run/setuid-programs'...
populating /etc from /gnu/store/wy25fv5rqxq7d2gijny7hyj9njalnjj8-etc...
adding user 'root'...
adding group 'root'...
adding group 'wheel'...
adding group 'users'...
adding group 'nogroup'...
adding group 'tty'...
adding group 'dialout'...
adding group 'kmem'...
adding group 'input'...
adding group 'video'...
adding group 'audio'...
adding group 'netdev'...
adding group 'lp'...
adding group 'disk'...
[    1.326666] random: crng init done
adding group 'floppy'...
[    1.357808] tsc: Refined TSC clocksource calibration: 3392.239 MHz
[    1.358342] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x30e5aacbefe, max_idle_ns: 440795229191 ns
adding group 'cdrom'...
adding group 'tape'...
adding group 'kvm'...
adding group 'guixbuild'...
adding group 'rsyncd'...
usermod: no changes
adding user 'alice'...
adding user 'nobody'...
adding user 'guixbuilder01'...
adding user 'guixbuilder02'...
adding user 'guixbuilder03'...
adding user 'guixbuilder04'...
adding user 'guixbuilder05'...
adding user 'guixbuilder06'...
adding user 'guixbuilder07'...
adding user 'guixbuilder08'...
adding user 'guixbuilder09'...
adding user 'guixbuilder10'...
adding user 'rsyncd'...
registering public key '/gnu/store/br4692l4qzbs4qi7b05gm5q41dgv5rvl-guix-0.13.0-5.228a398/share/guix/hydra.gnu.org.pub'...
Service root has been started.
starting services...
Service root-file-system has been started.
Service user-file-systems has been started.
Service file-system-/dev/pts has been started.
Service file-system-/dev/shm has been started.
Service file-system-/sys/fs/cgroup has been started.
Service file-system-/sys/fs/cgroup/cpuset has been started.
Service file-system-/sys/fs/cgroup/cpu has been started.
Service file-system-/sys/fs/cgroup/cpuacct has been started.
Service file-system-/sys/fs/cgroup/memory has been started.
Service file-system-/sys/fs/cgroup/devices has been started.
Service file-system-/sys/fs/cgroup/freezer has been started.
Service file-system-/sys/fs/cgroup/blkio has been started.
Service file-system-/sys/fs/cgroup/perf_event has been started.
Service file-system-/sys/fs/cgroup/hugetlb has been started.
Service file-systems has been started.
Service user-processes has been started.
Service host-name has been started.
Service user-homes could not be started.
waiting for udevd...
[    4.000131] udevd[294]: starting version 3.2.1
[    4.051142] udevd[294]: starting eudev-3.2.1
[    4.488341] udevd[294]: no sender credentials received, message ignored
[    4.523932] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0x700, revision 0
[    4.527477] parport_pc 00:04: reported by Plug and Play ACPI
[    4.528042] parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]
[    4.534261] input: PC Speaker as /devices/platform/pcspkr/input/input3
[    4.544893] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input5
[    4.545741] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input4
[    4.547016] Floppy drive(s): fd0 is 2.88M AMI BIOS
[    4.562181] Error: Driver 'pcspkr' is already registered, aborting...
[    4.566098] FDC 0 is a S82078B
[    4.709484] ppdev: user-space parallel port driver
Service udev has been started.
nscd: 318 monitoring file `/etc/hosts` (1)
nscd: 318 monitoring directory `/etc` (2)
nscd: 318 monitoring file `/etc/resolv.conf` (3)
nscd: 318 monitoring directory `/etc` (2)
nscd: 318 monitoring file `/etc/services` (4)
nscd: 318 monitoring directory `/etc` (2)
Service nscd has been started.
Service guix-daemon has been started.
Service urandom-seed has been started.
Service syslogd has been started.
Service loopback has been started.
Service term-tty6 has been started.
Service term-tty5 has been started.
Service term-tty4 has been started.
Service term-tty3 has been started.
Service term-tty2 has been started.
Service term-tty1 has been started.
unicode_start skipped on not a tty
Service console-font-tty1 has been started.
Service console-font-tty2 has been started.
Service console-font-tty3 has been started.
Service console-font-tty4 has been started.
Service console-font-tty5 has been started.
Service console-font-tty6 has been started.
Service rsync has been started.
Service networking has been started.
Service marionette has been started.
rsync: mkstemp ".input.iQIqwT" (in files) failed: Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
rsync: link_stat "input" (in files) failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1650) [Receiver=3.1.2]
ice-9/eval.scm:387:11: In procedure eval:
ice-9/eval.scm:387:11: In procedure open-file: No such file or directory: "/tmp/output"
QEMU runs as PID 5
connected to QEMU's monitor
read QEMU monitor prompt
connected to guest REPL
%%%% Starting test rsync  (Writing full log to "rsync.log")
marionette is ready
/gnu/store/ibw6gxsixknaiwy0i10m4yhi7snshm11-rsync-test-builder:1: FAIL Test file copied to share
/gnu/store/ibw6gxsixknaiwy0i10m4yhi7snshm11-rsync-test-builder:1: FAIL Test file correctly received from share
# of expected passes      2
# of unexpected failures  2
note: keeping build directory `/tmp/guix-build-rsync-test.drv-0'
builder for `/gnu/store/ar4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv' failed with exit code 1
@ build-failed /gnu/store/ar4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv - 1 builder for `/gnu/store/ar4jg2ncjpy6qpbgkyp0ssyhr2vdv479-rsync-test.drv' failed with exit code 1
TOTAL: 1
FAIL: /gnu/store/ar2n5rpwpfxj9lbjl0zyxm2wjb1q3l2l-rsync-test
make: *** [Makefile:5218: check-system] Error 1
natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system TESTS=rsync-with-port-2000
Compiling Scheme modules...
;;; note: source file /home/natsu/src/guix/gnu/tests/rsync.scm
;;;       newer than compiled /home/natsu/.cache/guile/ccache/2.2-LE-8-3.A/home/natsu/src/guix/gnu/tests/rsync.scm.go
Running 1 system tests...
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
The following derivations will be built:
   /gnu/store/9cwg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv
   /gnu/store/aw0lwac9k152r33y5ilvy07ci7icwyhz-rsync.conf.drv
   /gnu/store/hv77j9ra3g8vknk1izr8i5sihrgivif7-shepherd-rsync.scm.drv
   /gnu/store/zq2likac6mix3br8adw9j6gz21i1l8n1-shepherd.conf.drv
   /gnu/store/wxx6gwljarl2nl1mxvv7p1i343pi03jv-boot.drv
   /gnu/store/qq98dl2bf37n2b0z1by6bxrrlkhgfkyz-grub.cfg.drv
   /gnu/store/2gbxd3dk7vh56f59gfkxx9ld9wwydqvi-builder-in-linux-vm.drv
   /gnu/store/wd58d2sjz4qrxld1crksb9sbb84rr1n5-linux-vm-loader.drv
   /gnu/store/b7q3n5cv9jm84rr5nfj6x726m34z929z-qemu-image.drv
   /gnu/store/yyb1mlk3irimzhfcp7nzxi3mc1p24ilq-system.drv
   /gnu/store/0h6dy5lsa0qq640sy24ysvbnd62i0gk0-run-vm.sh.drv
@ build-started /gnu/store/aw0lwac9k152r33y5ilvy07ci7icwyhz-rsync.conf.drv - x86_64-linux /var/log/guix/drvs/aw//0lwac9k152r33y5ilvy07ci7icwyhz-rsync.conf.drv.bz2
@ build-succeeded /gnu/store/aw0lwac9k152r33y5ilvy07ci7icwyhz-rsync.conf.drv -
@ build-started /gnu/store/hv77j9ra3g8vknk1izr8i5sihrgivif7-shepherd-rsync.scm.drv - x86_64-linux /var/log/guix/drvs/hv//77j9ra3g8vknk1izr8i5sihrgivif7-shepherd-rsync.scm.drv.bz2
@ build-succeeded /gnu/store/hv77j9ra3g8vknk1izr8i5sihrgivif7-shepherd-rsync.scm.drv -
@ build-started /gnu/store/zq2likac6mix3br8adw9j6gz21i1l8n1-shepherd.conf.drv - x86_64-linux /var/log/guix/drvs/zq//2likac6mix3br8adw9j6gz21i1l8n1-shepherd.conf.drv.bz2
@ build-succeeded /gnu/store/zq2likac6mix3br8adw9j6gz21i1l8n1-shepherd.conf.drv -
@ build-started /gnu/store/wxx6gwljarl2nl1mxvv7p1i343pi03jv-boot.drv - x86_64-linux /var/log/guix/drvs/wx//x6gwljarl2nl1mxvv7p1i343pi03jv-boot.drv.bz2
@ build-succeeded /gnu/store/wxx6gwljarl2nl1mxvv7p1i343pi03jv-boot.drv -
@ build-started /gnu/store/yyb1mlk3irimzhfcp7nzxi3mc1p24ilq-system.drv - x86_64-linux /var/log/guix/drvs/yy//b1mlk3irimzhfcp7nzxi3mc1p24ilq-system.drv.bz2
@ build-succeeded /gnu/store/yyb1mlk3irimzhfcp7nzxi3mc1p24ilq-system.drv -
@ build-started /gnu/store/qq98dl2bf37n2b0z1by6bxrrlkhgfkyz-grub.cfg.drv - x86_64-linux /var/log/guix/drvs/qq//98dl2bf37n2b0z1by6bxrrlkhgfkyz-grub.cfg.drv.bz2
@ build-succeeded /gnu/store/qq98dl2bf37n2b0z1by6bxrrlkhgfkyz-grub.cfg.drv -
@ build-started /gnu/store/2gbxd3dk7vh56f59gfkxx9ld9wwydqvi-builder-in-linux-vm.drv - x86_64-linux /var/log/guix/drvs/2g//bxd3dk7vh56f59gfkxx9ld9wwydqvi-builder-in-linux-vm.drv.bz2
@ build-succeeded /gnu/store/2gbxd3dk7vh56f59gfkxx9ld9wwydqvi-builder-in-linux-vm.drv -
@ build-started /gnu/store/wd58d2sjz4qrxld1crksb9sbb84rr1n5-linux-vm-loader.drv - x86_64-linux /var/log/guix/drvs/wd//58d2sjz4qrxld1crksb9sbb84rr1n5-linux-vm-loader.drv.bz2
@ build-succeeded /gnu/store/wd58d2sjz4qrxld1crksb9sbb84rr1n5-linux-vm-loader.drv -
@ build-started /gnu/store/b7q3n5cv9jm84rr5nfj6x726m34z929z-qemu-image.drv - x86_64-linux /var/log/guix/drvs/b7//q3n5cv9jm84rr5nfj6x726m34z929z-qemu-image.drv.bz2
environment variable `PATH' set to `/gnu/store/k9hgvkklhzg09x0g2g96f8s971311jca-qemu-minimal-2.9.0/bin:/gnu/store/lvx0kpa1jdbq2b4wkk1gbyiw6zrhigqz-coreutils-8.26/bin'
creating qcow2 image of 70.00 MiB...
Formatting '/gnu/store/n5qq8ikb0m2k7zpl5k7pln4xn7aqd2an-qemu-image', fmt=qcow2 size=73400320 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
Warning: vlan 0 is not connected to host network
[    0.000000] Linux version 4.12.5-gnu (nixbld@) (gcc version 5.4.0 (GCC) ) #1 SMP 1
[    0.000000] Command line: console=ttyS0 --load=/gnu/store/wl49ivrcx7lwdi7zn29fa4jz0sy5s27g-linux-vm-loader
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000000ffddfff] usable
[    0.000000] BIOS-e820: [mem 0x000000000ffde000-0x000000000fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014
[    0.000000] Hypervisor detected: KVM
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] e820: last_pfn = 0xffde max_arch_pfn = 0x400000000
[    0.000000] x86/PAT: PAT not supported by CPU.
[    0.000000] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
[    0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [ffff8ffe400f6a90]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] RAMDISK: [mem 0x0fa5f000-0x0ffcffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F68A0 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x000000000FFE154E 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x000000000FFE142A 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x000000000FFE0040 0013EA (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x000000000FFE0000 000040
[    0.000000] ACPI: APIC 0x000000000FFE149E 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x000000000FFE1516 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000000ffddfff]
[    0.000000] NODE_DATA(0) allocated [mem 0x0ffda000-0x0ffddfff]
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:ffd6001, primary cpu clock
[    0.000000] kvm-clock: using sched offset of 143092943 cycles
[    0.000000] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000]   Normal   empty
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x000000000ffddfff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] e820: [mem 0x10000000-0xfeffbfff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] percpu: Embedded 39 pages/cpu @ffff8ffe4f800000 s118936 r8192 d32616 u2097152
[    0.000000] KVM setup async PF for cpu 0
[    0.000000] kvm-stealtime: cpu 0, msr f80d980
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 64359
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: console=ttyS0 --load=/gnu/store/wl49ivrcx7lwdi7zn29fa4jz0sy5s27g-linux-vm-loader
[    0.000000] PID hash table entries: 1024 (order: 1, 8192 bytes)
[    0.000000] Memory: 232816K/261616K available (8776K kernel code, 1480K rwdata, 3640K rodata, 1700K init, 1156K bss, 28800K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 35796 entries in 140 pages
[    0.004000] Hierarchical RCU implementation.
[    0.004000] 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[    0.004000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.004000] NR_IRQS:16640 nr_irqs:256 16
[    0.004000] Console: colour VGA+ 80x25
[    0.004000] console [ttyS0] enabled
[    0.004000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.004006] tsc: Detected 3392.294 MHz processor
[    0.004351] Calibrating delay loop (skipped) preset value.. 6784.58 BogoMIPS (lpj=13569176)
[    0.004587] pid_max: default: 32768 minimum: 301
[    0.004916] ACPI: Core revision 20170303
[    0.005704] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.006165] Security Framework initialized
[    0.006473] Yama: becoming mindful.
[    0.006726] AppArmor: AppArmor initialized
[    0.007042] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
[    0.007574] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.008134] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.008598] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.009273] CPU: Physical Processor ID: 0
[    0.009577] mce: CPU supports 10 MCE banks
[    0.009888] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.010260] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.016098] Freeing SMP alternatives memory: 32K
[    0.017371] smpboot: Max logical packages: 1
[    0.017806] x2apic enabled
[    0.018133] Switched APIC routing to physical x2apic.
[    0.019074] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.020000] smpboot: CPU0: Intel QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[    0.020000] Performance Events: PMU not available due to virtualization, using software events only.
[    0.020000] smp: Bringing up secondary CPUs ...
[    0.020000] smp: Brought up 1 node, 1 CPU
[    0.020000] smpboot: Total of 1 processors activated (6784.58 BogoMIPS)
[    0.020000] sched_clock: Marking stable (16000000, 0)->(79655420, -63655420)
[    0.127655] devtmpfs: initialized
[    0.127986] x86/mm: Memory block size: 128MB
[    0.129544] evm: security.selinux
[    0.129829] evm: security.SMACK64
[    0.130095] evm: security.SMACK64EXEC
[    0.130384] evm: security.SMACK64TRANSMUTE
[    0.130703] evm: security.SMACK64MMAP
[    0.130991] evm: security.ima
[    0.131226] evm: security.capability
[    0.131564] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.132327] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.132828] pinctrl core: initialized pinctrl subsystem
[    0.133334] RTC time: 18:49:23, date: 08/10/17
[    0.133749] NET: Registered protocol family 16
[    0.134201] cpuidle: using governor ladder
[    0.134525] cpuidle: using governor menu
[    0.134833] PCCT header not found.
[    0.135119] ACPI: bus type PCI registered
[    0.135438] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.136012] PCI: Using configuration type 1 for base access
[    0.137088] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.137723] ACPI: Added _OSI(Module Device)
[    0.138068] ACPI: Added _OSI(Processor Device)
[    0.138415] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.138783] ACPI: Added _OSI(Processor Aggregator Device)
[    0.140287] ACPI: Interpreter enabled
[    0.140607] ACPI: (supports S0 S3 S4 S5)
[    0.140918] ACPI: Using IOAPIC for interrupt routing
[    0.141317] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.143732] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.144257] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    0.144797] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.145309] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[    0.146372] acpiphp: Slot [3] registered
[    0.146696] acpiphp: Slot [4] registered
[    0.147019] acpiphp: Slot [5] registered
[    0.147340] acpiphp: Slot [6] registered
[    0.147663] acpiphp: Slot [7] registered
[    0.147983] acpiphp: Slot [8] registered
[    0.148309] acpiphp: Slot [9] registered
[    0.148628] acpiphp: Slot [10] registered
[    0.148956] acpiphp: Slot [11] registered
[    0.149286] acpiphp: Slot [12] registered
[    0.149615] acpiphp: Slot [13] registered
[    0.150073] acpiphp: Slot [14] registered
[    0.150403] acpiphp: Slot [15] registered
[    0.150729] acpiphp: Slot [16] registered
[    0.151058] acpiphp: Slot [17] registered
[    0.151387] acpiphp: Slot [18] registered
[    0.151719] acpiphp: Slot [19] registered
[    0.152056] acpiphp: Slot [20] registered
[    0.152384] acpiphp: Slot [21] registered
[    0.152712] acpiphp: Slot [22] registered
[    0.153059] acpiphp: Slot [23] registered
[    0.153386] acpiphp: Slot [24] registered
[    0.153727] acpiphp: Slot [25] registered
[    0.154054] acpiphp: Slot [26] registered
[    0.154381] acpiphp: Slot [27] registered
[    0.154710] acpiphp: Slot [28] registered
[    0.155037] acpiphp: Slot [29] registered
[    0.155363] acpiphp: Slot [30] registered
[    0.155691] acpiphp: Slot [31] registered
[    0.156019] PCI host bridge to bus 0000:00
[    0.156343] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.156869] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.157397] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.157979] pci_bus 0000:00: root bus resource [mem 0x10000000-0xfebfffff window]
[    0.158555] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.163643] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.164245] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.164756] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.165304] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.166226] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    0.166803] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    0.227223] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.231180] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.231684] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.232190] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.232662] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.233153] ACPI: Enabled 2 GPEs in block 00 to 0F
[    0.233637] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.234115] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.234772] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.235531] vgaarb: loaded
[    0.235873] SCSI subsystem initialized
[    0.236234] ACPI: bus type USB registered
[    0.236566] usbcore: registered new interface driver usbfs
[    0.236997] usbcore: registered new interface driver hub
[    0.237419] usbcore: registered new device driver usb
[    0.237867] EDAC MC: Ver: 3.0.0
[    0.238272] PCI: Using ACPI for IRQ routing
[    0.238760] NetLabel: Initializing
[    0.239036] NetLabel:  domain hash size = 128
[    0.239380] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.239836] NetLabel:  unlabeled traffic allowed by default
[    0.240344] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.240903] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.241286] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.244832] clocksource: Switched to clocksource kvm-clock
[    0.251177] VFS: Disk quotas dquot_6.6.0
[    0.251571] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.252155] AppArmor: AppArmor Filesystem Enabled
[    0.252563] pnp: PnP ACPI init
[    0.253157] pnp: PnP ACPI: found 6 devices
[    0.258776] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.259544] NET: Registered protocol family 2
[    0.260000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.260554] TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
[    0.261069] TCP: Hash tables configured (established 2048 bind 2048)
[    0.261579] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.262044] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.262550] NET: Registered protocol family 1
[    0.262899] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.263364] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.263825] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.264325] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.265049] Trying to unpack rootfs image as initramfs...
[    0.330164] Freeing initrd memory: 5572K
[    0.330611] Scanning for low memory corruption every 60 seconds
[    0.331270] audit: initializing netlink subsys (disabled)
[    0.331945] Initialise system trusted keyrings
[    0.332326] audit: type=2000 audit(1502390963.871:1): state=initialized audit_enabled=0 res=1
[    0.333055] workingset: timestamp_bits=40 max_order=16 bucket_order=0
[    0.334149] zbud: loaded
[    0.334722] Allocating IMA blacklist keyring.
[    0.335647] Key type asymmetric registered
[    0.335976] Asymmetric key parser 'x509' registered
[    0.336362] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    0.336972] io scheduler noop registered
[    0.337282] io scheduler deadline registered (default)
[    0.337705] io scheduler cfq registered
[    0.338122] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.338700] ACPI: Power Button [PWRF]
[    0.339063] GHES: HEST is not enabled!
[    0.339410] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.361674] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.363239] Linux agpgart interface v0.103
[    0.364932] brd: module loaded
[    0.365939] loop: module loaded
[    0.366942] scsi host0: ata_piix
[    0.367255] scsi host1: ata_piix
[    0.367534] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0a0 irq 14
[    0.368057] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0a8 irq 15
[    0.368796] libphy: Fixed MDIO Bus: probed
[    0.369151] tun: Universal TUN/TAP device driver, 1.6
[    0.369576] PPP generic driver version 2.4.2
[    0.369947] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.370463] ehci-pci: EHCI PCI platform driver
[    0.370823] ehci-platform: EHCI generic platform driver
[    0.371234] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.371713] ohci-pci: OHCI PCI platform driver
[    0.372068] ohci-platform: OHCI generic platform driver
[    0.372482] uhci_hcd: USB Universal Host Controller Interface driver
[    0.373192] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    0.374321] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.374718] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.375178] mousedev: PS/2 mouse device common for all mice
[    0.375795] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    0.376757] rtc_cmos 00:00: RTC can wake from S4
[    0.377309] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    0.377894] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
[    0.378474] i2c /dev entries driver
[    0.378784] device-mapper: uevent: version 1.0.3
[    0.379182] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: dm-devel@redhat.com
[    0.379842] ledtrig-cpu: registered to indicate activity on CPUs
[    0.380485] NET: Registered protocol family 10
[    0.380990] Segment Routing with IPv6
[    0.381306] NET: Registered protocol family 17
[    0.381668] Key type dns_resolver registered
[    0.382116] registered taskstats version 1
[    0.382446] Loading compiled-in X.509 certificates
[    0.382832] zswap: loaded using pool lzo/zbud
[    0.389142] Key type big_key registered
[    0.389526] Key type trusted registered
[    0.389895] Key type encrypted registered
[    0.390212] AppArmor: AppArmor sha1 policy hashing enabled
[    0.390648] ima: No TPM chip found, activating TPM-bypass! (rc=-19)
[    0.391160] evm: HMAC attrs: 0x1
[    0.391674]   Magic number: 13:460:847
[    0.392086] rtc_cmos 00:00: setting system clock to 2017-08-10 18:49:23 UTC (1502390963)
[    0.392773] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    0.393279] EDD information not available.
[    0.533311] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[    0.534111] ata2.00: configured for MWDMA2
[    0.534817] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[    0.545198] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.545751] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.546442] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    0.548098] Freeing unused kernel memory: 1700K
[    0.548473] Write protecting the kernel read-only data: 14336k
[    0.549183] Freeing unused kernel memory: 1448K
[    0.550237] Freeing unused kernel memory: 456K
GC Warning: pthread_getattr_np or pthread_attr_getstack failed for main thread
GC Warning: Couldn't read /proc/stat
Welcome, this is GNU's early boot Guile.
Use '--repl' for an initrd REPL.

loading kernel modules...
[    0.605286] usbcore: registered new interface driver usb-storage
[    0.607220] usbcore: registered new interface driver uas
[    0.608927] hidraw: raw HID events driver (C) Jiri Kosina
[    0.609815] usbcore: registered new interface driver usbhid
[    0.610272] usbhid: USB HID core driver
[    0.623471] isci: Intel(R) C600 SAS Controller Driver - version 1.2.0
[    0.639261] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    0.654898] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
[    0.670324] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
[    0.686121] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
[    0.693229] FS-Cache: Loaded
[    0.695201] 9pnet: Installing 9P2000 support
[    0.696011] 9p: Installing v9fs 9p2000 file system support
[    0.696475] FS-Cache: Netfs '9p' registered for caching
configuring QEMU networking...
loading '/gnu/store/wl49ivrcx7lwdi7zn29fa4jz0sy5s27g-linux-vm-loader'...
[    0.715618] random: fast init done
environment variable `PATH' set to `/gnu/store/k9hgvkklhzg09x0g2g96f8s971311jca-qemu-minimal-2.9.0/bin:/gnu/store/ylqnd6l728g7ynmnbcfw2r1xy3dj700z-parted-3.2/sbin:/gnu/store/dhpzd7c68dwkslwp70zx30qgr0xq4cqa-e2fsprogs-1.43.4/bin:/gnu/store/dhpzd7c68dwkslwp70zx30qgr0xq4cqa-e2fsprogs-1.43.4/sbin:/gnu/store/qm1dq0jr7xqq2rb2dyk4n2x36rm78nf4-dosfstools-4.1/sbin:/gnu/store/513czksd18aylw1f2vbxzj1ahjx82bld-sed-4.4/bin:/gnu/store/n5yaniyzzlyrz8vhkps0vlnrq3scphny-grep-3.0/bin:/gnu/store/lvx0kpa1jdbq2b4wkk1gbyiw6zrhigqz-coreutils-8.26/bin:/gnu/store/6rixzhgy873s914wg71vpndjyn0fzmck-findutils-4.6.0/bin:/gnu/store/qayvxpllx5kblql9spjgjzvfwr9fda3p-gawk-4.1.4/bin'
creating partition table with 2 partitions (20.0 MiB, 40.0 MiB)...
Warning: The resulting partition is not properly aligned for best performance.
creating ext4 partition...
mke2fs 1.43.4 (31-Jan-2017)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/vda1 is mounted.
Creating filesystem with 20480 1k blocks and 5136 inodes
Filesystem UUID: d161c5b4-d9ce-428a-9a1f-de97fe5a67dc
Superblock backups stored on blocks: 
	8193

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

[    0.825601] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
populating...
clearing file timestamps...
creating FAT partition...
mkfs.fat 4.1 (2017-01-24)
mounting root partition...
[    0.849975] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
installing bootloader...
Installing for i386-pc platform.
[    1.356874] tsc: Refined TSC clocksource calibration: 3392.239 MHz
[    1.357376] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x30e5aacbefe, max_idle_ns: 440795229191 ns
Installation finished. No error reported.
mounting EFI system partition...
creating EFI firmware image...[    1.688661] random: crng init done
done.
[    2.044604] Unregister pv shared memory for cpu 0
[    2.045201] reboot: Restarting system
[    2.045488] reboot: machine restart
@ build-succeeded /gnu/store/b7q3n5cv9jm84rr5nfj6x726m34z929z-qemu-image.drv -
@ build-started /gnu/store/0h6dy5lsa0qq640sy24ysvbnd62i0gk0-run-vm.sh.drv - x86_64-linux /var/log/guix/drvs/0h//6dy5lsa0qq640sy24ysvbnd62i0gk0-run-vm.sh.drv.bz2
@ build-succeeded /gnu/store/0h6dy5lsa0qq640sy24ysvbnd62i0gk0-run-vm.sh.drv -
@ build-started /gnu/store/9cwg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv - x86_64-linux /var/log/guix/drvs/9c//wg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv.bz2
Warning: vlan 0 is not connected to host network
[    0.000000] Linux version 4.12.5-gnu (nixbld@) (gcc version 5.4.0 (GCC) ) #1 SMP 1
[    0.000000] Command line: console=ttyS0 --root=/dev/vda1 --system=/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system --load=/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system/boot
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000000ffddfff] usable
[    0.000000] BIOS-e820: [mem 0x000000000ffde000-0x000000000fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014
[    0.000000] Hypervisor detected: KVM
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] e820: last_pfn = 0xffde max_arch_pfn = 0x400000000
[    0.000000] x86/PAT: PAT not supported by CPU.
[    0.000000] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
[    0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [ffff8f6b000f6a90]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] RAMDISK: [mem 0x0f94d000-0x0ffcffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F68A0 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x000000000FFE154E 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x000000000FFE142A 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x000000000FFE0040 0013EA (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x000000000FFE0000 000040
[    0.000000] ACPI: APIC 0x000000000FFE149E 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x000000000FFE1516 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000000ffddfff]
[    0.000000] NODE_DATA(0) allocated [mem 0x0ffda000-0x0ffddfff]
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:ffd6001, primary cpu clock
[    0.000000] kvm-clock: using sched offset of 143355467 cycles
[    0.000000] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000]   Normal   empty
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x000000000ffddfff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000000ffddfff]
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] e820: [mem 0x10000000-0xfeffbfff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] percpu: Embedded 39 pages/cpu @ffff8f6b0f600000 s118936 r8192 d32616 u2097152
[    0.000000] KVM setup async PF for cpu 0
[    0.000000] kvm-stealtime: cpu 0, msr f60d980
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 64359
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: console=ttyS0 --root=/dev/vda1 --system=/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system --load=/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system/boot
[    0.000000] PID hash table entries: 1024 (order: 1, 8192 bytes)
[    0.000000] Memory: 231720K/261616K available (8776K kernel code, 1480K rwdata, 3640K rodata, 1700K init, 1156K bss, 29896K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 35796 entries in 140 pages
[    0.004000] Hierarchical RCU implementation.
[    0.004000] 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[    0.004000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.004000] NR_IRQS:16640 nr_irqs:256 16
[    0.004000] Console: colour VGA+ 80x25
[    0.004000] console [ttyS0] enabled
[    0.004000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.004008] tsc: Detected 3392.294 MHz processor
[    0.004356] Calibrating delay loop (skipped) preset value.. 6784.58 BogoMIPS (lpj=13569176)
[    0.004704] pid_max: default: 32768 minimum: 301
[    0.005074] ACPI: Core revision 20170303
[    0.005927] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.006473] Security Framework initialized
[    0.006789] Yama: becoming mindful.
[    0.007068] AppArmor: AppArmor initialized
[    0.007438] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
[    0.008067] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.008815] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.009338] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.010060] CPU: Physical Processor ID: 0
[    0.010400] mce: CPU supports 10 MCE banks
[    0.010751] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.011153] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.017342] Freeing SMP alternatives memory: 32K
[    0.018692] smpboot: Max logical packages: 1
[    0.019141] x2apic enabled
[    0.019486] Switched APIC routing to physical x2apic.
[    0.020541] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.024000] smpboot: CPU0: Intel QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[    0.024000] Performance Events: PMU not available due to virtualization, using software events only.
[    0.024000] smp: Bringing up secondary CPUs ...
[    0.024000] smp: Brought up 1 node, 1 CPU
[    0.024000] smpboot: Total of 1 processors activated (6784.58 BogoMIPS)
[    0.024000] sched_clock: Marking stable (20000000, 0)->(89118140, -69118140)
[    0.132027] devtmpfs: initialized
[    0.132336] x86/mm: Memory block size: 128MB
[    0.133923] evm: security.selinux
[    0.134196] evm: security.SMACK64
[    0.134465] evm: security.SMACK64EXEC
[    0.134761] evm: security.SMACK64TRANSMUTE
[    0.135090] evm: security.SMACK64MMAP
[    0.135386] evm: security.ima
[    0.135627] evm: security.capability
[    0.135976] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.136680] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.137136] pinctrl core: initialized pinctrl subsystem
[    0.137613] RTC time: 18:49:26, date: 08/10/17
[    0.138011] NET: Registered protocol family 16
[    0.138414] cpuidle: using governor ladder
[    0.138705] cpuidle: using governor menu
[    0.138969] PCCT header not found.
[    0.139241] ACPI: bus type PCI registered
[    0.139560] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.140094] PCI: Using configuration type 1 for base access
[    0.141166] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.141817] ACPI: Added _OSI(Module Device)
[    0.142164] ACPI: Added _OSI(Processor Device)
[    0.142524] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.142916] ACPI: Added _OSI(Processor Aggregator Device)
[    0.144475] ACPI: Interpreter enabled
[    0.144803] ACPI: (supports S0 S3 S4 S5)
[    0.145125] ACPI: Using IOAPIC for interrupt routing
[    0.145555] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.148071] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.148613] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    0.149203] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.149761] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[    0.150896] acpiphp: Slot [3] registered
[    0.151251] acpiphp: Slot [4] registered
[    0.151605] acpiphp: Slot [5] registered
[    0.151939] acpiphp: Slot [6] registered
[    0.152284] acpiphp: Slot [7] registered
[    0.152619] acpiphp: Slot [8] registered
[    0.152971] acpiphp: Slot [9] registered
[    0.153306] acpiphp: Slot [10] registered
[    0.153654] acpiphp: Slot [11] registered
[    0.154116] acpiphp: Slot [12] registered
[    0.154460] acpiphp: Slot [13] registered
[    0.154826] acpiphp: Slot [14] registered
[    0.155161] acpiphp: Slot [15] registered
[    0.155500] acpiphp: Slot [16] registered
[    0.155849] acpiphp: Slot [17] registered
[    0.156198] acpiphp: Slot [18] registered
[    0.156539] acpiphp: Slot [19] registered
[    0.156911] acpiphp: Slot [20] registered
[    0.157261] acpiphp: Slot [21] registered
[    0.157610] acpiphp: Slot [22] registered
[    0.157955] acpiphp: Slot [23] registered
[    0.158304] acpiphp: Slot [24] registered
[    0.158652] acpiphp: Slot [25] registered
[    0.159001] acpiphp: Slot [26] registered
[    0.159351] acpiphp: Slot [27] registered
[    0.159696] acpiphp: Slot [28] registered
[    0.160052] acpiphp: Slot [29] registered
[    0.160400] acpiphp: Slot [30] registered
[    0.160763] acpiphp: Slot [31] registered
[    0.161109] PCI host bridge to bus 0000:00
[    0.161453] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.162014] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.162579] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.163203] pci_bus 0000:00: root bus resource [mem 0x10000000-0xfebfffff window]
[    0.163820] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.169339] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.169944] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.170472] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.171032] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.171913] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    0.172436] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    0.237219] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.237768] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.238278] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.238821] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.239315] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.239840] ACPI: Enabled 2 GPEs in block 00 to 0F
[    0.240357] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.240876] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.241554] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.242009] vgaarb: loaded
[    0.242371] SCSI subsystem initialized
[    0.242747] ACPI: bus type USB registered
[    0.243106] usbcore: registered new interface driver usbfs
[    0.243550] usbcore: registered new interface driver hub
[    0.243987] usbcore: registered new device driver usb
[    0.244431] EDAC MC: Ver: 3.0.0
[    0.244855] PCI: Using ACPI for IRQ routing
[    0.245352] NetLabel: Initializing
[    0.245636] NetLabel:  domain hash size = 128
[    0.245988] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.246457] NetLabel:  unlabeled traffic allowed by default
[    0.246975] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.247542] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.247934] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.252510] clocksource: Switched to clocksource kvm-clock
[    0.259236] VFS: Disk quotas dquot_6.6.0
[    0.259627] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.260246] AppArmor: AppArmor Filesystem Enabled
[    0.260704] pnp: PnP ACPI init
[    0.261309] pnp: PnP ACPI: found 6 devices
[    0.266931] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.267694] NET: Registered protocol family 2
[    0.268162] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.268737] TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
[    0.269201] TCP: Hash tables configured (established 2048 bind 2048)
[    0.269666] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.270082] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.270546] NET: Registered protocol family 1
[    0.270868] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.271296] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.271727] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.272193] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.272981] Trying to unpack rootfs image as initramfs...
[    0.349382] Freeing initrd memory: 6668K
[    0.349888] Scanning for low memory corruption every 60 seconds
[    0.350564] audit: initializing netlink subsys (disabled)
[    0.351247] Initialise system trusted keyrings
[    0.351639] audit: type=2000 audit(1502390966.783:1): state=initialized audit_enabled=0 res=1
[    0.352337] workingset: timestamp_bits=40 max_order=16 bucket_order=0
[    0.353460] zbud: loaded
[    0.354029] Allocating IMA blacklist keyring.
[    0.354943] Key type asymmetric registered
[    0.355291] Asymmetric key parser 'x509' registered
[    0.355689] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    0.356288] io scheduler noop registered
[    0.356634] io scheduler deadline registered (default)
[    0.357068] io scheduler cfq registered
[    0.357510] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.358109] ACPI: Power Button [PWRF]
[    0.358482] GHES: HEST is not enabled!
[    0.358869] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.381451] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.383038] Linux agpgart interface v0.103
[    0.384745] brd: module loaded
[    0.385721] loop: module loaded
[    0.386704] scsi host0: ata_piix
[    0.387024] scsi host1: ata_piix
[    0.387310] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0e0 irq 14
[    0.387854] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0e8 irq 15
[    0.388627] libphy: Fixed MDIO Bus: probed
[    0.388974] tun: Universal TUN/TAP device driver, 1.6
[    0.389403] PPP generic driver version 2.4.2
[    0.389789] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.390324] ehci-pci: EHCI PCI platform driver
[    0.390692] ehci-platform: EHCI generic platform driver
[    0.391117] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.391612] ohci-pci: OHCI PCI platform driver
[    0.391974] ohci-platform: OHCI generic platform driver
[    0.392395] uhci_hcd: USB Universal Host Controller Interface driver
[    0.393135] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    0.394273] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.394684] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.395150] mousedev: PS/2 mouse device common for all mice
[    0.395781] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    0.396749] rtc_cmos 00:00: RTC can wake from S4
[    0.397299] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    0.397892] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
[    0.398515] i2c /dev entries driver
[    0.398828] device-mapper: uevent: version 1.0.3
[    0.399234] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: dm-devel@redhat.com
[    0.399918] ledtrig-cpu: registered to indicate activity on CPUs
[    0.400571] NET: Registered protocol family 10
[    0.401084] Segment Routing with IPv6
[    0.401407] NET: Registered protocol family 17
[    0.401769] Key type dns_resolver registered
[    0.402229] registered taskstats version 1
[    0.402561] Loading compiled-in X.509 certificates
[    0.402948] zswap: loaded using pool lzo/zbud
[    0.409254] Key type big_key registered
[    0.409649] Key type trusted registered
[    0.410005] Key type encrypted registered
[    0.410330] AppArmor: AppArmor sha1 policy hashing enabled
[    0.410781] ima: No TPM chip found, activating TPM-bypass! (rc=-19)
[    0.411292] evm: HMAC attrs: 0x1
[    0.411818]   Magic number: 13:460:847
[    0.412213] rtc_cmos 00:00: setting system clock to 2017-08-10 18:49:26 UTC (1502390966)
[    0.412928] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    0.413412] EDD information not available.
[    0.553040] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[    0.553846] ata2.00: configured for MWDMA2
[    0.554499] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[    0.564915] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.565469] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.566167] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    0.567843] Freeing unused kernel memory: 1700K
[    0.568220] Write protecting the kernel read-only data: 14336k
[    0.568942] Freeing unused kernel memory: 1448K
[    0.569985] Freeing unused kernel memory: 456K
GC Warning: pthread_getattr_np or pthread_attr_getstack failed for main thread
GC Warning: Couldn't read /proc/stat
Welcome, this is GNU's early boot Guile.
Use '--repl' for an initrd REPL.

loading kernel modules...
[    0.624792] usbcore: registered new interface driver usb-storage
[    0.626859] usbcore: registered new interface driver uas
[    0.628352] hidraw: raw HID events driver (C) Jiri Kosina
[    0.629229] usbcore: registered new interface driver usbhid
[    0.629719] usbhid: USB HID core driver
[    0.643264] isci: Intel(R) C600 SAS Controller Driver - version 1.2.0
[    0.659267] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    0.674844] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
[    0.690444] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
[    0.706165] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
[    0.710302]  vda: vda1 vda2
[    0.724599] FS-Cache: Loaded
[    0.726538] 9pnet: Installing 9P2000 support
[    0.727300] 9p: Installing v9fs 9p2000 file system support
[    0.727785] FS-Cache: Netfs '9p' registered for caching
[    0.731608] fuse init (API version 7.26)
[    0.732952] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
loading '/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system/boot'...
mak[    0.758510] random: fast init done
ing '/gnu/store/xg2rbcgvhf90cd33959s7505chlnh7v0-system' the current system...
setting up setuid programs in '/run/setuid-programs'...
populating /etc from /gnu/store/wy25fv5rqxq7d2gijny7hyj9njalnjj8-etc...
adding user 'root'...
adding group 'root'...
adding group 'wheel'...
adding group 'users'...
adding group 'nogroup'...
adding group 'tty'...
adding group 'dialout'...
adding group 'kmem'...
adding group 'input'...
adding group 'video'...
adding group 'audio'...
adding group 'netdev'...
adding group 'lp'...
adding group 'disk'...
[    1.312742] random: crng init done
adding group 'floppy'...
[    1.356560] tsc: Refined TSC clocksource calibration: 3392.240 MHz
[    1.357133] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x30e5ac8c3ca, max_idle_ns: 440795369930 ns
adding group 'cdrom'...
adding group 'tape'...
adding group 'kvm'...
adding group 'guixbuild'...
adding group 'rsyncd'...
usermod: no changes
adding user 'alice'...
adding user 'nobody'...
adding user 'guixbuilder01'...
adding user 'guixbuilder02'...
adding user 'guixbuilder03'...
adding user 'guixbuilder04'...
adding user 'guixbuilder05'...
adding user 'guixbuilder06'...
adding user 'guixbuilder07'...
adding user 'guixbuilder08'...
adding user 'guixbuilder09'...
adding user 'guixbuilder10'...
adding user 'rsyncd'...
registering public key '/gnu/store/br4692l4qzbs4qi7b05gm5q41dgv5rvl-guix-0.13.0-5.228a398/share/guix/hydra.gnu.org.pub'...
Service root has been started.
starting services...
Service root-file-system has been started.
Service user-file-systems has been started.
Service file-system-/dev/pts has been started.
Service file-system-/dev/shm has been started.
Service file-system-/sys/fs/cgroup has been started.
Service file-system-/sys/fs/cgroup/cpuset has been started.
Service file-system-/sys/fs/cgroup/cpu has been started.
Service file-system-/sys/fs/cgroup/cpuacct has been started.
Service file-system-/sys/fs/cgroup/memory has been started.
Service file-system-/sys/fs/cgroup/devices has been started.
Service file-system-/sys/fs/cgroup/freezer has been started.
Service file-system-/sys/fs/cgroup/blkio has been started.
Service file-system-/sys/fs/cgroup/perf_event has been started.
Service file-system-/sys/fs/cgroup/hugetlb has been started.
Service file-systems has been started.
Service user-processes has been started.
Service host-name has been started.
Service user-homes could not be started.
waiting for udevd...
[    3.937639] udevd[294]: starting version 3.2.1
[    3.989689] udevd[294]: starting eudev-3.2.1
[    4.437389] udevd[294]: no sender credentials received, message ignored
[    4.470724] parport_pc 00:04: reported by Plug and Play ACPI
[    4.472370] parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]
[    4.477197] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0x700, revision 0
[    4.484321] input: PC Speaker as /devices/platform/pcspkr/input/input3
[    4.493224] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input5
[    4.494069] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input4
[    4.495487] Floppy drive(s): fd0 is 2.88M AMI BIOS
[    4.512841] FDC 0 is a S82078B
[    4.514233] Error: Driver 'pcspkr' is already registered, aborting...
[    4.655815] ppdev: user-space parallel port driver
Service udev has been started.
nscd: 318 monitoring file `/etc/hosts` (1)
nscd: 318 monitoring directory `/etc` (2)
nscd: 318 monitoring file `/etc/resolv.conf` (3)
nscd: 318 monitoring directory `/etc` (2)
nscd: 318 monitoring file `/etc/services` (4)
nscd: 318 monitoring directory `/etc` (2)
Service nscd has been started.
Service guix-daemon has been started.
Service urandom-seed has been started.
Service syslogd has been started.
Service loopback has been started.
Service term-tty6 has been started.
Service term-tty5 has been started.
Service term-tty4 has been started.
Service term-tty3 has been started.
Service term-tty2 has been started.
Service term-tty1 has been started.
unicode_start skipped on not a tty
Service console-font-tty1 has been started.
Service console-font-tty2 has been started.
Service console-font-tty3 has been started.
Service console-font-tty4 has been started.
Service console-font-tty5 has been started.
Service console-font-tty6 has been started.
failed to create pid file /var/run/rsyncd.pid: Permission denied
Service rsync could not be started.
Service networking has been started.
Service marionette has been started.
failed to create pid file /var/run/rsyncd.pid: Permission denied
shepherd: Service rsync could not be started.
rsync: failed to connect to localhost (127.0.0.1): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [sender=3.1.2]
rsync: failed to connect to localhost (127.0.0.1): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
ice-9/eval.scm:387:11: In procedure eval:
ice-9/eval.scm:387:11: In procedure open-file: No such file or directory: "/tmp/output"
QEMU runs as PID 5
connected to QEMU's monitor
read QEMU monitor prompt
connected to guest REPL
%%%% Starting test rsync  (Writing full log to "rsync.log")
marionette is ready
/gnu/store/bd5d1fvym8vf0gg40w27r5gx1c1d2y9w-rsync-test-builder:1: FAIL PID file
/gnu/store/bd5d1fvym8vf0gg40w27r5gx1c1d2y9w-rsync-test-builder:1: FAIL Test file copied to share
/gnu/store/bd5d1fvym8vf0gg40w27r5gx1c1d2y9w-rsync-test-builder:1: FAIL Test file correctly received from share
# of expected passes      1
# of unexpected failures  3
note: keeping build directory `/tmp/guix-build-rsync-test.drv-1'
builder for `/gnu/store/9cwg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv' failed with exit code 1
@ build-failed /gnu/store/9cwg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv - 1 builder for `/gnu/store/9cwg1i8czpcpiqq9b28kmz6vrmrgf437-rsync-test.drv' failed with exit code 1
TOTAL: 1
FAIL: /gnu/store/jzg2zwsbjxvc4vy5nqgvwmgx5jacjw1s-rsync-test
make: *** [Makefile:5218: check-system] Error 1

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-10 18:56                 ` Oleg Pykhalov
@ 2017-08-11 19:28                   ` Oleg Pykhalov
  2017-08-12  6:59                     ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-11 19:28 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Hello,

> Hello Christopher,
>
> Thank you for supporting this patch!
>
> Christopher Baines <mail@cbaines.net> writes:
>
>> On Thu, 10 Aug 2017 08:18:20 +0100
>> Christopher Baines <mail@cbaines.net> wrote:
>>
>>> I've attached the beginnings of a system test for this. I haven't got
>>> as far as actually testing the service directly yet, but I'm going to
>>> try testing it, both when running as root, and when not running as
>>> root.
>>> 
>>> A VM start script can be created from this rsync.scm file, by running:
>>>   guix system vm gnu/tests/rsync.scm
>>> 
>>> Also, the test itself can be run by doing:
>>>   make check-system TESTS=rsync
>>
>> I've now got around to actually testing the service. I've attached a
>> patch which creates two system tests. One which tests the service with
>> the default port, and one with a higher port (I randomly picked 2000).
>>
>> The default port test currently passes, but the higher port one
>> currently fails as the rsync service can't create the PID file.
>>
>> One option to fix this would be to create a /var/run/rsync directory
>> which is owned by the rsyncd user, and then create the PID file
>> as /var/run/rsync/pid.
>
> I'll check it later, if you'll not be faster than me.  :-)
>
>> Just let me know if you have any questions?
> …
>
> I successfully passed you previous patch test, but the new patch one
> with two “ports” fails.

Trying to understand what is going on.  Working on your latest test
patch.

This is what I currently have.  It's not differ from your patch except
commented test below.  guix/gnu/tests/rsync.scm
https://paste.pound-python.org/raw/ZyfPIvOWAbPd7blPRXf7/

I fully commented
(test-equal "Test file correctly received from share" …).

(test-assert "Test file copied to share"
  …
  (zero? ; ERROR HERE
   (system* "rsync" "/tmp/input" "localhost::files/")))

Bottom of test log:
--8<---------------cut here---------------start------------->8---
rsync: mkstemp ".input.Y6OhRW" (in files) failed: Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
QEMU runs as PID 5
connected to QEMU's monitor
read QEMU monitor prompt
connected to guest REPL
%%%% Starting test rsync  (Writing full log to "rsync.log")
marionette is ready
/gnu/store/bm3kvdwh8q3spvhxbmpmcjwz3fng8z5f-rsync-test-builder:1: FAIL Test file copied to share
# of expected passes      2
# of unexpected failures  1
note: keeping build directory `/tmp/guix-build-rsync-test.drv-9'
builder for `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed with exit code 1
@ build-failed /gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv - 1 builder for `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed with exit code 1
TOTAL: 1
FAIL: /gnu/store/s0rwmr3iha48jbw2b9xkzcqqsamdl21q-rsync-test
make: *** [Makefile:5217: check-system] Error 1
--8<---------------cut here---------------end--------------->8---

Also, I have (is related?) error on top of test log.
--8<---------------cut here---------------start------------->8---
natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system TESTS=rsync-with-default-port
Compiling Scheme modules...
warning: failed to load '(gnu tests admin)':
ERROR: In procedure allocate-struct: Wrong type argument in position 2: 8
--8<---------------cut here---------------end--------------->8---

Best wishes,

Oleg.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-11 19:28                   ` Oleg Pykhalov
@ 2017-08-12  6:59                     ` Christopher Baines
  2017-08-12 13:13                       ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-12  6:59 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 3991 bytes --]

On Fri, 11 Aug 2017 22:28:22 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Hello,
> 
> > Hello Christopher,
> >
> > Thank you for supporting this patch!
> >
> > Christopher Baines <mail@cbaines.net> writes:
> >  
> >> On Thu, 10 Aug 2017 08:18:20 +0100
> >> Christopher Baines <mail@cbaines.net> wrote:
> >>  
> >>> I've attached the beginnings of a system test for this. I haven't
> >>> got as far as actually testing the service directly yet, but I'm
> >>> going to try testing it, both when running as root, and when not
> >>> running as root.
> >>> 
> >>> A VM start script can be created from this rsync.scm file, by
> >>> running: guix system vm gnu/tests/rsync.scm
> >>> 
> >>> Also, the test itself can be run by doing:
> >>>   make check-system TESTS=rsync  
> >>
> >> I've now got around to actually testing the service. I've attached
> >> a patch which creates two system tests. One which tests the
> >> service with the default port, and one with a higher port (I
> >> randomly picked 2000).
> >>
> >> The default port test currently passes, but the higher port one
> >> currently fails as the rsync service can't create the PID file.
> >>
> >> One option to fix this would be to create a /var/run/rsync
> >> directory which is owned by the rsyncd user, and then create the
> >> PID file as /var/run/rsync/pid.  
> >
> > I'll check it later, if you'll not be faster than me.  :-)
> >  
> >> Just let me know if you have any questions?  
> > …
> >
> > I successfully passed you previous patch test, but the new patch one
> > with two “ports” fails.  
> 
> Trying to understand what is going on.  Working on your latest test
> patch.
> 
> This is what I currently have.  It's not differ from your patch except
> commented test below.  guix/gnu/tests/rsync.scm
> https://paste.pound-python.org/raw/ZyfPIvOWAbPd7blPRXf7/
> 
> I fully commented
> (test-equal "Test file correctly received from share" …).
> 
> (test-assert "Test file copied to share"
>   …
>   (zero? ; ERROR HERE
>    (system* "rsync" "/tmp/input" "localhost::files/")))
> 
> Bottom of test log:
> --8<---------------cut here---------------start------------->8---
> rsync: mkstemp ".input.Y6OhRW" (in files) failed: Permission denied
> (13) rsync error: some files/attrs were not transferred (see previous
> errors) (code 23) at main.c(1178) [sender=3.1.2] QEMU runs as PID 5
> connected to QEMU's monitor
> read QEMU monitor prompt
> connected to guest REPL
> %%%% Starting test rsync  (Writing full log to "rsync.log")
> marionette is ready
> /gnu/store/bm3kvdwh8q3spvhxbmpmcjwz3fng8z5f-rsync-test-builder:1:
> FAIL Test file copied to share # of expected passes      2
> # of unexpected failures  1
> note: keeping build directory `/tmp/guix-build-rsync-test.drv-9'
> builder for
> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
> with exit code 1 @
> build-failed /gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv
> - 1 builder for
> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
> with exit code 1 TOTAL: 1
> FAIL: /gnu/store/s0rwmr3iha48jbw2b9xkzcqqsamdl21q-rsync-test make:
> *** [Makefile:5217: check-system] Error 1 --8<---------------cut
> here---------------end--------------->8---

With the change to add the uid to the rsync configuration file, the
rsync-with-default-port passes for me. What test are you running here?


> Also, I have (is related?) error on top of test log.
> --8<---------------cut here---------------start------------->8---
> natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system
> TESTS=rsync-with-default-port Compiling Scheme modules...
> warning: failed to load '(gnu tests admin)':
> ERROR: In procedure allocate-struct: Wrong type argument in position
> 2: 8 --8<---------------cut here---------------end--------------->8---

I think I may have seen this error too, no idea what it relates to
though.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-12  6:59                     ` Christopher Baines
@ 2017-08-12 13:13                       ` Oleg Pykhalov
  2017-08-12 17:46                         ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-12 13:13 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Hello Christopher,

Christopher Baines <mail@cbaines.net> writes:

…
>> >> On Thu, 10 Aug 2017 08:18:20 +0100
>> >> Christopher Baines <mail@cbaines.net> wrote:
>> >>  
>> >>> I've attached the beginnings of a system test for this. I haven't
>> >>> got as far as actually testing the service directly yet, but I'm
>> >>> going to try testing it, both when running as root, and when not
>> >>> running as root.
>> >>> 
>> >>> A VM start script can be created from this rsync.scm file, by
>> >>> running: guix system vm gnu/tests/rsync.scm
>> >>> 
>> >>> Also, the test itself can be run by doing:
>> >>>   make check-system TESTS=rsync  
>> >>
>> >> I've now got around to actually testing the service. I've attached
>> >> a patch which creates two system tests. One which tests the
>> >> service with the default port, and one with a higher port (I
>> >> randomly picked 2000).
>> >>
>> >> The default port test currently passes, but the higher port one
>> >> currently fails as the rsync service can't create the PID file.
>> >>
>> >> One option to fix this would be to create a /var/run/rsync
>> >> directory which is owned by the rsyncd user, and then create the
>> >> PID file as /var/run/rsync/pid.  
>> >
>> > I'll check it later, if you'll not be faster than me.  :-)
>> >  
>> >> Just let me know if you have any questions?  
>> > …
>> >
>> > I successfully passed you previous patch test, but the new patch one
>> > with two “ports” fails.  
>> 
>> Trying to understand what is going on.  Working on your latest test
>> patch.
>> 
>> This is what I currently have.  It's not differ from your patch except
>> commented test below.  guix/gnu/tests/rsync.scm
>> https://paste.pound-python.org/raw/ZyfPIvOWAbPd7blPRXf7/
>> 
>> I fully commented
>> (test-equal "Test file correctly received from share" …).
>> 
>> (test-assert "Test file copied to share"
>>   …
>>   (zero? ; ERROR HERE
>>    (system* "rsync" "/tmp/input" "localhost::files/")))
>> 
>> Bottom of test log:
>> --8<---------------cut here---------------start------------->8---
>> rsync: mkstemp ".input.Y6OhRW" (in files) failed: Permission denied
>> (13) rsync error: some files/attrs were not transferred (see previous
>> errors) (code 23) at main.c(1178) [sender=3.1.2] QEMU runs as PID 5
>> connected to QEMU's monitor
>> read QEMU monitor prompt
>> connected to guest REPL
>> %%%% Starting test rsync  (Writing full log to "rsync.log")
>> marionette is ready
>> /gnu/store/bm3kvdwh8q3spvhxbmpmcjwz3fng8z5f-rsync-test-builder:1:
>> FAIL Test file copied to share # of expected passes      2
>> # of unexpected failures  1
>> note: keeping build directory `/tmp/guix-build-rsync-test.drv-9'
>> builder for
>> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
>> with exit code 1 @
>> build-failed /gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv
>> - 1 builder for
>> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
>> with exit code 1 TOTAL: 1
>> FAIL: /gnu/store/s0rwmr3iha48jbw2b9xkzcqqsamdl21q-rsync-test make:
>> *** [Makefile:5217: check-system] Error 1 --8<---------------cut
>> here---------------end--------------->8---
>
> With the change to add the uid to the rsync configuration file, the
> rsync-with-default-port passes for me. What test are you running here?

It was “rsync-with-default-port”.  With “uid” passed successfully all
tests in “rsync-with-default-port”.

Test 2000 port
==============

The “test-rsync-with-port-2000” fails, because we sync with default
rsync protocol port in this test but we need 2000.

--8<---------------cut here---------------start------------->8---
(test-assert "Test file copied to share"
  …
  (system* "rsync" "/tmp/input" "localhost::files/"))
--8<---------------cut here---------------end--------------->8---

Why I thought about this:
--8<---------------cut here---------------start------------->8---
rsync: failed to connect to localhost (127.0.0.1): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [sender=3.1.2]
rsync: failed to connect to localhost (127.0.0.1): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
--8<---------------cut here---------------end--------------->8---

Next lines:
--8<---------------cut here---------------start------------->8---
ice-9/eval.scm:387:11: In procedure eval:
ice-9/eval.scm:387:11: In procedure open-file: No such file or directory: "/tmp/output"
QEMU runs as PID 5
connected to QEMU's monitor
read QEMU monitor prompt
connected to guest REPL
%%%% Starting test rsync  (Writing full log to "rsync.log")
marionette is ready
/gnu/store/ahmg6h2fnap2znwhl6b4jrjgp830h4dv-rsync-test-builder:1: FAIL Test file copied to share
/gnu/store/ahmg6h2fnap2znwhl6b4jrjgp830h4dv-rsync-test-builder:1: FAIL Test file correctly received from share
# of expected passes      2
# of unexpected failures  2
note: keeping build directory `/tmp/guix-build-rsync-test.drv-13'
builder for `/gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv' failed with exit code 1
@ build-failed /gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv - 1 builder for `/gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv' failed with exit code 1
TOTAL: 1
FAIL: /gnu/store/rmb3hywspr34fwp5xinphaml7c4xjpvk-rsync-test
make: *** [Makefile:5217: check-system] Error 1
--8<---------------cut here---------------end--------------->8---

I only fixed PID error in current moment.

gnu/tests/rsync.scm
https://paste.pound-python.org/raw/D4ccInuJG0g0899GCdy2/

gnu/services/rsync.scm
https://paste.pound-python.org/raw/URDLeIV3XFZ29SjcZYc6/

>> Also, I have (is related?) error on top of test log.
>> --8<---------------cut here---------------start------------->8---
>> natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system
>> TESTS=rsync-with-default-port Compiling Scheme modules...
>> warning: failed to load '(gnu tests admin)':
>> ERROR: In procedure allocate-struct: Wrong type argument in position
>> 2: 8 --8<---------------cut here---------------end--------------->8---
>
> I think I may have seen this error too, no idea what it relates to
> though.

Should we report this as a bug?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-12 13:13                       ` Oleg Pykhalov
@ 2017-08-12 17:46                         ` Christopher Baines
  2017-08-12 20:19                           ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-12 17:46 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 7345 bytes --]

On Sat, 12 Aug 2017 16:13:11 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Hello Christopher,
> 
> Christopher Baines <mail@cbaines.net> writes:
> 
> …
> >> >> On Thu, 10 Aug 2017 08:18:20 +0100
> >> >> Christopher Baines <mail@cbaines.net> wrote:
> >> >>    
> >> >>> I've attached the beginnings of a system test for this. I
> >> >>> haven't got as far as actually testing the service directly
> >> >>> yet, but I'm going to try testing it, both when running as
> >> >>> root, and when not running as root.
> >> >>> 
> >> >>> A VM start script can be created from this rsync.scm file, by
> >> >>> running: guix system vm gnu/tests/rsync.scm
> >> >>> 
> >> >>> Also, the test itself can be run by doing:
> >> >>>   make check-system TESTS=rsync    
> >> >>
> >> >> I've now got around to actually testing the service. I've
> >> >> attached a patch which creates two system tests. One which
> >> >> tests the service with the default port, and one with a higher
> >> >> port (I randomly picked 2000).
> >> >>
> >> >> The default port test currently passes, but the higher port one
> >> >> currently fails as the rsync service can't create the PID file.
> >> >>
> >> >> One option to fix this would be to create a /var/run/rsync
> >> >> directory which is owned by the rsyncd user, and then create the
> >> >> PID file as /var/run/rsync/pid.    
> >> >
> >> > I'll check it later, if you'll not be faster than me.  :-)
> >> >    
> >> >> Just let me know if you have any questions?    
> >> > …
> >> >
> >> > I successfully passed you previous patch test, but the new patch
> >> > one with two “ports” fails.    
> >> 
> >> Trying to understand what is going on.  Working on your latest test
> >> patch.
> >> 
> >> This is what I currently have.  It's not differ from your patch
> >> except commented test below.  guix/gnu/tests/rsync.scm
> >> https://paste.pound-python.org/raw/ZyfPIvOWAbPd7blPRXf7/
> >> 
> >> I fully commented
> >> (test-equal "Test file correctly received from share" …).
> >> 
> >> (test-assert "Test file copied to share"
> >>   …
> >>   (zero? ; ERROR HERE
> >>    (system* "rsync" "/tmp/input" "localhost::files/")))
> >> 
> >> Bottom of test log:
> >> --8<---------------cut here---------------start------------->8---
> >> rsync: mkstemp ".input.Y6OhRW" (in files) failed: Permission denied
> >> (13) rsync error: some files/attrs were not transferred (see
> >> previous errors) (code 23) at main.c(1178) [sender=3.1.2] QEMU
> >> runs as PID 5 connected to QEMU's monitor
> >> read QEMU monitor prompt
> >> connected to guest REPL
> >> %%%% Starting test rsync  (Writing full log to "rsync.log")
> >> marionette is ready
> >> /gnu/store/bm3kvdwh8q3spvhxbmpmcjwz3fng8z5f-rsync-test-builder:1:
> >> FAIL Test file copied to share # of expected passes      2
> >> # of unexpected failures  1
> >> note: keeping build directory `/tmp/guix-build-rsync-test.drv-9'
> >> builder for
> >> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
> >> with exit code 1 @
> >> build-failed /gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv
> >> - 1 builder for
> >> `/gnu/store/1hv9c616m9xkgi549hgbn1y2vr8mnzfr-rsync-test.drv' failed
> >> with exit code 1 TOTAL: 1
> >> FAIL: /gnu/store/s0rwmr3iha48jbw2b9xkzcqqsamdl21q-rsync-test make:
> >> *** [Makefile:5217: check-system] Error 1 --8<---------------cut
> >> here---------------end--------------->8---  
> >
> > With the change to add the uid to the rsync configuration file, the
> > rsync-with-default-port passes for me. What test are you running
> > here?  
> 
> It was “rsync-with-default-port”.  With “uid” passed successfully all
> tests in “rsync-with-default-port”.
> 
> Test 2000 port
> ==============
> 
> The “test-rsync-with-port-2000” fails, because we sync with default
> rsync protocol port in this test but we need 2000.
> 
> --8<---------------cut here---------------start------------->8---
> (test-assert "Test file copied to share"
>   …
>   (system* "rsync" "/tmp/input" "localhost::files/"))
> --8<---------------cut here---------------end--------------->8---
> 
> Why I thought about this:
> --8<---------------cut here---------------start------------->8---
> rsync: failed to connect to localhost (127.0.0.1): Connection refused
> (111) rsync error: error in socket IO (code 10) at
> clientserver.c(125) [sender=3.1.2] rsync: failed to connect to
> localhost (127.0.0.1): Connection refused (111) rsync error: error in
> socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
> --8<---------------cut here---------------end--------------->8---
> 
> Next lines:
> --8<---------------cut here---------------start------------->8---
> ice-9/eval.scm:387:11: In procedure eval:
> ice-9/eval.scm:387:11: In procedure open-file: No such file or
> directory: "/tmp/output" QEMU runs as PID 5
> connected to QEMU's monitor
> read QEMU monitor prompt
> connected to guest REPL
> %%%% Starting test rsync  (Writing full log to "rsync.log")
> marionette is ready
> /gnu/store/ahmg6h2fnap2znwhl6b4jrjgp830h4dv-rsync-test-builder:1:
> FAIL Test file copied to
> share /gnu/store/ahmg6h2fnap2znwhl6b4jrjgp830h4dv-rsync-test-builder:1:
> FAIL Test file correctly received from share # of expected
> passes      2 # of unexpected failures  2 note: keeping build
> directory `/tmp/guix-build-rsync-test.drv-13' builder for
> `/gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv' failed
> with exit code 1 @
> build-failed /gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv
> - 1 builder for
> `/gnu/store/9fakmd8dqzdw1ybff6gb00qfzhrwqdis-rsync-test.drv' failed
> with exit code 1 TOTAL: 1
> FAIL: /gnu/store/rmb3hywspr34fwp5xinphaml7c4xjpvk-rsync-test make:
> *** [Makefile:5217: check-system] Error 1 --8<---------------cut
> here---------------end--------------->8---
> 
> I only fixed PID error in current moment.
> 
> gnu/tests/rsync.scm
> https://paste.pound-python.org/raw/D4ccInuJG0g0899GCdy2/
> 
> gnu/services/rsync.scm
> https://paste.pound-python.org/raw/URDLeIV3XFZ29SjcZYc6/

Yep, I think I just stopped writing the test after finding the issue
with the PID file.

I haven't looked in to how to fix this in the test, so if you could,
that would be great. Otherwise, I'll probably have time to look at this
again within a week or so.

You'll probably need to refactor the test a bit, as at the moment, the
information regarding the port isn't available where you run the
commands.

> >> Also, I have (is related?) error on top of test log.
> >> --8<---------------cut here---------------start------------->8---
> >> natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system
> >> TESTS=rsync-with-default-port Compiling Scheme modules...
> >> warning: failed to load '(gnu tests admin)':
> >> ERROR: In procedure allocate-struct: Wrong type argument in
> >> position 2: 8 --8<---------------cut
> >> here---------------end--------------->8---  
> >
> > I think I may have seen this error too, no idea what it relates to
> > though.  
> 
> Should we report this as a bug?

Ideally yes, but I have no idea where the bug might be. I guess it
might be Guile, as I didn't find anything named allocate-struct in Guix.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-12 17:46                         ` Christopher Baines
@ 2017-08-12 20:19                           ` Oleg Pykhalov
  2017-08-12 21:19                             ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-12 20:19 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Christopher Baines <mail@cbaines.net> writes:

…

> Yep, I think I just stopped writing the test after finding the issue
> with the PID file.
>
> I haven't looked in to how to fix this in the test, so if you could,
> that would be great. Otherwise, I'll probably have time to look at this
> again within a week or so.
>
> You'll probably need to refactor the test a bit, as at the moment, the
> information regarding the port isn't available where you run the
> commands.

Of course I'll try.  By the way, how to run a “vm”?  Previous method
“./pre-inst-env guix system vm gnu/tests/rsync.scm” doesn't work for me.

--8<---------------cut here---------------start------------->8---
Backtrace:
           5 (primitive-load "/home/natsu/src/guix/scripts/guix")
In guix/ui.scm:
  1331:12  4 (run-guix-command _ . _)
In ice-9/boot-9.scm:
    837:9  3 (catch _ _ #<procedure 7f61aed3b8c0 at guix/ui.scm:448:2 (key c)> _)
    837:9  2 (catch _ _ #<procedure 7f61aed3b8d8 at guix/ui.scm:536:6 (key pro…> …)
In guix/scripts/system.scm:
   1026:8  1 (_)
   905:28  0 (process-action vm _ ((argument . "gnu/tests/rsync.scm") (# . vm) …))

guix/scripts/system.scm:905:28: In procedure process-action:
guix/scripts/system.scm:905:28: In procedure struct_vtable: Wrong type argument in position 1 (expecting struct): #<unspecified>--8<---------------cut here---------------end--------------->8---

>> >> Also, I have (is related?) error on top of test log.
>> >> --8<---------------cut here---------------start------------->8---
>> >> natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system
>> >> TESTS=rsync-with-default-port Compiling Scheme modules...
>> >> warning: failed to load '(gnu tests admin)':
>> >> ERROR: In procedure allocate-struct: Wrong type argument in
>> >> position 2: 8 --8<---------------cut
>> >> here---------------end--------------->8---  
>> >
>> > I think I may have seen this error too, no idea what it relates to
>> > though.  
>> 
>> Should we report this as a bug?
>
> Ideally yes, but I have no idea where the bug might be. I guess it
> might be Guile, as I didn't find anything named allocate-struct in Guix.

Also for a good bug report we need to understand “What fails” and “What
you expect”, I guess.  Will be a challenge.  :-)

-- 
Best regards,

Oleg.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-12 20:19                           ` Oleg Pykhalov
@ 2017-08-12 21:19                             ` Christopher Baines
  2017-08-19 20:34                               ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-12 21:19 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]

On Sat, 12 Aug 2017 23:19:44 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Christopher Baines <mail@cbaines.net> writes:
> 
> …
> 
> > Yep, I think I just stopped writing the test after finding the issue
> > with the PID file.
> >
> > I haven't looked in to how to fix this in the test, so if you could,
> > that would be great. Otherwise, I'll probably have time to look at
> > this again within a week or so.
> >
> > You'll probably need to refactor the test a bit, as at the moment,
> > the information regarding the port isn't available where you run the
> > commands.  
> 
> Of course I'll try.  By the way, how to run a “vm”?  Previous method
> “./pre-inst-env guix system vm gnu/tests/rsync.scm” doesn't work for
> me.

I'm guessing that you'll need to make the file evaluate (I'm not sure if
that is the right word here) to an operating-system, e.g. put
%rsync-os-with-port-2000 right at the bottom of the file, and then guix
system vm should give you a start script that will start a VM for that
OS.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-12 21:19                             ` Christopher Baines
@ 2017-08-19 20:34                               ` Oleg Pykhalov
  2017-08-19 22:19                                 ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-19 20:34 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

Hello Christopher,

Christopher Baines <mail@cbaines.net> writes:

>> > Yep, I think I just stopped writing the test after finding the issue
>> > with the PID file.
>> >
>> > I haven't looked in to how to fix this in the test, so if you could,
>> > that would be great. Otherwise, I'll probably have time to look at
>> > this again within a week or so.
>> >
>> > You'll probably need to refactor the test a bit, as at the moment,
>> > the information regarding the port isn't available where you run the
>> > commands.  
>> 
>> Of course I'll try.  By the way, how to run a “vm”?  Previous method
>> “./pre-inst-env guix system vm gnu/tests/rsync.scm” doesn't work for
>> me.
>
> I'm guessing that you'll need to make the file evaluate (I'm not sure if
> that is the right word here) to an operating-system, e.g. put
> %rsync-os-with-port-2000 right at the bottom of the file, and then guix
> system vm should give you a start script that will start a VM for that
> OS.

I did some work on rsync service:

- Fixed PID and synchronization to specific port.
- Merged two rsync oses in one with optional port.
- Added ports to rsync synchronization tests and change protocol from
  ssh to rsync.
- Added some logic to config: chroot (can use only root), user and
  group.

All tests passed successfully for me.


[-- Attachment #2: [PATCH] gnu: Add rsync service. --]
[-- Type: text/x-patch, Size: 15822 bytes --]

From 21ccef0c4fa23949d6a59e317d2e258f18ec8f5a Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  67 ++++++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 153 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 136 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 358 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 6b4b19d0c..35833ea68 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15820,6 +15820,73 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection Incremental file transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#f})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"rsyncd"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"rsyncd"})
+Group of the @code{rsync} process.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index ff4777765..a1cace5ec 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -444,6 +444,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -487,6 +488,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/web.scm
 
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..695ea9bd5
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,153 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package ;package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number ;integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file ;string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file ;string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file ;string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot? ;boolean
+                 (default #f))
+  (share-path    rsync-configuration-share-path ;string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment ;string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only? ;boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout ;integer
+                 (default 300))
+  (user          rsync-configuration-user ;string
+                 (default "rsyncd"))
+  (group         rsync-configuration-group ;string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user  (rsync-configuration-user config))
+        (rsync-group (rsync-configuration-group config)))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory "/var/run/rsyncd")
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-directory #$(rsync-configuration-share-path config))
+            (user            (getpw #$(rsync-configuration-user config)))
+            (group           (getpw #$(rsync-configuration-group config))))
+        (and=> share-directory mkdir-p)
+        (chown share-directory
+               (passwd:uid user)
+               (group:gid group)))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (match config
+    (($ <rsync-configuration> package port-number pid-file
+                              lock-file log-file use-chroot? share-path
+                              share-comment read-only? timeout user group)
+     (mixed-text-file
+      "rsync.conf"
+      "# Generated by 'rsync-service'.\n"
+      "pid file = " pid-file "\n"
+      "lock file = " lock-file "\n"
+      "log file = " log-file "\n"
+      "port = " (number->string port-number) "\n"
+      "use chroot = " (if (and use-chroot?
+                               (eq? user "root"))
+                          "true" "false")
+      "\n"
+      (if (or (eq? user "root") (<= port-number 1024))
+          (string-append "uid = " user "\n") "")
+      (if (or (eq? user "root") (<= port-number 1024))
+          (string-append "gid = " group "\n") "")
+      "\n"
+      "[files]\n"
+      "path = " share-path "\n"
+      "comment = " share-comment "\n"
+      "read only = " (if read-only? "true" "false") "\n"
+      "timeout = " (number->string timeout) "\n"))))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (let* ((rsync        (rsync-configuration-package config))
+         (pid-file     (rsync-configuration-pid-file config))
+         (port-number  (rsync-configuration-port-number config))
+         (user         (if (> port-number 1024)
+                           (rsync-configuration-user config)
+                           "root"))
+         (group        (if (> port-number 1024)
+                           (rsync-configuration-group config)
+                           "root")))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$group))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..782c2355c
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,136 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync-with-default-port
+            %test-rsync-with-port-2000))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* (%rsync-os #:optional (rsync-port 581))
+  ;; Operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number rsync-port))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync-with-default-port
+  (system-test
+   (name "rsync-with-default-port")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test (%rsync-os)))))
+
+(define %test-rsync-with-port-2000
+  (let ((port 2000))
+    (system-test
+     (name "rsync-with-port-2000")
+     (description "Connect to a running RSYNC server.")
+     (value (run-rsync-test (%rsync-os port) port)))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-19 20:34                               ` Oleg Pykhalov
@ 2017-08-19 22:19                                 ` Christopher Baines
  2017-08-24 22:40                                   ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-19 22:19 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 3421 bytes --]

On Sat, 19 Aug 2017 23:34:20 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Hello Christopher,
> 
> Christopher Baines <mail@cbaines.net> writes:
> 
> >> > Yep, I think I just stopped writing the test after finding the
> >> > issue with the PID file.
> >> >
> >> > I haven't looked in to how to fix this in the test, so if you
> >> > could, that would be great. Otherwise, I'll probably have time
> >> > to look at this again within a week or so.
> >> >
> >> > You'll probably need to refactor the test a bit, as at the
> >> > moment, the information regarding the port isn't available where
> >> > you run the commands.    
> >> 
> >> Of course I'll try.  By the way, how to run a “vm”?  Previous
> >> method “./pre-inst-env guix system vm gnu/tests/rsync.scm” doesn't
> >> work for me.  
> >
> > I'm guessing that you'll need to make the file evaluate (I'm not
> > sure if that is the right word here) to an operating-system, e.g.
> > put %rsync-os-with-port-2000 right at the bottom of the file, and
> > then guix system vm should give you a start script that will start
> > a VM for that OS.  
> 
> I did some work on rsync service:
> 
> - Fixed PID and synchronization to specific port.
> - Merged two rsync oses in one with optional port.
> - Added ports to rsync synchronization tests and change protocol from
>   ssh to rsync.
> - Added some logic to config: chroot (can use only root), user and
>   group.
> 
> All tests passed successfully for me.

Great :) Now that the tests pass at least, I don't see any reason to
not merge this soonish.

I've still done some thingking about how the configuration works
though, and I've been considering a few ways of tweaking this so that
its harder to break, and clear in how it works.

One way I've managed to break the service so far is setting the user
and group to root in the configuration. This causes the tests to fail,
and in a odd way, as I think the problem is that the creation of
the /var/run/rsync directory relies on the account service, but I'm
guessing that the account service does nothing in this case, as root is
already an account.

One way of making this harder to break would be to explicitly create
the necessary directories when this service is activated, e.g.:

  (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
  (mkdir-p (dirname #$(rsync-configuration-lock-file config)))

I think there is also the opportunity to make the service configuration
clearer here, as considering the default port test, the default
configuration says it will run as the rsync user, but the service will
actually run as the root user.

This could be improved by making the configuration more uncertain by
default, e.g. user defaults to #f, which means the correct user is
decided based on the port.

Also on the subject of clarity, the use-chroot? option is something
that can be specified, but the value might not be used. My preference
would be to change the "logic" in the configuration file generation, to
validation, e.g.:

  (if (and use-chroot? (not (eq? user "root")))
      (error "rsync-service: to run rsync in a chroot, the user must be root"))

The use-chroot? option might also benefit from making the user default
to #f, as then the service could decide the user based on the port and
use-chroot? settings, without contradicting the configuration.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-19 22:19                                 ` Christopher Baines
@ 2017-08-24 22:40                                   ` Oleg Pykhalov
  2017-08-30 23:59                                     ` Christopher Baines
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-08-24 22:40 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 4158 bytes --]

Hello Christopher,

Christopher Baines <mail@cbaines.net> writes:

>> >> > Yep, I think I just stopped writing the test after finding the
>> >> > issue with the PID file.
>> >> >
>> >> > I haven't looked in to how to fix this in the test, so if you
>> >> > could, that would be great. Otherwise, I'll probably have time
>> >> > to look at this again within a week or so.
>> >> >
>> >> > You'll probably need to refactor the test a bit, as at the
>> >> > moment, the information regarding the port isn't available where
>> >> > you run the commands.    
>> >> 
>> >> Of course I'll try.  By the way, how to run a “vm”?  Previous
>> >> method “./pre-inst-env guix system vm gnu/tests/rsync.scm” doesn't
>> >> work for me.  
>> >
>> > I'm guessing that you'll need to make the file evaluate (I'm not
>> > sure if that is the right word here) to an operating-system, e.g.
>> > put %rsync-os-with-port-2000 right at the bottom of the file, and
>> > then guix system vm should give you a start script that will start
>> > a VM for that OS.  
>> 
>> I did some work on rsync service:
>> 
>> - Fixed PID and synchronization to specific port.
>> - Merged two rsync oses in one with optional port.
>> - Added ports to rsync synchronization tests and change protocol from
>>   ssh to rsync.
>> - Added some logic to config: chroot (can use only root), user and
>>   group.
>> 
>> All tests passed successfully for me.
>
> Great :) Now that the tests pass at least, I don't see any reason to
> not merge this soonish.
>
> I've still done some thingking about how the configuration works
> though, and I've been considering a few ways of tweaking this so that
> its harder to break, and clear in how it works.
>
> One way I've managed to break the service so far is setting the user
> and group to root in the configuration. This causes the tests to fail,
> and in a odd way, as I think the problem is that the creation of
> the /var/run/rsync directory relies on the account service, but I'm
> guessing that the account service does nothing in this case, as root is
> already an account.
>
> One way of making this harder to break would be to explicitly create
> the necessary directories when this service is activated, e.g.:
>
>   (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
>   (mkdir-p (dirname #$(rsync-configuration-lock-file config)))
>
> I think there is also the opportunity to make the service configuration
> clearer here, as considering the default port test, the default
> configuration says it will run as the rsync user, but the service will
> actually run as the root user.
>
> This could be improved by making the configuration more uncertain by
> default, e.g. user defaults to #f, which means the correct user is
> decided based on the port.
>
> Also on the subject of clarity, the use-chroot? option is something
> that can be specified, but the value might not be used. My preference
> would be to change the "logic" in the configuration file generation, to
> validation, e.g.:
>
>   (if (and use-chroot? (not (eq? user "root")))
>       (error "rsync-service: to run rsync in a chroot, the user must be root"))
>
> The use-chroot? option might also benefit from making the user default
> to #f, as then the service could decide the user based on the port and
> use-chroot? settings, without contradicting the configuration.

I tried to apply all your suggestion, but I really don't know why
'rsync-configuration-user' is ignored (it's always set to "rsyncd").

I use 'pk' to debug this, but still confused.

--8<---------------cut here---------------start------------->8---
;;; (rsync-config-file-config #<<rsync-configuration> package: #<package rsync@3.1.2 gnu/packages/rsync.scm:32 216af00> port-number: 581 pid-file: "/var/run/rsyncd/rsyncd.pid" lock-file: "/var/run/rsyncd/rsyncd.lock" log-file: "/var/log/rsyncd.log" use-chroot?: #f share-path: "/srv/rsyncd" share-comment: "Rsync share" read-only?: #f timeout: 300 user: "rsyncd" group: "rsyncd" uid: #f gid: #f>)
--8<---------------cut here---------------end--------------->8---


[-- Attachment #2: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 17255 bytes --]

From 4013506b89ecfd9cc5c59f3311dfa9b07bc140d3 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  67 +++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 170 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 136 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 375 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 6b4b19d0c..35833ea68 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15820,6 +15820,73 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection Incremental file transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#f})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"rsyncd"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"rsyncd"})
+Group of the @code{rsync} process.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index ff4777765..a1cace5ec 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -444,6 +444,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -487,6 +488,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/web.scm
 
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..769ad9c0c
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,170 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package              ; package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number          ; integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file             ; string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file            ; string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file             ; string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
+                 (default #f))
+  (share-path    rsync-configuration-share-path           ; string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment        ; string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only?           ; boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout              ; integer
+                 (default 300))
+  (user          rsync-configuration-user                 ; string
+                 (default "root"))
+  (group         rsync-configuration-group                ; string
+                 (default "root"))
+  (uid           rsync-configuration-uid
+                 (default #f))
+  (gid           rsync-configuration-gid
+                 (default #f)))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user  (rsync-configuration-user config))
+        (rsync-group (rsync-configuration-group config)))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory "/var/run/rsyncd")
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-directory #$(rsync-configuration-share-path config))
+            (user            #$(rsync-configuration-user config))
+            (group           #$(rsync-configuration-group config)))
+        (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
+        (and=> share-directory mkdir-p)
+        (if (not (eq? user "root"))
+            (chown share-directory
+                   (passwd:uid (getpw user))
+                   (group:gid (getpw group)))))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (let ((port-number   (rsync-configuration-port-number   (pk 'rsync-config-file-config config)))
+        (pid-file      (rsync-configuration-pid-file      config))
+        (lock-file     (rsync-configuration-lock-file     config))
+        (log-file      (rsync-configuration-log-file      config))
+        (use-chroot?   (rsync-configuration-use-chroot?   config))
+        (share-path    (rsync-configuration-share-path    config))
+        (share-comment (rsync-configuration-share-comment config))
+        (read-only?    (rsync-configuration-read-only?    config))
+        (timeout       (rsync-configuration-timeout       config))
+        (user          (rsync-configuration-user          config))
+        (group         (rsync-configuration-group         config))
+        (uid           (rsync-configuration-uid           config))
+        (gid           (rsync-configuration-gid           config)))
+    (if (not (eq? user "root"))
+        (begin
+          (if (<= port-number 1024)
+              (error (string-append "rsync-service: to run on port "
+                                    (number->string port-number)
+                                    ", user must be root.")))
+          (if use-chroot? (error (string-append
+                                  "rsync-service: to run in a chroot"
+                                  ", user must be root.")))
+          (if uid (error "rsync-service: to use uid, user must be root."))
+          (if gid (error "rsync-service: to use gid, user must be root."))))
+    (mixed-text-file
+     "rsync.conf"
+     "# Generated by 'rsync-service'.\n"
+     "pid file = " pid-file "\n"
+     "lock file = " lock-file "\n"
+     "log file = " log-file "\n"
+     "port = " (number->string port-number) "\n"
+     "use chroot = " (if use-chroot? "true" "false") "\n"
+     (if uid (string-append "uid = " uid "\n") "")
+     (if uid (string-append "gid = " gid "\n") "")
+     "\n"
+     "[files]\n"
+     "path = " share-path "\n"
+     "comment = " share-comment "\n"
+     "read only = " (if read-only? "true" "false") "\n"
+     "timeout = " (number->string timeout) "\n")))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (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)))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" (pk 'shepherd-rsync-config-file #$(rsync-config-file config))
+                           "--daemon")
+                     #:pid-file (pk 'shepherd-pid-file #$pid-file)
+                     #:user (pk 'shepherd-user #$user)
+                     #:group (pk 'shepherd-group #$group)))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..782c2355c
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,136 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync-with-default-port
+            %test-rsync-with-port-2000))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* (%rsync-os #:optional (rsync-port 581))
+  ;; Operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number rsync-port))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync-with-default-port
+  (system-test
+   (name "rsync-with-default-port")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test (%rsync-os)))))
+
+(define %test-rsync-with-port-2000
+  (let ((port 2000))
+    (system-test
+     (name "rsync-with-port-2000")
+     (description "Connect to a running RSYNC server.")
+     (value (run-rsync-test (%rsync-os port) port)))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-24 22:40                                   ` Oleg Pykhalov
@ 2017-08-30 23:59                                     ` Christopher Baines
  2017-08-31 13:04                                       ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-08-30 23:59 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

On Fri, 25 Aug 2017 01:40:43 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:
> I tried to apply all your suggestion, but I really don't know why
> 'rsync-configuration-user' is ignored (it's always set to "rsyncd").
> 
> I use 'pk' to debug this, but still confused.

For comparing strings in Guile, I think its more reliable to use equal?
rather than eq?, and I think this is the cause of the issues with the
validation. I don't get validation failures when using (equal? user
"root").

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-30 23:59                                     ` Christopher Baines
@ 2017-08-31 13:04                                       ` Ludovic Courtès
  2017-09-16 22:44                                         ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2017-08-31 13:04 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

Christopher Baines <mail@cbaines.net> skribis:

> On Fri, 25 Aug 2017 01:40:43 +0300
> Oleg Pykhalov <go.wigust@gmail.com> wrote:
>> I tried to apply all your suggestion, but I really don't know why
>> 'rsync-configuration-user' is ignored (it's always set to "rsyncd").
>> 
>> I use 'pk' to debug this, but still confused.
>
> For comparing strings in Guile, I think its more reliable to use equal?
> rather than eq?, and I think this is the cause of the issues with the
> validation. I don't get validation failures when using (equal? user
> "root").

Right, ‘eq?’ checks for pointer equality, so you shouldn’t use it unless
you really know what you’re doing.

As a rule of thumb, I recommend using type-specific predicates as much
as possible.  So if you’re comparing strings, use ‘string=?’; for
bytevectors, use ‘bytevector=?’; and so on.

This makes the intent clearer, and in a future with type inference and
the like, it will make it easier for the compiler to see whether we’re
doing the right thing.

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-08-31 13:04                                       ` Ludovic Courtès
@ 2017-09-16 22:44                                         ` Oleg Pykhalov
  2017-09-16 22:49                                           ` Oleg Pykhalov
  0 siblings, 1 reply; 32+ messages in thread
From: Oleg Pykhalov @ 2017-09-16 22:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]

Hello Guix,

apologies for a such big pause.

I replaced switching user depending on port with error messages, because
I think it's much clear and easy to support in future.
--8<---------------cut here---------------start------------->8---
(define (rsync-config-file config)
  …
  (if (not (string=? user "root"))
      (cond
       ((<= port-number 1024)
        (error (string-append "rsync-service: to run on port "
                              (number->string port-number)
                              ", user must be root.")))
       (use-chroot?
        (error (string-append "rsync-service: to run in a chroot"
                              ", user must be root.")))
       (uid
        (error "rsync-service: to use uid, user must be root."))
       (gid
        (error "rsync-service: to use gid, user must be root.")))))
--8<---------------cut here---------------end--------------->8---

I also add creating directory depending on uid/gid are specified:
--8<---------------cut here---------------start------------->8---
(define (rsync-activation config)
  "Return the activation GEXP for CONFIG."
  #~(begin
      (use-modules (guix build utils))
      (let ((share-directory  #$(rsync-configuration-share-path config))
            (user  (getpw (if #$(rsync-configuration-uid config)
                              #$(rsync-configuration-uid config)
                              #$(rsync-configuration-user config))))
            (group (getpw (if #$(rsync-configuration-gid config)
                              #$(rsync-configuration-gid config)
                              #$(rsync-configuration-group config)))))
        …)))
--8<---------------cut here---------------end--------------->8---

User and group set to "root", "uid" and gid set to "rsyncd" by default,
chroot is enabled.
--8<---------------cut here---------------start------------->8---
(define-record-type* <rsync-configuration>
  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
                 (default #t))
  …
  (user          rsync-configuration-user                 ; string
                 (default "root"))
  (group         rsync-configuration-group                ; string
                 (default "root"))
  (uid           rsync-configuration-uid                  ; string
                 (default "rsyncd"))
  (gid           rsync-configuration-gid                  ; string
                 (default "rsyncd")))
--8<---------------cut here---------------end--------------->8---

2000 port test removed.

%test-rsync passed.


[-- Attachment #2: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 17408 bytes --]

From 006915c4a47333ec9d789a0c954295e1e796496a Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  67 ++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 180 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 128 +++++++++++++++++++++++++++++++++++
 4 files changed, 377 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 1356a357c..85ce3a544 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16869,6 +16869,73 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection Incremental file transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#f})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"rsyncd"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"rsyncd"})
+Group of the @code{rsync} process.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index 418cc5e2a..fd252118d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -451,6 +451,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -497,6 +498,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/virtualization.scm			\
   %D%/tests/web.scm
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..ec61107b8
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,180 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration
+  make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package              ; package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number          ; integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file             ; string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file            ; string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file             ; string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
+                 (default #t))
+  (share-path    rsync-configuration-share-path           ; string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment        ; string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only?           ; boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout              ; integer
+                 (default 300))
+  (user          rsync-configuration-user                 ; string
+                 (default "root"))
+  (group         rsync-configuration-group                ; string
+                 (default "root"))
+  (uid           rsync-configuration-uid                  ; string
+                 (default "rsyncd"))
+  (gid           rsync-configuration-gid                  ; string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (if (rsync-configuration-uid config)
+                        (rsync-configuration-uid config)
+                        (rsync-configuration-user config)))
+        (rsync-group (if (rsync-configuration-gid config)
+                         (rsync-configuration-gid config)
+                         (rsync-configuration-group config))))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory "/var/run/rsyncd")
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-directory  #$(rsync-configuration-share-path config))
+            (user  (getpw (if #$(rsync-configuration-uid config)
+                              #$(rsync-configuration-uid config)
+                              #$(rsync-configuration-user config))))
+            (group (getpw (if #$(rsync-configuration-gid config)
+                              #$(rsync-configuration-gid config)
+                              #$(rsync-configuration-group config)))))
+        (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
+        (and=> share-directory mkdir-p)
+        (chown share-directory
+               (passwd:uid user)
+               (group:gid group)))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (let ((port-number   (rsync-configuration-port-number config))
+        (pid-file      (rsync-configuration-pid-file config))
+        (lock-file     (rsync-configuration-lock-file config))
+        (log-file      (rsync-configuration-log-file config))
+        (use-chroot?   (rsync-configuration-use-chroot? config))
+        (share-path    (rsync-configuration-share-path config))
+        (share-comment (rsync-configuration-share-comment config))
+        (read-only?    (rsync-configuration-read-only? config))
+        (timeout       (rsync-configuration-timeout config))
+        (user          (rsync-configuration-user config))
+        (group         (rsync-configuration-group config))
+        (uid           (rsync-configuration-uid config))
+        (gid           (rsync-configuration-gid config)))
+    (if (not (string=? user "root"))
+        (cond
+         ((<= port-number 1024)
+          (error (string-append "rsync-service: to run on port "
+                                (number->string port-number)
+                                ", user must be root.")))
+         (use-chroot?
+          (error (string-append "rsync-service: to run in a chroot"
+                                ", user must be root.")))
+         (uid
+          (error "rsync-service: to use uid, user must be root."))
+         (gid
+          (error "rsync-service: to use gid, user must be root."))))
+    (mixed-text-file
+     "rsync.conf"
+     "# Generated by 'rsync-service'.\n\n"
+     "pid file = " pid-file "\n"
+     "lock file = " lock-file "\n"
+     "log file = " log-file "\n"
+     "port = " (number->string port-number) "\n"
+     "use chroot = " (if use-chroot? "true" "false") "\n"
+     (if uid (string-append "uid = " uid "\n") "")
+     "gid = " (if gid gid "nogroup") "\n" ; no group nobody
+     "\n"
+     "[files]\n"
+     "path = " share-path "\n"
+     "comment = " share-comment "\n"
+     "read only = " (if read-only? "true" "false") "\n"
+     "timeout = " (number->string timeout) "\n")))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (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)))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" (pk 'shepherd-rsync-config-file #$(rsync-config-file config))
+                           "--daemon")
+                     #:pid-file (pk 'shepherd-pid-file #$pid-file)
+                     #:user (pk 'shepherd-user #$user)
+                     #:group (pk 'shepherd-group #$group)))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (pk 'rsync-config (rsync-configuration)))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..2b0aaf341
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,128 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* (%rsync-os #:optional (rsync-port 581))
+  "Return operating system under test."
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number rsync-port))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync
+  (system-test
+   (name "rsync-with-default-port")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test (%rsync-os)))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-09-16 22:44                                         ` Oleg Pykhalov
@ 2017-09-16 22:49                                           ` Oleg Pykhalov
  0 siblings, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-09-16 22:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27855

And if it's good enough now, I'll fix documentation with new changes.
Forgot to do it and mention about it, sorry.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] Status: [PATCH] gnu: Add rsync service.
  2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
                   ` (2 preceding siblings ...)
  2017-07-28 22:17 ` [bug#27855] [PATCH] gnu: Add rsync service Christopher Baines
@ 2017-09-17  8:40 ` Oleg Pykhalov
  2017-09-18  6:20 ` [bug#27855] " Christopher Baines
  4 siblings, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-09-17  8:40 UTC (permalink / raw)
  To: bug#27855

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

Hello Guix,

here are some improvements.

Remove all (pk) from service.

Set home directory according to rsync-user.
--8<---------------cut here---------------start------------->8---
(define (rsync-account config)
  (list …
         (home-directory (string-append "/var/run/"
                                        rsync-user)))))
--8<---------------cut here---------------end--------------->8---

Change name in test.
--8<---------------cut here---------------start------------->8---
(define %test-rsync
  (system-test
   (name "rsync")
   …))
--8<---------------cut here---------------end--------------->8---


[-- Attachment #2: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 17635 bytes --]

From 85ce8270afdfe4255ee5ebf0e185e99dcef8ad13 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  74 ++++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 181 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 128 ++++++++++++++++++++++++++++++++++
 4 files changed, 385 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 1356a357c..77c99e069 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16869,6 +16869,80 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
+@subsubsection Incremental file transfer
+
+The @code{(gnu services rsync)} module provides the following services:
+
+@subsubheading Rsync service
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type
+         (rsync-configuration))
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If
+port is less than @code{1024} @command{rsync} will be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#t})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"root"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"root"})
+Group of the @code{rsync} process.
+
+@item @code{uid} (default: @var{"rsyncd"})
+User name or user ID that file transfers to and from that module should take
+place as when the daemon was run as @code{root}.
+
+@item @code{gid} (default: @var{"rsyncd"})
+Group name or group ID that will be  used  when  accessing the  module.
+
+@end table
+@end deftp
+
 @node Setuid Programs
 @subsection Setuid Programs
 
diff --git a/gnu/local.mk b/gnu/local.mk
index 418cc5e2a..fd252118d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -451,6 +451,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -497,6 +498,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/virtualization.scm			\
   %D%/tests/web.scm
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..18c46ecfb
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,181 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration
+  make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package              ; package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number          ; integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file             ; string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file            ; string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file             ; string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
+                 (default #t))
+  (share-path    rsync-configuration-share-path           ; string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment        ; string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only?           ; boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout              ; integer
+                 (default 300))
+  (user          rsync-configuration-user                 ; string
+                 (default "root"))
+  (group         rsync-configuration-group                ; string
+                 (default "root"))
+  (uid           rsync-configuration-uid                  ; string
+                 (default "rsyncd"))
+  (gid           rsync-configuration-gid                  ; string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (if (rsync-configuration-uid config)
+                        (rsync-configuration-uid config)
+                        (rsync-configuration-user config)))
+        (rsync-group (if (rsync-configuration-gid config)
+                         (rsync-configuration-gid config)
+                         (rsync-configuration-group config))))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory (string-append "/var/run/"
+                                          rsync-user))
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((share-directory  #$(rsync-configuration-share-path config))
+            (user  (getpw (if #$(rsync-configuration-uid config)
+                              #$(rsync-configuration-uid config)
+                              #$(rsync-configuration-user config))))
+            (group (getpw (if #$(rsync-configuration-gid config)
+                              #$(rsync-configuration-gid config)
+                              #$(rsync-configuration-group config)))))
+        (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
+        (and=> share-directory mkdir-p)
+        (chown share-directory
+               (passwd:uid user)
+               (group:gid group)))))
+
+(define (rsync-config-file config)
+  "Return the rsync configuration file corresponding to CONFIG."
+  (let ((port-number   (rsync-configuration-port-number config))
+        (pid-file      (rsync-configuration-pid-file config))
+        (lock-file     (rsync-configuration-lock-file config))
+        (log-file      (rsync-configuration-log-file config))
+        (use-chroot?   (rsync-configuration-use-chroot? config))
+        (share-path    (rsync-configuration-share-path config))
+        (share-comment (rsync-configuration-share-comment config))
+        (read-only?    (rsync-configuration-read-only? config))
+        (timeout       (rsync-configuration-timeout config))
+        (user          (rsync-configuration-user config))
+        (group         (rsync-configuration-group config))
+        (uid           (rsync-configuration-uid config))
+        (gid           (rsync-configuration-gid config)))
+    (if (not (string=? user "root"))
+        (cond
+         ((<= port-number 1024)
+          (error (string-append "rsync-service: to run on port "
+                                (number->string port-number)
+                                ", user must be root.")))
+         (use-chroot?
+          (error (string-append "rsync-service: to run in a chroot"
+                                ", user must be root.")))
+         (uid
+          (error "rsync-service: to use uid, user must be root."))
+         (gid
+          (error "rsync-service: to use gid, user must be root."))))
+    (mixed-text-file
+     "rsync.conf"
+     "# Generated by 'rsync-service'.\n\n"
+     "pid file = " pid-file "\n"
+     "lock file = " lock-file "\n"
+     "log file = " log-file "\n"
+     "port = " (number->string port-number) "\n"
+     "use chroot = " (if use-chroot? "true" "false") "\n"
+     (if uid (string-append "uid = " uid "\n") "")
+     "gid = " (if gid gid "nogroup") "\n" ; no group nobody
+     "\n"
+     "[files]\n"
+     "path = " share-path "\n"
+     "comment = " share-comment "\n"
+     "read only = " (if read-only? "true" "false") "\n"
+     "timeout = " (number->string timeout) "\n")))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (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)))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$group))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..691b88e0d
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,128 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* (%rsync-os #:optional (rsync-port 581))
+  "Return operating system under test."
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number rsync-port))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync
+  (system-test
+   (name "rsync")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test (%rsync-os)))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
                   ` (3 preceding siblings ...)
  2017-09-17  8:40 ` [bug#27855] Status: " Oleg Pykhalov
@ 2017-09-18  6:20 ` Christopher Baines
  2017-09-23  1:47   ` Oleg Pykhalov
  4 siblings, 1 reply; 32+ messages in thread
From: Christopher Baines @ 2017-09-18  6:20 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 15025 bytes --]

> From 85ce8270afdfe4255ee5ebf0e185e99dcef8ad13 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust <at> gmail.com>
> Date: Thu, 27 Jul 2017 04:01:01 +0300
> Subject: [PATCH] gnu: Add rsync service.
> 
> * doc/guix.texi (Incremental file transfer): Add documentation.
> * gnu/services/rsync.scm (<rsync-configuration>): New record type.
> (rsync-accounts, rsync-shepherd-service): New service extensions.
> (rsync-service-type): New service type.
> * gnu/tests/rsync.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> ---
>  doc/guix.texi          |  74 ++++++++++++++++++++
>  gnu/local.mk           |   2 +
>  gnu/services/rsync.scm | 181
> +++++++++++++++++++++++++++++++++++++++++++++++++
> gnu/tests/rsync.scm    | 128 ++++++++++++++++++++++++++++++++++ 4
> files changed, 385 insertions(+) create mode 100644
> gnu/services/rsync.scm create mode 100644 gnu/tests/rsync.scm

Thanks for picking this up again Oleg, the changes you've made look
really good.

> diff --git a/doc/guix.texi b/doc/guix.texi
> index 1356a357c..77c99e069 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -16869,6 +16869,80 @@ Extra options will be passed to @code{git
> daemon}, please run @end table
>  @end deftp
>  
> +@subsubsection Incremental file transfer

Ideally this wouldn't be in Miscellaneous Services as I don't think
that is very helpful for users discovering what services Guix offers.
I think Networking Services might be better, what do you think? It
includes things like Tor, which are about using networks, and not
about core networking. 

> +
> +The @code{(gnu services rsync)} module provides the following
> services: +
> +@subsubheading Rsync service
> +
> +You might want an rsync daemon if you have files that you want
> available +so anyone (or just yourself) can download existing files
> or upload new +files.
> +
> +@deffn {Scheme Variable} rsync-service-type
> +This is the type for the @uref{https://rsync.samba.org} rsync daemon,
> +@command{rsync-configuration} record as in this example:

@uref{https://rsync.samba.org, rsync} looks nicer to me here.

> +
> +@example
> +(service rsync-service-type
> +         (rsync-configuration))
> +@end example

You may as well give the simpler (service rsync-service-type) version
here now that the service-type has a default value.

> +
> +See below for details about @code{rsync-configuration}.
> +@end deffn
> +
> +@deftp {Data Type} rsync-configuration
> +Data type representing the configuration for @code{rsync-service}.
> +
> +@table @asis
> +@item @code{package} (default: @var{rsync})
> +@code{rsync} package to use.
> +
> +@item @code{port-number} (default: @code{873})
> +TCP port on which @command{rsync} listens for incoming connections.
> If +port is less than @code{1024} @command{rsync} will be started as
> the +@code{root} user and group.

I think this needs to read "needs to be" rather than "will be".

> +
> +@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
> +Name of the file where @command{rsync} writes its PID.
> +
> +@item @code{lock-file} (default:
> @code{"/var/run/rsyncd/rsyncd.lock"}) +Name of the file where
> @command{rsync} writes its lock file. +
> +@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
> +Name of the file where @command{rsync} writes its log file.
> +
> +@item @code{use-chroot?} (default: @var{#t})
> +Whether to use chroot for @command{rsync} shared directory.
> +
> +@item @code{share-path} (default: @file{/srv/rsync})
> +Location of the @command{rsync} shared directory.
> +
> +@item @code{share-comment} (default: @code{"Rsync share"})
> +Comment of the @command{rsync} shared directory.
> +
> +@item @code{read-only?} (default: @var{#f})
> +Read-write permissions to shared directory.
> +
> +@item @code{timeout} (default: @code{300})
> +I/O timeout in seconds.
> +
> +@item @code{user} (default: @var{"root"})
> +Owner of the @code{rsync} process.
> +
> +@item @code{group} (default: @var{"root"})
> +Group of the @code{rsync} process.
> +
> +@item @code{uid} (default: @var{"rsyncd"})
> +User name or user ID that file transfers to and from that module
> should take +place as when the daemon was run as @code{root}.
> +
> +@item @code{gid} (default: @var{"rsyncd"})
> +Group name or group ID that will be  used  when  accessing the
> module. 

I'm not sure what "module" is here.

> +@end table
> +@end deftp
> +
>  @node Setuid Programs
>  @subsection Setuid Programs
>  
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 418cc5e2a..fd252118d 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -451,6 +451,7 @@ GNU_SYSTEM_MODULES
> =				\
> %D%/services/shepherd.scm			\
> %D%/services/herd.scm				\
> %D%/services/pm.scm				\
> +  %D%/services/rsync.scm			\
>    %D%/services/sddm.scm				\
>    %D%/services/spice.scm				\
>    %D%/services/ssh.scm				\
> @@ -497,6 +498,7 @@ GNU_SYSTEM_MODULES
> =				\
> %D%/tests/mail.scm				\
> %D%/tests/messaging.scm			\
> %D%/tests/networking.scm			\
> +  %D%/tests/rsync.scm				\
>    %D%/tests/ssh.scm				\
>    %D%/tests/virtualization.scm			\
>    %D%/tests/web.scm
> diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
> new file mode 100644
> index 000000000..18c46ecfb
> --- /dev/null
> +++ b/gnu/services/rsync.scm
> @@ -0,0 +1,181 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2017 Oleg Pykhalov <go.wigust <at> gmail.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it +;;; under the terms of the GNU General Public License as
> published by +;;; the Free Software Foundation; either version 3 of
> the License, or (at +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu services rsync)
> +  #:use-module (gnu services)
> +  #:use-module (gnu services base)
> +  #:use-module (gnu services shepherd)
> +  #:use-module (gnu system shadow)
> +  #:use-module (gnu packages rsync)
> +  #:use-module (gnu packages admin)
> +  #:use-module (guix records)
> +  #:use-module (guix gexp)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:use-module (ice-9 match)
> +  #:export (rsync-configuration
> +            rsync-configuration?
> +            rsync-service-type))
> +
> +;;;; Commentary:
> +;;;
> +;;; This module implements a service that to run instance of Rsync,
> +;;; files synchronization tool.
> +;;;
> +;;;; Code:
> +
> +(define-record-type* <rsync-configuration>
> +  rsync-configuration
> +  make-rsync-configuration
> +  rsync-configuration?
> +  (package       rsync-configuration-package              ; package
> +                 (default rsync))
> +  (port-number   rsync-configuration-port-number          ; integer
> +                 (default 873))
> +  (pid-file      rsync-configuration-pid-file             ; string
> +                 (default "/var/run/rsyncd/rsyncd.pid"))
> +  (lock-file     rsync-configuration-lock-file            ; string
> +                 (default "/var/run/rsyncd/rsyncd.lock"))
> +  (log-file      rsync-configuration-log-file             ; string
> +                 (default "/var/log/rsyncd.log"))
> +  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
> +                 (default #t))
> +  (share-path    rsync-configuration-share-path           ; string
> +                 (default "/srv/rsyncd"))
> +  (share-comment rsync-configuration-share-comment        ; string
> +                 (default "Rsync share"))
> +  (read-only?    rsync-configuration-read-only?           ; boolean
> +                 (default #f))
> +  (timeout       rsync-configuration-timeout              ; integer
> +                 (default 300))
> +  (user          rsync-configuration-user                 ; string
> +                 (default "root"))
> +  (group         rsync-configuration-group                ; string
> +                 (default "root"))
> +  (uid           rsync-configuration-uid                  ; string
> +                 (default "rsyncd"))
> +  (gid           rsync-configuration-gid                  ; string
> +                 (default "rsyncd")))
> +
> +(define (rsync-account config)
> +  "Return the user accounts and user groups for CONFIG."
> +  (let ((rsync-user (if (rsync-configuration-uid config)
> +                        (rsync-configuration-uid config)
> +                        (rsync-configuration-user config)))
> +        (rsync-group (if (rsync-configuration-gid config)
> +                         (rsync-configuration-gid config)
> +                         (rsync-configuration-group config))))
> +    (list (user-group (name rsync-group) (system? #t))
> +          (user-account
> +           (name rsync-user)
> +           (system? #t)
> +           (group rsync-group)
> +           (comment "rsyncd privilege separation user")
> +           (home-directory (string-append "/var/run/"
> +                                          rsync-user))
> +           (shell #~(string-append #$shadow "/sbin/nologin"))))))
> +
> +(define (rsync-activation config)
> +  "Return the activation GEXP for CONFIG."
> +  #~(begin
> +      (use-modules (guix build utils))

Using with-imported-modules with this gexp here would be good, to
ensure it has the (guix build utils) module.

> +      (let ((share-directory  #$(rsync-configuration-share-path
> config))
> +            (user  (getpw (if #$(rsync-configuration-uid config)
> +                              #$(rsync-configuration-uid config)
> +                              #$(rsync-configuration-user config))))
> +            (group (getpw (if #$(rsync-configuration-gid config)
> +                              #$(rsync-configuration-gid config)
> +                              #$(rsync-configuration-group
> config)))))
> +        (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
> +        (and=> share-directory mkdir-p)
> +        (chown share-directory
> +               (passwd:uid user)
> +               (group:gid group)))))
> +
> +(define (rsync-config-file config)
> +  "Return the rsync configuration file corresponding to CONFIG."
> +  (let ((port-number   (rsync-configuration-port-number config))
> +        (pid-file      (rsync-configuration-pid-file config))
> +        (lock-file     (rsync-configuration-lock-file config))
> +        (log-file      (rsync-configuration-log-file config))
> +        (use-chroot?   (rsync-configuration-use-chroot? config))
> +        (share-path    (rsync-configuration-share-path config))
> +        (share-comment (rsync-configuration-share-comment config))
> +        (read-only?    (rsync-configuration-read-only? config))
> +        (timeout       (rsync-configuration-timeout config))
> +        (user          (rsync-configuration-user config))
> +        (group         (rsync-configuration-group config))
> +        (uid           (rsync-configuration-uid config))
> +        (gid           (rsync-configuration-gid config)))

Using match, or match-lambda might neaten this up a bit. There are a
few examples of using this in Guix.

> +    (if (not (string=? user "root"))
> +        (cond
> +         ((<= port-number 1024)
> +          (error (string-append "rsync-service: to run on port "
> +                                (number->string port-number)
> +                                ", user must be root.")))
> +         (use-chroot?
> +          (error (string-append "rsync-service: to run in a chroot"
> +                                ", user must be root.")))
> +         (uid
> +          (error "rsync-service: to use uid, user must be root."))
> +         (gid
> +          (error "rsync-service: to use gid, user must be root."))))
> +    (mixed-text-file
> +     "rsync.conf"
> +     "# Generated by 'rsync-service'.\n\n"
> +     "pid file = " pid-file "\n"
> +     "lock file = " lock-file "\n"
> +     "log file = " log-file "\n"
> +     "port = " (number->string port-number) "\n"
> +     "use chroot = " (if use-chroot? "true" "false") "\n"
> +     (if uid (string-append "uid = " uid "\n") "")
> +     "gid = " (if gid gid "nogroup") "\n" ; no group nobody
> +     "\n"
> +     "[files]\n"
> +     "path = " share-path "\n"
> +     "comment = " share-comment "\n"
> +     "read only = " (if read-only? "true" "false") "\n"
> +     "timeout = " (number->string timeout) "\n")))
> +
> +(define (rsync-shepherd-service config)
> +  "Return a <shepherd-service> for rsync with CONFIG."
> +  (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)))
> +    (list (shepherd-service
> +           (provision '(rsync))
> +           (documentation "Run rsync daemon.")
> +           (start #~(make-forkexec-constructor
> +                     (list (string-append #$rsync "/bin/rsync")
> +                           "--config" #$(rsync-config-file config)
> +                           "--daemon")
> +                     #:pid-file #$pid-file
> +                     #:user #$user
> +                     #:group #$group))
> +           (stop #~(make-kill-destructor))))))
> +
> +(define rsync-service-type
> +  (service-type
> +   (name 'rsync)
> +   (extensions
> +    (list (service-extension shepherd-root-service-type
> rsync-shepherd-service)
> +          (service-extension account-service-type rsync-account)
> +          (service-extension activation-service-type
> rsync-activation)))
> +   (default-value (rsync-configuration))))
> diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
> new file mode 100644
> index 000000000..691b88e0d
> --- /dev/null
> +++ b/gnu/tests/rsync.scm
> @@ -0,0 +1,128 @@
> +;;; GNU Guix --- Functional package management for GNU

[...]

> +
> +(define %test-rsync
> +  (system-test
> +   (name "rsync")
> +   (description "Connect to a running RSYNC server.")
> +   (value (run-rsync-test (%rsync-os)))))
> -- 
> 2.14.1

I'm pretty happy with this now. I think updating the documentation to
match the recent changes in the service would be good to do before
merging this but that is all. Good job :)



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-09-18  6:20 ` [bug#27855] " Christopher Baines
@ 2017-09-23  1:47   ` Oleg Pykhalov
  2017-09-23  2:38     ` Oleg Pykhalov
  2017-09-23 20:12     ` bug#27855: " Christopher Baines
  0 siblings, 2 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-09-23  1:47 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 3917 bytes --]

Christopher Baines <mail@cbaines.net> writes:

> Ideally this wouldn't be in Miscellaneous Services as I don't think
> that is very helpful for users discovering what services Guix offers.
> I think Networking Services might be better, what do you think? It
> includes things like Tor, which are about using networks, and not
> about core networking. 

Done.

>> +@deffn {Scheme Variable} rsync-service-type
>> +This is the type for the @uref{https://rsync.samba.org} rsync daemon,
>> +@command{rsync-configuration} record as in this example:
>
> @uref{https://rsync.samba.org, rsync} looks nicer to me here.

Done.

>> +@example
>> +(service rsync-service-type
>> +         (rsync-configuration))
>> +@end example
>
> You may as well give the simpler (service rsync-service-type) version
> here now that the service-type has a default value.

Done.

>> +@item @code{port-number} (default: @code{873})
>> +TCP port on which @command{rsync} listens for incoming connections.
>> If +port is less than @code{1024} @command{rsync} will be started as
>> the +@code{root} user and group.
>
> I think this needs to read "needs to be" rather than "will be".

Done.

>> +@item @code{uid} (default: @var{"rsyncd"})
>> +User name or user ID that file transfers to and from that module
>> should take +place as when the daemon was run as @code{root}.
>> +
>> +@item @code{gid} (default: @var{"rsyncd"})
>> +Group name or group ID that will be  used  when  accessing the
>> module. 
>
> I'm not sure what "module" is here.

I took this description from *Man 5 rsyncd.conf* MODULE PARAMETERS.

  After the global parameters you should define a number of modules,
  each module exports a directory tree as a symbolic name. Modules are
  exported by specifying a module name in square brackets [module]
  followed by the param‐ eters for that module.  The module name cannot
  contain a slash or a closing square bracket.  If the name contains
  whitespace, each internal sequence of whitespace will be changed into
  a single space, while leading or trailing whitespace will be
  discarded.  Also, the name cannot be "global" as that exact name
  indicates that global parameters follow (see above).

>> +(define (rsync-activation config)
>> +  "Return the activation GEXP for CONFIG."
>> +  #~(begin
>> +      (use-modules (guix build utils))
>
> Using with-imported-modules with this gexp here would be good, to
> ensure it has the (guix build utils) module.

Done.

>> +(define (rsync-config-file config)
>> +  "Return the rsync configuration file corresponding to CONFIG."
>> +  (let ((port-number   (rsync-configuration-port-number config))
>> +        (pid-file      (rsync-configuration-pid-file config))
>> +        (lock-file     (rsync-configuration-lock-file config))
>> +        (log-file      (rsync-configuration-log-file config))
>> +        (use-chroot?   (rsync-configuration-use-chroot? config))
>> +        (share-path    (rsync-configuration-share-path config))
>> +        (share-comment (rsync-configuration-share-comment config))
>> +        (read-only?    (rsync-configuration-read-only? config))
>> +        (timeout       (rsync-configuration-timeout config))
>> +        (user          (rsync-configuration-user config))
>> +        (group         (rsync-configuration-group config))
>> +        (uid           (rsync-configuration-uid config))
>> +        (gid           (rsync-configuration-gid config)))
>
> Using match, or match-lambda might neaten this up a bit. There are a
> few examples of using this in Guix.

Done.

> I'm pretty happy with this now. I think updating the documentation to
> match the recent changes in the service would be good to do before
> merging this but that is all. Good job :)

Thank you for support!  I learned much new things.

Attached a patch.  Tested successfully.


[-- Attachment #2: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 17064 bytes --]

From a68a97bdd6132de59d44ec0da7de3e3dadb1132e Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  69 ++++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 128 ++++++++++++++++++++++++++++++++++++
 4 files changed, 371 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 0369a150f..0462a6419 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10335,6 +10335,75 @@ In addition, @var{extra-settings} specifies a string to append to the
 configuration file.
 @end deffn
 
+The @code{(gnu services rsync)} module provides the following services:
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org, rsync} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type)
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If port
+is less than @code{1024} @command{rsync} needs to be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#t})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"root"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"root"})
+Group of the @code{rsync} process.
+
+@item @code{uid} (default: @var{"rsyncd"})
+User name or user ID that file transfers to and from that module should take
+place as when the daemon was run as @code{root}.
+
+@item @code{gid} (default: @var{"rsyncd"})
+Group name or group ID that will be used when accessing the module.
+
+@end table
+@end deftp
+
 Furthermore, @code{(gnu services ssh)} provides the following services.
 @cindex SSH
 @cindex SSH server
diff --git a/gnu/local.mk b/gnu/local.mk
index 68c4852d9..2406fae55 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -451,6 +451,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -497,6 +498,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/virtualization.scm			\
   %D%/tests/web.scm
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..621e6c46d
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,172 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration
+  make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package              ; package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number          ; integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file             ; string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file            ; string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file             ; string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
+                 (default #t))
+  (share-path    rsync-configuration-share-path           ; string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment        ; string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only?           ; boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout              ; integer
+                 (default 300))
+  (user          rsync-configuration-user                 ; string
+                 (default "root"))
+  (group         rsync-configuration-group                ; string
+                 (default "root"))
+  (uid           rsync-configuration-uid                  ; string
+                 (default "rsyncd"))
+  (gid           rsync-configuration-gid                  ; string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (if (rsync-configuration-uid config)
+                        (rsync-configuration-uid config)
+                        (rsync-configuration-user config)))
+        (rsync-group (if (rsync-configuration-gid config)
+                         (rsync-configuration-gid config)
+                         (rsync-configuration-group config))))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory (string-append "/var/run/"
+                                          rsync-user))
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (let ((share-directory  #$(rsync-configuration-share-path config))
+              (user  (getpw (if #$(rsync-configuration-uid config)
+                                #$(rsync-configuration-uid config)
+                                #$(rsync-configuration-user config))))
+              (group (getpw (if #$(rsync-configuration-gid config)
+                                #$(rsync-configuration-gid config)
+                                #$(rsync-configuration-group config)))))
+          (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
+          (and=> share-directory mkdir-p)
+          (chown share-directory
+                 (passwd:uid user)
+                 (group:gid group))))))
+
+(define rsync-config-file
+  ;; Return the rsync configuration file corresponding to CONFIG.
+  (match-lambda
+    (($ <rsync-configuration> package port-number pid-file lock-file log-file
+                              use-chroot? share-path share-comment read-only?
+                              timeout user group uid gid)
+     (if (not (string=? user "root"))
+         (cond
+          ((<= port-number 1024)
+           (error (string-append "rsync-service: to run on port "
+                                 (number->string port-number)
+                                 ", user must be root.")))
+          (use-chroot?
+           (error (string-append "rsync-service: to run in a chroot"
+                                 ", user must be root.")))
+          (uid
+           (error "rsync-service: to use uid, user must be root."))
+          (gid
+           (error "rsync-service: to use gid, user must be root."))))
+     (mixed-text-file
+      "rsync.conf"
+      "# Generated by 'rsync-service'.\n\n"
+      "pid file = " pid-file "\n"
+      "lock file = " lock-file "\n"
+      "log file = " log-file "\n"
+      "port = " (number->string port-number) "\n"
+      "use chroot = " (if use-chroot? "true" "false") "\n"
+      (if uid (string-append "uid = " uid "\n") "")
+      "gid = " (if gid gid "nogroup") "\n" ; no group nobody
+      "\n"
+      "[files]\n"
+      "path = " share-path "\n"
+      "comment = " share-comment "\n"
+      "read only = " (if read-only? "true" "false") "\n"
+      "timeout = " (number->string timeout) "\n"))))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (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)))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$group))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..691b88e0d
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,128 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* (%rsync-os #:optional (rsync-port 581))
+  "Return operating system under test."
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type
+                   (rsync-configuration
+                    (port-number rsync-port))))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync
+  (system-test
+   (name "rsync")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test (%rsync-os)))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [bug#27855] [PATCH] gnu: Add rsync service.
  2017-09-23  1:47   ` Oleg Pykhalov
@ 2017-09-23  2:38     ` Oleg Pykhalov
  2017-09-23 20:12     ` bug#27855: " Christopher Baines
  1 sibling, 0 replies; 32+ messages in thread
From: Oleg Pykhalov @ 2017-09-23  2:38 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 27855

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

Also want to add to previous message.  Changed rsync port to 873 by
default in test according to /etc/services and rsync service default
port in Guix in this patch.  And cleaned up little bit.

--8<---------------cut here---------------start------------->8---
-(define* (run-rsync-test rsync-os #:optional (rsync-port 581))
+(define* (run-rsync-test rsync-os #:optional (rsync-port 873))

-(define* (%rsync-os #:optional (rsync-port 581))
-  "Return operating system under test."
+(define* %rsync-os
+  ;; Return operating system under test.

-          (service rsync-service-type
-                   (rsync-configuration
-                    (port-number rsync-port))))))
+          (service rsync-service-type))))

    (description "Connect to a running RSYNC server.")
-   (value (run-rsync-test (%rsync-os)))))
--8<---------------cut here---------------end--------------->8---


[-- Attachment #2: 0001-gnu-Add-rsync-service.patch --]
[-- Type: text/x-patch, Size: 16943 bytes --]

From 86f8d510d344c50a55515bafb22f3438689231ee Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Thu, 27 Jul 2017 04:01:01 +0300
Subject: [PATCH] gnu: Add rsync service.

* doc/guix.texi (Incremental file transfer): Add documentation.
* gnu/services/rsync.scm (<rsync-configuration>): New record type.
(rsync-accounts, rsync-shepherd-service): New service extensions.
(rsync-service-type): New service type.
* gnu/tests/rsync.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi          |  69 ++++++++++++++++++++
 gnu/local.mk           |   2 +
 gnu/services/rsync.scm | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
 gnu/tests/rsync.scm    | 126 ++++++++++++++++++++++++++++++++++++
 4 files changed, 369 insertions(+)
 create mode 100644 gnu/services/rsync.scm
 create mode 100644 gnu/tests/rsync.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 0369a150f..0462a6419 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10335,6 +10335,75 @@ In addition, @var{extra-settings} specifies a string to append to the
 configuration file.
 @end deffn
 
+The @code{(gnu services rsync)} module provides the following services:
+
+You might want an rsync daemon if you have files that you want available
+so anyone (or just yourself) can download existing files or upload new
+files.
+
+@deffn {Scheme Variable} rsync-service-type
+This is the type for the @uref{https://rsync.samba.org, rsync} rsync daemon,
+@command{rsync-configuration} record as in this example:
+
+@example
+(service rsync-service-type)
+@end example
+
+See below for details about @code{rsync-configuration}.
+@end deffn
+
+@deftp {Data Type} rsync-configuration
+Data type representing the configuration for @code{rsync-service}.
+
+@table @asis
+@item @code{package} (default: @var{rsync})
+@code{rsync} package to use.
+
+@item @code{port-number} (default: @code{873})
+TCP port on which @command{rsync} listens for incoming connections.  If port
+is less than @code{1024} @command{rsync} needs to be started as the
+@code{root} user and group.
+
+@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
+Name of the file where @command{rsync} writes its PID.
+
+@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
+Name of the file where @command{rsync} writes its lock file.
+
+@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
+Name of the file where @command{rsync} writes its log file.
+
+@item @code{use-chroot?} (default: @var{#t})
+Whether to use chroot for @command{rsync} shared directory.
+
+@item @code{share-path} (default: @file{/srv/rsync})
+Location of the @command{rsync} shared directory.
+
+@item @code{share-comment} (default: @code{"Rsync share"})
+Comment of the @command{rsync} shared directory.
+
+@item @code{read-only?} (default: @var{#f})
+Read-write permissions to shared directory.
+
+@item @code{timeout} (default: @code{300})
+I/O timeout in seconds.
+
+@item @code{user} (default: @var{"root"})
+Owner of the @code{rsync} process.
+
+@item @code{group} (default: @var{"root"})
+Group of the @code{rsync} process.
+
+@item @code{uid} (default: @var{"rsyncd"})
+User name or user ID that file transfers to and from that module should take
+place as when the daemon was run as @code{root}.
+
+@item @code{gid} (default: @var{"rsyncd"})
+Group name or group ID that will be used when accessing the module.
+
+@end table
+@end deftp
+
 Furthermore, @code{(gnu services ssh)} provides the following services.
 @cindex SSH
 @cindex SSH server
diff --git a/gnu/local.mk b/gnu/local.mk
index 68c4852d9..2406fae55 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -451,6 +451,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/pm.scm				\
+  %D%/services/rsync.scm			\
   %D%/services/sddm.scm				\
   %D%/services/spice.scm				\
   %D%/services/ssh.scm				\
@@ -497,6 +498,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/tests/mail.scm				\
   %D%/tests/messaging.scm			\
   %D%/tests/networking.scm			\
+  %D%/tests/rsync.scm				\
   %D%/tests/ssh.scm				\
   %D%/tests/virtualization.scm			\
   %D%/tests/web.scm
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
new file mode 100644
index 000000000..621e6c46d
--- /dev/null
+++ b/gnu/services/rsync.scm
@@ -0,0 +1,172 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services rsync)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages admin)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (rsync-configuration
+            rsync-configuration?
+            rsync-service-type))
+
+;;;; Commentary:
+;;;
+;;; This module implements a service that to run instance of Rsync,
+;;; files synchronization tool.
+;;;
+;;;; Code:
+
+(define-record-type* <rsync-configuration>
+  rsync-configuration
+  make-rsync-configuration
+  rsync-configuration?
+  (package       rsync-configuration-package              ; package
+                 (default rsync))
+  (port-number   rsync-configuration-port-number          ; integer
+                 (default 873))
+  (pid-file      rsync-configuration-pid-file             ; string
+                 (default "/var/run/rsyncd/rsyncd.pid"))
+  (lock-file     rsync-configuration-lock-file            ; string
+                 (default "/var/run/rsyncd/rsyncd.lock"))
+  (log-file      rsync-configuration-log-file             ; string
+                 (default "/var/log/rsyncd.log"))
+  (use-chroot?   rsync-configuration-use-chroot?          ; boolean
+                 (default #t))
+  (share-path    rsync-configuration-share-path           ; string
+                 (default "/srv/rsyncd"))
+  (share-comment rsync-configuration-share-comment        ; string
+                 (default "Rsync share"))
+  (read-only?    rsync-configuration-read-only?           ; boolean
+                 (default #f))
+  (timeout       rsync-configuration-timeout              ; integer
+                 (default 300))
+  (user          rsync-configuration-user                 ; string
+                 (default "root"))
+  (group         rsync-configuration-group                ; string
+                 (default "root"))
+  (uid           rsync-configuration-uid                  ; string
+                 (default "rsyncd"))
+  (gid           rsync-configuration-gid                  ; string
+                 (default "rsyncd")))
+
+(define (rsync-account config)
+  "Return the user accounts and user groups for CONFIG."
+  (let ((rsync-user (if (rsync-configuration-uid config)
+                        (rsync-configuration-uid config)
+                        (rsync-configuration-user config)))
+        (rsync-group (if (rsync-configuration-gid config)
+                         (rsync-configuration-gid config)
+                         (rsync-configuration-group config))))
+    (list (user-group (name rsync-group) (system? #t))
+          (user-account
+           (name rsync-user)
+           (system? #t)
+           (group rsync-group)
+           (comment "rsyncd privilege separation user")
+           (home-directory (string-append "/var/run/"
+                                          rsync-user))
+           (shell #~(string-append #$shadow "/sbin/nologin"))))))
+
+(define (rsync-activation config)
+  "Return the activation GEXP for CONFIG."
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (let ((share-directory  #$(rsync-configuration-share-path config))
+              (user  (getpw (if #$(rsync-configuration-uid config)
+                                #$(rsync-configuration-uid config)
+                                #$(rsync-configuration-user config))))
+              (group (getpw (if #$(rsync-configuration-gid config)
+                                #$(rsync-configuration-gid config)
+                                #$(rsync-configuration-group config)))))
+          (mkdir-p (dirname #$(rsync-configuration-pid-file config)))
+          (and=> share-directory mkdir-p)
+          (chown share-directory
+                 (passwd:uid user)
+                 (group:gid group))))))
+
+(define rsync-config-file
+  ;; Return the rsync configuration file corresponding to CONFIG.
+  (match-lambda
+    (($ <rsync-configuration> package port-number pid-file lock-file log-file
+                              use-chroot? share-path share-comment read-only?
+                              timeout user group uid gid)
+     (if (not (string=? user "root"))
+         (cond
+          ((<= port-number 1024)
+           (error (string-append "rsync-service: to run on port "
+                                 (number->string port-number)
+                                 ", user must be root.")))
+          (use-chroot?
+           (error (string-append "rsync-service: to run in a chroot"
+                                 ", user must be root.")))
+          (uid
+           (error "rsync-service: to use uid, user must be root."))
+          (gid
+           (error "rsync-service: to use gid, user must be root."))))
+     (mixed-text-file
+      "rsync.conf"
+      "# Generated by 'rsync-service'.\n\n"
+      "pid file = " pid-file "\n"
+      "lock file = " lock-file "\n"
+      "log file = " log-file "\n"
+      "port = " (number->string port-number) "\n"
+      "use chroot = " (if use-chroot? "true" "false") "\n"
+      (if uid (string-append "uid = " uid "\n") "")
+      "gid = " (if gid gid "nogroup") "\n" ; no group nobody
+      "\n"
+      "[files]\n"
+      "path = " share-path "\n"
+      "comment = " share-comment "\n"
+      "read only = " (if read-only? "true" "false") "\n"
+      "timeout = " (number->string timeout) "\n"))))
+
+(define (rsync-shepherd-service config)
+  "Return a <shepherd-service> for rsync with CONFIG."
+  (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)))
+    (list (shepherd-service
+           (provision '(rsync))
+           (documentation "Run rsync daemon.")
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$rsync "/bin/rsync")
+                           "--config" #$(rsync-config-file config)
+                           "--daemon")
+                     #:pid-file #$pid-file
+                     #:user #$user
+                     #:group #$group))
+           (stop #~(make-kill-destructor))))))
+
+(define rsync-service-type
+  (service-type
+   (name 'rsync)
+   (extensions
+    (list (service-extension shepherd-root-service-type rsync-shepherd-service)
+          (service-extension account-service-type rsync-account)
+          (service-extension activation-service-type rsync-activation)))
+   (default-value (rsync-configuration))))
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
new file mode 100644
index 000000000..c97836788
--- /dev/null
+++ b/gnu/tests/rsync.scm
@@ -0,0 +1,126 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests rsync)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu tests)
+  #:use-module (gnu system)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu system vm)
+  #:use-module (gnu services)
+  #:use-module (gnu services rsync)
+  #:use-module (gnu services networking)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:export (%test-rsync))
+
+(define* (run-rsync-test rsync-os #:optional (rsync-port 873))
+  "Run tests in %RSYNC-OS, which has rsync running and listening on
+PORT."
+  (define os
+    (marionette-operating-system
+     rsync-os
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm
+    (virtual-machine
+     (operating-system os)
+     (port-forwardings '())))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (srfi srfi-11) (srfi srfi-64)
+                       (gnu build marionette))
+
+          (define marionette
+            (make-marionette (list #$vm)))
+
+          (mkdir #$output)
+          (chdir #$output)
+
+          (test-begin "rsync")
+
+          ;; Wait for rsync to be up and running.
+          (test-eq "service running"
+            'running!
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'rsync)
+                'running!)
+             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
+                (call-with-output-file "/tmp/input"
+                  (lambda (port)
+                    (display "test-file-contents\n" port)))
+                (zero?
+                 (system* "rsync" "/tmp/input"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input"))))
+             marionette))
+
+          (test-equal "Test file correctly received from share"
+            "test-file-contents"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 rdelim))
+                (zero?
+                 (system* "rsync"
+                          (string-append "rsync://localhost:"
+                                         (number->string #$rsync-port)
+                                         "/files/input")
+                          "/tmp/output"))
+                (call-with-input-file "/tmp/output"
+                  (lambda (port)
+                    (read-line port))))
+             marionette))
+
+          (test-end)
+          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+  (gexp->derivation "rsync-test" test))
+
+(define* %rsync-os
+  ;; Return operating system under test.
+  (let ((base-os
+         (simple-operating-system
+          (dhcp-client-service)
+          (service rsync-service-type))))
+    (operating-system
+      (inherit base-os)
+      (packages (cons* rsync
+                       (operating-system-packages base-os))))))
+
+(define %test-rsync
+  (system-test
+   (name "rsync")
+   (description "Connect to a running RSYNC server.")
+   (value (run-rsync-test %rsync-os))))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* bug#27855: [PATCH] gnu: Add rsync service.
  2017-09-23  1:47   ` Oleg Pykhalov
  2017-09-23  2:38     ` Oleg Pykhalov
@ 2017-09-23 20:12     ` Christopher Baines
  1 sibling, 0 replies; 32+ messages in thread
From: Christopher Baines @ 2017-09-23 20:12 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 27855-done

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

On Sat, 23 Sep 2017 04:47:10 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:

> Thank you for support!  I learned much new things.

Great :) The latest changes look good, and I've now pushed the latest
patch you sent (the email after this one). I've tweaked the commit
message a bit, I hope you don't mind.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2017-09-23 20:13 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
2017-07-27 22:22 ` [bug#27855] ERROR: rsync rsync://localhost/files Oleg Pykhalov
2017-07-28  6:45 ` [bug#27855] [PATCH] services: rsync: Fix invalid gid nobody Oleg Pykhalov
2017-07-28 22:17 ` [bug#27855] [PATCH] gnu: Add rsync service Christopher Baines
2017-07-29 11:03   ` Oleg Pykhalov
2017-07-29 11:55     ` Christopher Baines
2017-08-03 15:20       ` Oleg Pykhalov
2017-08-03 15:29         ` Oleg Pykhalov
2017-08-03 15:33         ` Christopher Baines
2017-08-03 16:20           ` Oleg Pykhalov
2017-08-03 16:34             ` Oleg Pykhalov
2017-08-10  7:18             ` Christopher Baines
2017-08-10 18:21               ` Christopher Baines
2017-08-10 18:56                 ` Oleg Pykhalov
2017-08-11 19:28                   ` Oleg Pykhalov
2017-08-12  6:59                     ` Christopher Baines
2017-08-12 13:13                       ` Oleg Pykhalov
2017-08-12 17:46                         ` Christopher Baines
2017-08-12 20:19                           ` Oleg Pykhalov
2017-08-12 21:19                             ` Christopher Baines
2017-08-19 20:34                               ` Oleg Pykhalov
2017-08-19 22:19                                 ` Christopher Baines
2017-08-24 22:40                                   ` Oleg Pykhalov
2017-08-30 23:59                                     ` Christopher Baines
2017-08-31 13:04                                       ` Ludovic Courtès
2017-09-16 22:44                                         ` Oleg Pykhalov
2017-09-16 22:49                                           ` Oleg Pykhalov
2017-09-17  8:40 ` [bug#27855] Status: " Oleg Pykhalov
2017-09-18  6:20 ` [bug#27855] " Christopher Baines
2017-09-23  1:47   ` Oleg Pykhalov
2017-09-23  2:38     ` Oleg Pykhalov
2017-09-23 20:12     ` bug#27855: " Christopher Baines

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.