From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH 1/2] services: dovecot: Copy dovecot.conf to /etc/dovecot. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Mar 2018 21:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 30744@debbugs.gnu.org Cc: Oleg Pykhalov X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.152045826511991 (code B ref -1); Wed, 07 Mar 2018 21:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Mar 2018 21:31:05 +0000 Received: from localhost ([127.0.0.1]:49922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etgeO-00036w-Fc for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:31:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etgeM-0002zp-UX for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:31:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etgeG-0004Fu-AG for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:30:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etgeG-0004Fo-60 for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:30:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etgeE-0007wh-E4 for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etgeA-0004Eh-C3 for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:54 -0500 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:44262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etge9-0004EY-VV for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:50 -0500 Received: by mail-lf0-x22b.google.com with SMTP id v9-v6so5359228lfa.11 for ; Wed, 07 Mar 2018 13:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZyhN2XkGRbRGQHW/MBIH2aMiFps1y35wdq58fvmpn9E=; b=NCR1LNFL9uMAh/uzPxD9jkNMaC5RhKA9Q3rb937swPgEUmBRyHjLxqAuz7r0xpwD48 QCnR3Hli0Lny0UY0YqUJWA6UtNJ/DFx3upyWyyeHjZHyyRYa+u+xK1zwKlteZ5bmNn7f kVOLJefrusk0zOfgfhJu3RgAZs24yHjy82UbN2kGets+JQuf8yo5dVVDdvntP638LSrN q1c4ZMUfNlFTK4R3YHkgS4JnwdZxmNH1mW8uJsXqTgjdpI8UOQX+yEQ5kibcw8yXBDgj eIJ9FmUgI0LXPCDEr72aX2sL/EebRuoC7n59y7nDUIVAU17msE88cSDj9RHZ4fIxVtgI 55FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZyhN2XkGRbRGQHW/MBIH2aMiFps1y35wdq58fvmpn9E=; b=Rnuth0MuqgqxTjyRyj7WeTfWrGZcVJ02FpSCs4nMiFY2CehCv4TW0/GgyiJI90UUXO VEW0AVkDvdxdvqXQxb2pId6AQeezi2dDKkxyHNyKinn3ZEACFk1dzi3SptebS8QZ6Bq9 rwlvGwsgztthe04lISUCcDs+bI4fyGFRamrICe2f6+mrpp+cnzgt5eqTV+D74LXn01dY sqIgRFH3nMqRrGv7H1DZybDvy4BlHIG1/Wswi1d8If0NCAK6FC3iXGhmA6s2aAxTrR7I OQLH3ZmshexttTYZWtp7U8K9MADcF7k/FgT4IZ+fu9l/U3tMcarh9bQB8lm6JFvSZ357 eIqg== X-Gm-Message-State: AElRT7FGdzIHCNi/lJmfBsmOJXVVXug30QWzbjJycqT+rCCJNfQnjzuX yuRe71LRO691aCypv9OTJ3PdOw== X-Google-Smtp-Source: AG47ELuBpN6DcaVzhr4vP1UfB73D7qRJ/J+8v5YR16y6lIl/iEe8jGmzY+Br3IEtzyoruxyBcnmleg== X-Received: by 10.25.15.98 with SMTP id e95mr15317849lfi.36.1520458247785; Wed, 07 Mar 2018 13:30:47 -0800 (PST) Received: from localhost.localdomain (92-100-247-246.dynamic.avangarddsl.ru. [92.100.247.246]) by smtp.gmail.com with ESMTPSA id w23sm3924653lfd.10.2018.03.07.13.30.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 13:30:46 -0800 (PST) From: Oleg Pykhalov Date: Thu, 8 Mar 2018 00:30:29 +0300 Message-Id: <20180307213030.30466-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Many Dovecot utilities compiled with assumption of ‘/etc/dovecot/dovecot.conf’ existence. * gnu/services/mail.scm (dovecot-shepherd-service): Move config generation. Invoke ‘dovecot’ without ‘-c’ flag. (%dovecot-activation): Copy ‘dovecot.conf’ to ‘/etc/dovecot’. (dovecot-service-type): Make ‘%dovecot-activation’ non-constant. --- gnu/services/mail.scm | 147 +++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index ab9094273..573efa043 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1435,90 +1435,91 @@ greyed out, instead of only later giving \"not selectable\" popup error. (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) -(define %dovecot-activation +(define (%dovecot-activation config) ;; Activation gexp. - #~(begin - (use-modules (guix build utils)) - (define (mkdir-p/perms directory owner perms) - (mkdir-p directory) - (chown "/var/run/dovecot" (passwd:uid owner) (passwd:gid owner)) - (chmod directory perms)) - (define (build-subject parameters) - (string-concatenate - (map (lambda (pair) - (let ((k (car pair)) (v (cdr pair))) - (define (escape-char str chr) - (string-join (string-split str chr) (string #\\ chr))) - (string-append "/" k "=" - (escape-char (escape-char v #\=) #\/)))) - (filter (lambda (pair) (cdr pair)) parameters)))) - (define* (create-self-signed-certificate-if-absent - #:key private-key public-key (owner (getpwnam "root")) - (common-name (gethostname)) - (organization-name "GuixSD") - (organization-unit-name "Default Self-Signed Certificate") - (subject-parameters `(("CN" . ,common-name) - ("O" . ,organization-name) - ("OU" . ,organization-unit-name))) - (subject (build-subject subject-parameters))) - ;; Note that by default, OpenSSL outputs keys in PEM format. This - ;; is what we want. - (unless (file-exists? private-key) - (cond - ((zero? (system* (string-append #$openssl "/bin/openssl") - "genrsa" "-out" private-key "2048")) - (chown private-key (passwd:uid owner) (passwd:gid owner)) - (chmod private-key #o400)) - (else - (format (current-error-port) - "Failed to create private key at ~a.\n" private-key)))) - (unless (file-exists? public-key) - (cond - ((zero? (system* (string-append #$openssl "/bin/openssl") - "req" "-new" "-x509" "-key" private-key - "-out" public-key "-days" "3650" - "-batch" "-subj" subject)) - (chown public-key (passwd:uid owner) (passwd:gid owner)) - (chmod public-key #o444)) - (else - (format (current-error-port) - "Failed to create public key at ~a.\n" public-key))))) - (let ((user (getpwnam "dovecot"))) - (mkdir-p/perms "/var/run/dovecot" user #o755) - (mkdir-p/perms "/var/lib/dovecot" user #o755) - (mkdir-p/perms "/etc/dovecot" user #o755) - (mkdir-p/perms "/etc/dovecot/private" user #o700) - (create-self-signed-certificate-if-absent - #:private-key "/etc/dovecot/private/default.pem" - #:public-key "/etc/dovecot/default.pem" - #:owner (getpwnam "root") - #:common-name (format #f "Dovecot service on ~a" (gethostname)))))) + (let ((config-str + (cond + ((opaque-dovecot-configuration? config) + (opaque-dovecot-configuration-string config)) + (else + (with-output-to-string + (lambda () + (serialize-configuration config + dovecot-configuration-fields))))))) + #~(begin + (use-modules (guix build utils)) + (define (mkdir-p/perms directory owner perms) + (mkdir-p directory) + (chown "/var/run/dovecot" (passwd:uid owner) (passwd:gid owner)) + (chmod directory perms)) + (define (build-subject parameters) + (string-concatenate + (map (lambda (pair) + (let ((k (car pair)) (v (cdr pair))) + (define (escape-char str chr) + (string-join (string-split str chr) (string #\\ chr))) + (string-append "/" k "=" + (escape-char (escape-char v #\=) #\/)))) + (filter (lambda (pair) (cdr pair)) parameters)))) + (define* (create-self-signed-certificate-if-absent + #:key private-key public-key (owner (getpwnam "root")) + (common-name (gethostname)) + (organization-name "GuixSD") + (organization-unit-name "Default Self-Signed Certificate") + (subject-parameters `(("CN" . ,common-name) + ("O" . ,organization-name) + ("OU" . ,organization-unit-name))) + (subject (build-subject subject-parameters))) + ;; Note that by default, OpenSSL outputs keys in PEM format. This + ;; is what we want. + (unless (file-exists? private-key) + (cond + ((zero? (system* (string-append #$openssl "/bin/openssl") + "genrsa" "-out" private-key "2048")) + (chown private-key (passwd:uid owner) (passwd:gid owner)) + (chmod private-key #o400)) + (else + (format (current-error-port) + "Failed to create private key at ~a.\n" private-key)))) + (unless (file-exists? public-key) + (cond + ((zero? (system* (string-append #$openssl "/bin/openssl") + "req" "-new" "-x509" "-key" private-key + "-out" public-key "-days" "3650" + "-batch" "-subj" subject)) + (chown public-key (passwd:uid owner) (passwd:gid owner)) + (chmod public-key #o444)) + (else + (format (current-error-port) + "Failed to create public key at ~a.\n" public-key))))) + (let ((user (getpwnam "dovecot"))) + (mkdir-p/perms "/var/run/dovecot" user #o755) + (mkdir-p/perms "/var/lib/dovecot" user #o755) + (mkdir-p/perms "/etc/dovecot" user #o755) + (copy-file #$(plain-file "dovecot.conf" config-str) + "/etc/dovecot/dovecot.conf") + (mkdir-p/perms "/etc/dovecot/private" user #o700) + (create-self-signed-certificate-if-absent + #:private-key "/etc/dovecot/private/default.pem" + #:public-key "/etc/dovecot/default.pem" + #:owner (getpwnam "root") + #:common-name (format #f "Dovecot service on ~a" (gethostname))))))) (define (dovecot-shepherd-service config) "Return a list of for CONFIG." - (let* ((config-str - (cond - ((opaque-dovecot-configuration? config) - (opaque-dovecot-configuration-string config)) - (else - (with-output-to-string - (lambda () - (serialize-configuration config - dovecot-configuration-fields)))))) - (config-file (plain-file "dovecot.conf" config-str)) - (dovecot (if (opaque-dovecot-configuration? config) - (opaque-dovecot-configuration-dovecot config) - (dovecot-configuration-dovecot config)))) + (let ((dovecot (if (opaque-dovecot-configuration? config) + (opaque-dovecot-configuration-dovecot config) + (dovecot-configuration-dovecot config)))) (list (shepherd-service (documentation "Run the Dovecot POP3/IMAP mail server.") (provision '(dovecot)) (requirement '(networking)) (start #~(make-forkexec-constructor (list (string-append #$dovecot "/sbin/dovecot") - "-F" "-c" #$config-file))) + "-F"))) (stop #~(make-forkexec-constructor (list (string-append #$dovecot "/sbin/dovecot") - "-c" #$config-file "stop"))))))) + "stop"))))))) (define %dovecot-pam-services (list (unix-pam-service "dovecot"))) @@ -1533,7 +1534,7 @@ greyed out, instead of only later giving \"not selectable\" popup error. (service-extension pam-root-service-type (const %dovecot-pam-services)) (service-extension activation-service-type - (const %dovecot-activation)))))) + %dovecot-activation))))) (define* (dovecot-service #:key (config (dovecot-configuration))) "Return a service that runs @command{dovecot}, a mail server that can run -- 2.16.2 From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. References: <20180307213030.30466-1-go.wigust@gmail.com> In-Reply-To: <20180307213030.30466-1-go.wigust@gmail.com> Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Mar 2018 21:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 30744@debbugs.gnu.org Cc: Oleg Pykhalov Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152045839615537 (code B ref 30744); Wed, 07 Mar 2018 21:34:02 +0000 Received: (at 30744) by debbugs.gnu.org; 7 Mar 2018 21:33:16 +0000 Received: from localhost ([127.0.0.1]:49927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etggW-00042X-50 for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:33:16 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:37540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etggU-00042I-IC for 30744@debbugs.gnu.org; Wed, 07 Mar 2018 16:33:14 -0500 Received: by mail-lf0-f43.google.com with SMTP id y19-v6so5387694lfd.4 for <30744@debbugs.gnu.org>; Wed, 07 Mar 2018 13:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uA8Uj1KhAb2IkLbPr8tmJlsCctlk9IMAXaswK5DFtN8=; b=UDxU1Gdu9QXNPxx0p/k1posI4wY1O8Yn37fn1xzA4V34uoX3BCpGUoXBF2uB7fNZAI NQw8ZyjBvYfoFQyd56elCm4bR+8LKnnKZugR/Dix68n22HQFEEBw97tml2U9x4KaGS34 Sp+yuxthmk1uRB1/TRXYU22kDVGHi4jsEAap7kKK9DXKYjlGjfTaSQdvIQw2NobLZLyP O20He3lcFFOSxlQU7QzivCw7N0roh/YtMen/Jt7KVk3oVpZ7CUrTXqxwG1xL1LMLEDrc djvlKBQ4Kpe+YTkCI0JXU2Uq54lJ9g2QaLQ3Jdx1xU/nnCXeU/gKn8/WZsUuxbtfAVOx 7V3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uA8Uj1KhAb2IkLbPr8tmJlsCctlk9IMAXaswK5DFtN8=; b=Sh/Sbg5VBhHcawHFPjxxAxWogw7x3p/W8auHuqBUqIk0e66XIE2YLf8Qzrs6ez44UF 5N4HlJ0UySXgi5n8FtMsr008zhWuk7/t1l2YmG19+RzYDIXoP8IkPw2nLxDsiw8+cqcI Yvcbt0uxvOhuVg+cmR+JJCpUPoOM50QqFkfZvRmYvQO2QtySYt33oO9j+PanV5bAP9PY nOZMSOAZfYbMPVWFN+RD5hHBmsaOL2AI3UfLL35WdrN1D3g0JKWM4BqvD3Jdv3xZEaus nEmHLztpDLGnIqu9ph7no/AZEPhq4cyNmnNdjzixpXIWEhuyREoQmWLtX2S6cgAbZ8wd w+BQ== X-Gm-Message-State: AElRT7HG8sAv/zrWAhlT0jpgaOmPWdPToKiIirH9LMWsZxGxl4lGaYe/ MPC6xeTOpU6FGA8cnyGwmgH5Ww== X-Google-Smtp-Source: AG47ELsxK1hH36R+ZryP/9Iv+ftJwSiwwA+Q5AkuhiBJTBiDOBd/FBEmmQS0UjZn/XSW09MUGd/uyw== X-Received: by 10.25.16.66 with SMTP id f63mr14696348lfi.113.1520458388325; Wed, 07 Mar 2018 13:33:08 -0800 (PST) Received: from localhost.localdomain (92-100-247-246.dynamic.avangarddsl.ru. [92.100.247.246]) by smtp.gmail.com with ESMTPSA id 7sm3824124ljx.39.2018.03.07.13.33.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 13:33:07 -0800 (PST) From: Oleg Pykhalov Date: Thu, 8 Mar 2018 00:32:43 +0300 Message-Id: <20180307213243.31064-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.16.2 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/tests/mail.scm (%dovecot-os, %test-dovecot): New variables. (run-dovecot-test): New procedure. --- gnu/tests/mail.scm | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 312df9b1c..69fe016e7 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -29,7 +29,8 @@ #:use-module (guix store) #:use-module (ice-9 ftw) #:export (%test-opensmtpd - %test-exim)) + %test-exim + %test-dovecot)) (define %opensmtpd-os (simple-operating-system @@ -279,3 +280,113 @@ acl_check_data: (name "exim") (description "Send an email to a running an Exim server.") (value (run-exim-test)))) + +(define %dovecot-os + (simple-operating-system + (dhcp-client-service) + (dovecot-service #:config + (dovecot-configuration + (disable-plaintext-auth? #f) + (ssl? "no") + (auth-mechanisms '("anonymous")) + (auth-anonymous-username "alice") + (mail-location + (string-append "maildir:~/Maildir" + ":INBOX=~/Maildir/INBOX" + ":LAYOUT=fs")))))) + +(define (run-dovecot-test) + "Return a test of an OS running Dovecot service." + (define vm + (virtual-machine + (operating-system (marionette-operating-system + %dovecot-os + #:imported-modules '((gnu services herd)))) + (port-forwardings '((8143 . 143))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (ice-9 iconv) + (ice-9 rdelim) + (ice-9 regex) + (rnrs base) + (rnrs bytevectors) + (srfi srfi-64)) + + (define marionette + (make-marionette '(#$vm))) + + (define* (message-length message #:key (encoding "iso-8859-1")) + (bytevector-length (string->bytevector message encoding))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "dovecot") + + ;; Wait for dovecot to be up and running. + (test-eq "dovecot running" + 'running! + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'dovecot) + 'running!) + marionette)) + + (sleep 1) ; give the service time to start talking + + (test-eq "accept an email" + #t + (let ((imap (socket AF_INET SOCK_STREAM 0)) + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143)) + (message "From: test@example.com\n\ +Subject: Hello Nice to meet you!")) + (connect imap addr) + ;; Be greeted. + (read-line imap) ;OK + ;; Authenticate + (write-line "a AUTHENTICATE ANONYMOUS" imap) + (read-line imap) ;+ + (write-line "c2lyaGM=" imap) + (read-line imap) ;OK + ;; Create a TESTBOX mailbox + (write-line "a CREATE TESTBOX" imap) + (read-line imap) ;OK + ;; Append a message to a TESTBOX mailbox + (write-line (format #f "a APPEND TESTBOX {~a}" + (number->string (message-length message))) + imap) + (read-line imap) ;+ + (write-line message imap) + (read-line imap) ;OK + ;; Logout + (write-line "a LOGOUT" imap) + (close imap) + #t)) + + (test-assert "mail arrived" + (marionette-eval + '(begin + (use-modules (ice-9 ftw) + (ice-9 match)) + ;; Get a message ID + (string->number + (match (scandir "/home/alice/Maildir/TESTBOX/new/") + ((_ _ message) + (match (string-split message #\.) + ((message-id _ _) message-id)))))) + marionette)) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "dovecot-test" test)) + +(define %test-dovecot + (system-test + (name "dovecot") + (description "Connect to a running Dovecot server.") + (value (run-dovecot-test)))) -- 2.16.2 From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Mar 2018 23:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152046566227522 (code B ref 30744); Wed, 07 Mar 2018 23:35:01 +0000 Received: (at 30744) by debbugs.gnu.org; 7 Mar 2018 23:34:22 +0000 Received: from localhost ([127.0.0.1]:49989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etiZi-00079q-9S for submit@debbugs.gnu.org; Wed, 07 Mar 2018 18:34:22 -0500 Received: from mail.lassieur.org ([83.152.10.219]:55044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etiZh-00079i-2W for 30744@debbugs.gnu.org; Wed, 07 Mar 2018 18:34:21 -0500 Received: from rodion (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 5ea1eeb5 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Wed, 7 Mar 2018 23:34:19 +0000 (UTC) References: <20180307213030.30466-1-go.wigust@gmail.com> <20180307213243.31064-1-go.wigust@gmail.com> User-agent: mu4e 1.0; emacs 25.3.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <20180307213243.31064-1-go.wigust@gmail.com> Date: Thu, 08 Mar 2018 00:34:13 +0100 Message-ID: <87371bsbnu.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hi Oleg, Oleg Pykhalov writes: > * gnu/tests/mail.scm (%dovecot-os, %test-dovecot): New variables. > (run-dovecot-test): New procedure. > --- > gnu/tests/mail.scm | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 112 insertions(+), 1 deletion(-) Thank you for these patches! > diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm > index 312df9b1c..69fe016e7 100644 > --- a/gnu/tests/mail.scm > +++ b/gnu/tests/mail.scm > @@ -29,7 +29,8 @@ > #:use-module (guix store) > #:use-module (ice-9 ftw) > #:export (%test-opensmtpd > - %test-exim)) > + %test-exim > + %test-dovecot)) > > (define %opensmtpd-os > (simple-operating-system > @@ -279,3 +280,113 @@ acl_check_data: > (name "exim") > (description "Send an email to a running an Exim server.") > (value (run-exim-test)))) > + > +(define %dovecot-os > + (simple-operating-system > + (dhcp-client-service) > + (dovecot-service #:config > + (dovecot-configuration > + (disable-plaintext-auth? #f) > + (ssl? "no") > + (auth-mechanisms '("anonymous")) > + (auth-anonymous-username "alice") > + (mail-location > + (string-append "maildir:~/Maildir" > + ":INBOX=~/Maildir/INBOX" > + ":LAYOUT=fs")))))) > + > +(define (run-dovecot-test) > + "Return a test of an OS running Dovecot service." > + (define vm > + (virtual-machine > + (operating-system (marionette-operating-system > + %dovecot-os > + #:imported-modules '((gnu services herd)))) > + (port-forwardings '((8143 . 143))))) > + > + (define test > + (with-imported-modules '((gnu build marionette)) > + #~(begin > + (use-modules (gnu build marionette) > + (ice-9 iconv) > + (ice-9 rdelim) > + (ice-9 regex) > + (rnrs base) > + (rnrs bytevectors) > + (srfi srfi-64)) > + > + (define marionette > + (make-marionette '(#$vm))) > + > + (define* (message-length message #:key (encoding "iso-8859-1")) > + (bytevector-length (string->bytevector message encoding))) > + > + (mkdir #$output) > + (chdir #$output) > + > + (test-begin "dovecot") > + > + ;; Wait for dovecot to be up and running. > + (test-eq "dovecot running" > + 'running! > + (marionette-eval > + '(begin > + (use-modules (gnu services herd)) > + (start-service 'dovecot) > + 'running!) > + marionette)) > + > + (sleep 1) ; give the service time to start talking Here, it would probably be safer to wait for the PID file to arrive. You could use 'wait-for-file' for this, there are examples in other tests. Dovecot's PID file is /var/run/dovecot/master.pid. > + (test-eq "accept an email" > + #t Could you use 'test-assert' here? > + (let ((imap (socket AF_INET SOCK_STREAM 0)) > + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143)) > + (message "From: test@example.com\n\ > +Subject: Hello Nice to meet you!")) > + (connect imap addr) > + ;; Be greeted. > + (read-line imap) ;OK > + ;; Authenticate > + (write-line "a AUTHENTICATE ANONYMOUS" imap) > + (read-line imap) ;+ > + (write-line "c2lyaGM=" imap) > + (read-line imap) ;OK > + ;; Create a TESTBOX mailbox > + (write-line "a CREATE TESTBOX" imap) > + (read-line imap) ;OK > + ;; Append a message to a TESTBOX mailbox > + (write-line (format #f "a APPEND TESTBOX {~a}" > + (number->string (message-length message))) > + imap) > + (read-line imap) ;+ > + (write-line message imap) > + (read-line imap) ;OK > + ;; Logout > + (write-line "a LOGOUT" imap) > + (close imap) > + #t)) > + > + (test-assert "mail arrived" > + (marionette-eval > + '(begin > + (use-modules (ice-9 ftw) > + (ice-9 match)) > + ;; Get a message ID > + (string->number > + (match (scandir "/home/alice/Maildir/TESTBOX/new/") > + ((_ _ message) Could you write "." ".." here instead of _ _? It makes it easier to understand the code. > + (match (string-split message #\.) > + ((message-id _ _) message-id)))))) Here I think it would be great to compare the arrived message and the sent message to check that they are the same. If they are the same, then the test succeeds. WDYT? > + marionette)) > + > + (test-end) > + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) > + > + (gexp->derivation "dovecot-test" test)) > + > +(define %test-dovecot > + (system-test > + (name "dovecot") > + (description "Connect to a running Dovecot server.") > + (value (run-dovecot-test)))) From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH 1/2] services: dovecot: Copy dovecot.conf to /etc/dovecot. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Mar 2018 23:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152046570027584 (code B ref 30744); Wed, 07 Mar 2018 23:35:02 +0000 Received: (at 30744) by debbugs.gnu.org; 7 Mar 2018 23:35:00 +0000 Received: from localhost ([127.0.0.1]:49992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etiaK-0007Aq-Ky for submit@debbugs.gnu.org; Wed, 07 Mar 2018 18:35:00 -0500 Received: from mail.lassieur.org ([83.152.10.219]:55048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etiaI-0007Af-EM for 30744@debbugs.gnu.org; Wed, 07 Mar 2018 18:34:58 -0500 Received: from rodion (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 4a06fbf8 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Wed, 7 Mar 2018 23:34:57 +0000 (UTC) References: <20180307213030.30466-1-go.wigust@gmail.com> User-agent: mu4e 1.0; emacs 25.3.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <20180307213030.30466-1-go.wigust@gmail.com> Date: Thu, 08 Mar 2018 00:34:56 +0100 Message-ID: <871sgvsbmn.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Oleg Pykhalov writes: > Many Dovecot utilities compiled with assumption of ‘/etc/dovecot/dovecot.conf’ > existence. > > * gnu/services/mail.scm (dovecot-shepherd-service): Move config generation. > Invoke ‘dovecot’ without ‘-c’ flag. > (%dovecot-activation): Copy ‘dovecot.conf’ to ‘/etc/dovecot’. > (dovecot-service-type): Make ‘%dovecot-activation’ non-constant. > --- > gnu/services/mail.scm | 147 +++++++++++++++++++++++++------------------------- > 1 file changed, 74 insertions(+), 73 deletions(-) Ok! Thank you. From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 08 Mar 2018 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152049750124511 (code B ref 30744); Thu, 08 Mar 2018 08:25:02 +0000 Received: (at 30744) by debbugs.gnu.org; 8 Mar 2018 08:25:01 +0000 Received: from localhost ([127.0.0.1]:50144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etqrD-0006N9-M6 for submit@debbugs.gnu.org; Thu, 08 Mar 2018 03:25:01 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:42250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etqrB-0006Mr-LO for 30744@debbugs.gnu.org; Thu, 08 Mar 2018 03:24:58 -0500 Received: by mail-lf0-f54.google.com with SMTP id t204-v6so7130084lff.9 for <30744@debbugs.gnu.org>; Thu, 08 Mar 2018 00:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Wi8AIKp/fyZ4xZzM2DIHNrSQDK1wMDPg/oWOFO5R9KM=; b=WkLPKbL6mtE+N4M0Ldmm4Hh+BpPHsj07R8OyBE5hIe+HTWbyGP3LAnkf2LfHbr0Kpn Ob8jvQUNnOqjl5KBU86vuZh63uwYfRQ7fQg2ZKGald/AOe8y3AiWQy0ozYmNLDQAQAlK KGQq9AUiDhL27RtyoKFDORBKRWegI7FKumRJIjmwOCsbG8nVtDwTH6KFkA10mgHuBw1F q/KSVhEnko6jc60QVk2RoLujxAZM7PA3NlOQQAzGzTsPqQzEfXJM2rYqJFdwy9Y834iX H7N+vVY/MNl9i2nugvQ4R2HfGFNEEqR0sSvjVRnENQvXP9DMk6e4bCA8C44TRPTzP95a KSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Wi8AIKp/fyZ4xZzM2DIHNrSQDK1wMDPg/oWOFO5R9KM=; b=U7lseFLiczJyIkd24dixZxXlzv0v6FddCWC5+bNw7BPQKZRsyHo1C0Gho5u+gYc6B7 bCsT/0LHdTVm7L3+hqWWB3ysBwJcjodoUvXxOlJVGLiLK1b/hax5vpvJ0EZCCJpzm1nW LM5lImY/ANOIyuovb66CBGzIY/+yfKXWjifYbFqCk12QVH+zuOHH+fPLex5eLXx4ADB7 oD35iQJ2xqSa61wcF7F4LCPlTurHjkiOtXzijdqKq57GypbrYJJVe+b+U8HGilJDMueo nU8PTk2c+bEKF1Pm9vlVONv4mCN91vrRd7I0tfWqQn/jxjmOu4EzimZnMayo6c9b6YFe fzAg== X-Gm-Message-State: AElRT7EDwsy9Xav5QL3SSkl/aMwKNAQ9+BJNP+4zoTV0AT9RCNVm0bw/ 5YsPQJvD6C6YU+TmEipxjTY+xg== X-Google-Smtp-Source: AG47ELtAtK8HcvJU/4hSjgjf8ElXU8WGENRgVaJZtfCuSb8z+svHZo9BnHaurufrlvyV29hHVDB20Q== X-Received: by 10.25.20.37 with SMTP id k37mr18872430lfi.78.1520497491333; Thu, 08 Mar 2018 00:24:51 -0800 (PST) Received: from magnolia (92-100-247-246.dynamic.avangarddsl.ru. [92.100.247.246]) by smtp.gmail.com with ESMTPSA id j69sm4130269lfk.16.2018.03.08.00.24.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Mar 2018 00:24:50 -0800 (PST) From: Oleg Pykhalov References: <20180307213030.30466-1-go.wigust@gmail.com> <20180307213243.31064-1-go.wigust@gmail.com> <87371bsbnu.fsf@lassieur.org> Date: Thu, 08 Mar 2018 11:24:45 +0300 In-Reply-To: <87371bsbnu.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Thu, 08 Mar 2018 00:34:13 +0100") Message-ID: <87po4fug8i.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Cl=C3=A9ment, Cl=C3=A9ment Lassieur writes: > Oleg Pykhalov writes: > >> * gnu/tests/mail.scm (%dovecot-os, %test-dovecot): New variables. >> (run-dovecot-test): New procedure. >> --- >> gnu/tests/mail.scm | 113 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++- >> 1 file changed, 112 insertions(+), 1 deletion(-) > > Thank you for these patches! Thank you for review! [=E2=80=A6] >> + (sleep 1) ; give the service time to start talking > > Here, it would probably be safer to wait for the PID file to arrive. > You could use 'wait-for-file' for this, there are examples in other > tests. Dovecot's PID file is /var/run/dovecot/master.pid. OK. >> + (test-eq "accept an email" >> + #t > > Could you use 'test-assert' here? OK. [=E2=80=A6] >> + ;; Get a message ID >> + (string->number >> + (match (scandir "/home/alice/Maildir/TESTBOX/new/") >> + ((_ _ message) > > Could you write "." ".." here instead of _ _? It makes it easier to > understand the code. Seems it's not possible for ".": =2D-8<---------------cut here---------------start------------->8--- natsu@magnolia ~/src/guix$ ./pre-inst-env make check-system TESTS=3D"doveco= t" Compiling Scheme modules... LOAD gnu/tests/mail.scm ERROR: In procedure read: In procedure scm_i_lreadparen: gnu/tests/mail.scm:378:28: missing close par= en make: *** [Makefile:5227: make-go] Error 1 =2D-8<---------------cut here---------------end--------------->8--- WDYT about replacing "." (or first =E2=80=98_=E2=80=99) with =E2=80=98cwd= =E2=80=99? I also rename =E2=80=98message=E2=80=99 to =E2=80=98message-file=E2=80=99 i= f you don't mind. So in the end we will have =E2=80=98(match =E2=80=A6 (cwd .. message-file) = =E2=80=A6)=E2=80=99. >> + (match (string-split message #\.) >> + ((message-id _ _) message-id)))))) > > Here I think it would be great to compare the arrived message and the > sent message to check that they are the same. If they are the same, > then the test succeeds. WDYT? OK. I'll attach the patch after this email. Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlqg800ACgkQckbhHGm3 lWnpIw/+KSk7XjwCYdR0GMSTvl18HPNMBo5Bs54pF4nvvMO1+ykkiY7FoONCvE4i mwyldAPs9bGX7ykaoPF4ObVm5fgb7HyJoEcaRWIwWObLIMY38bR5Cs2C0N28H0YB fdtvOigpVsU6dRLOIZ2T5F/oXpCxjT9ptcMjkCVHrct6TCcLfCacF/ZjGd6RjYFC 7WtArWce8xmhuQYMcqlUkSGl9UYBiOKXDtOMBWxDvfNPeYH0MSHUUa1BY4RshRqW QJUgyBoiEaNHdeWY7ozEizJF28f0Uylk7CrlJuxeIKPp7w5ZnfVYDY6MwPVZoc87 pceSsAK2TmUTv9QrE2dZwxU7TqUpjIWxYxzKiQDhIGAdeIapshZZY5FRZ6AyYhqs fFiyNnHvnTb5QlautXwCr+bpBDDAlh0HuWzmfpvWWqk8prYNKN7GW3RD1vvLT7aZ 3SX3boR8fAXRlQkCW089c4OejbOx0FQ1OLlu7hspauLOBCZA1qCwyMjGJEHRfzmZ Q8pVm7WuW3AquQDgfJ5BBo5cMGAieLNmLN2/MUbmdvLhMLsnG+Z/QaZ1nQUw8xTq WDIA9gkj0KEKcBGzo83HxEnV2OuFsUNOJEdNKz5Li4l1xwoub7VxtOYA7vkRlRn9 Ohrx+CpvkKO3XjF4VgMPnPGzyNQzkRYQe554XqZsvkQByKPu1D0= =yJH9 -----END PGP SIGNATURE----- --=-=-=-- From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 08 Mar 2018 08:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 30744@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: Oleg Pykhalov Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152049775524947 (code B ref 30744); Thu, 08 Mar 2018 08:30:02 +0000 Received: (at 30744) by debbugs.gnu.org; 8 Mar 2018 08:29:15 +0000 Received: from localhost ([127.0.0.1]:50148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etqvJ-0006UH-V2 for submit@debbugs.gnu.org; Thu, 08 Mar 2018 03:29:15 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:39330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etqvI-0006Tv-6M for 30744@debbugs.gnu.org; Thu, 08 Mar 2018 03:29:12 -0500 Received: by mail-lf0-f50.google.com with SMTP id f75-v6so7152561lfg.6 for <30744@debbugs.gnu.org>; Thu, 08 Mar 2018 00:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jYNpP6wMXP+fndhIJvcv1Osmwve0F4WbvqbpO9hYNx0=; b=T7kV3nocJsgl3F2reOXpKi2DgOrap9ztqSSlXozdEE/MgnVXrguiT983hujg7hPg2E 1cr0hC3GW7qC/x6hjgPPeKhPwtvzrTabkb/J0QpBlDm8BG9W7OzXCLpkoF6XoLOxqly/ uGfWKzFGaeln+U6GCm4sSRLol7bXiBOMbPxYEwH8VHd4jfnCrXrl0KVvhgGkLOV0ASMm JZqyE27tL43+9PbhGG5oROqZY7wG8XcQEa1oP21jT1c9AhZt7aaCwrO41gs+CIL4OOyl R/QVARB4FzN/bSYHLBpKWoyQicnl1yRuKUxo/uzBtS5hsl6kD+aUH/U+DuS0NcqW2an5 dh9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jYNpP6wMXP+fndhIJvcv1Osmwve0F4WbvqbpO9hYNx0=; b=gFIcDxyEaglpVs98GIloMMf3VpAuUynECGq6WeHSVxb2wNDOFGmClUwHtkYHAVCqCK zkXpvdGLXn8Prb3dKWvlhK9UGVko2CbXnnGlqCoFgNc4Hx/lMURSjf6YqbfWHpkckWCk FckKWQp3CUMVdsj6e7ourQsLrmm+54ROdmGdQB+9GnAW9Y7uSMO1PYhjy0W5xpkAFc/X oUnH9D49VHyK282ViPD5kb5kyAk0kQrbbvovnKoYlEAOj1H7lCV1M0vnu9/i9LRV+Wov Zn8BeJo5DE9T7ngXN832vNNDYIlR4nCAjLUlhAswkvy0tVjBx3OOXEFfg+DQ86HOIAu5 cV1w== X-Gm-Message-State: AElRT7EZkawm2vD+ceWKv8vnFGhggRb3ne2rtnscmjZaUsn4McF6sAb/ VDR/criAFlPJOGJf8Fo2JKZhHg== X-Google-Smtp-Source: AG47ELssOR25TYaMSSLQC8fEtHPykN55tmYmTX54Qjk5qY7rZcQZUWVlf8yL/qeY5XL7wkhcVvaosg== X-Received: by 10.25.201.76 with SMTP id z73mr17747887lff.74.1520497746019; Thu, 08 Mar 2018 00:29:06 -0800 (PST) Received: from localhost.localdomain (92-100-247-246.dynamic.avangarddsl.ru. [92.100.247.246]) by smtp.gmail.com with ESMTPSA id g24sm3933512lje.97.2018.03.08.00.29.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 00:29:05 -0800 (PST) From: Oleg Pykhalov Date: Thu, 8 Mar 2018 11:28:55 +0300 Message-Id: <20180308082855.7113-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <87po4fug8i.fsf@gmail.com> References: <87po4fug8i.fsf@gmail.com> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/tests/mail.scm (%dovecot-os, %test-dovecot): New variables. (run-dovecot-test): New procedure. --- gnu/tests/mail.scm | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 312df9b1c..77f273f8b 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -29,7 +29,8 @@ #:use-module (guix store) #:use-module (ice-9 ftw) #:export (%test-opensmtpd - %test-exim)) + %test-exim + %test-dovecot)) (define %opensmtpd-os (simple-operating-system @@ -279,3 +280,114 @@ acl_check_data: (name "exim") (description "Send an email to a running an Exim server.") (value (run-exim-test)))) + +(define %dovecot-os + (simple-operating-system + (dhcp-client-service) + (dovecot-service #:config + (dovecot-configuration + (disable-plaintext-auth? #f) + (ssl? "no") + (auth-mechanisms '("anonymous")) + (auth-anonymous-username "alice") + (mail-location + (string-append "maildir:~/Maildir" + ":INBOX=~/Maildir/INBOX" + ":LAYOUT=fs")))))) + +(define (run-dovecot-test) + "Return a test of an OS running Dovecot service." + (define vm + (virtual-machine + (operating-system (marionette-operating-system + %dovecot-os + #:imported-modules '((gnu services herd)))) + (port-forwardings '((8143 . 143))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (ice-9 iconv) + (ice-9 rdelim) + (rnrs base) + (rnrs bytevectors) + (srfi srfi-64)) + + (define marionette + (make-marionette '(#$vm))) + + (define* (message-length message #:key (encoding "iso-8859-1")) + (bytevector-length (string->bytevector message encoding))) + + (define message "From: test@example.com\n\ +Subject: Hello Nice to meet you!") + + (mkdir #$output) + (chdir #$output) + + (test-begin "dovecot") + + ;; Wait for dovecot to be up and running. + (test-eq "dovecot running" + 'running! + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'dovecot) + 'running!) + marionette)) + + ;; Give the service time to start talking. + (wait-for-file "/var/run/dovecot/master.pid" marionette) + + (test-assert "accept an email" + (let ((imap (socket AF_INET SOCK_STREAM 0)) + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143))) + (connect imap addr) + ;; Be greeted. + (read-line imap) ;OK + ;; Authenticate + (write-line "a AUTHENTICATE ANONYMOUS" imap) + (read-line imap) ;+ + (write-line "c2lyaGM=" imap) + (read-line imap) ;OK + ;; Create a TESTBOX mailbox + (write-line "a CREATE TESTBOX" imap) + (read-line imap) ;OK + ;; Append a message to a TESTBOX mailbox + (write-line (format #f "a APPEND TESTBOX {~a}" + (number->string (message-length message))) + imap) + (read-line imap) ;+ + (write-line message imap) + (read-line imap) ;OK + ;; Logout + (write-line "a LOGOUT" imap) + (close imap) + #t)) + + (test-equal "mail arrived" + message + (marionette-eval + '(begin + (use-modules (ice-9 ftw) + (ice-9 match)) + (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/")) + (match (scandir TESTBOX/new) + ((cwd .. message-file) + (call-with-input-file + (string-append TESTBOX/new message-file) + get-string-all))))) + marionette)) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "dovecot-test" test)) + +(define %test-dovecot + (system-test + (name "dovecot") + (description "Connect to a running Dovecot server.") + (value (run-dovecot-test)))) -- 2.16.2 From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 08 Mar 2018 09:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152050209114842 (code B ref 30744); Thu, 08 Mar 2018 09:42:01 +0000 Received: (at 30744) by debbugs.gnu.org; 8 Mar 2018 09:41:31 +0000 Received: from localhost ([127.0.0.1]:50202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ets3G-0003rK-Pw for submit@debbugs.gnu.org; Thu, 08 Mar 2018 04:41:31 -0500 Received: from mail.lassieur.org ([83.152.10.219]:55854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ets3F-0003rC-AB for 30744@debbugs.gnu.org; Thu, 08 Mar 2018 04:41:29 -0500 Received: from newt (46.218.109.88 [46.218.109.88]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 2b43d26c (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Thu, 8 Mar 2018 09:41:27 +0000 (UTC) References: <87po4fug8i.fsf@gmail.com> <20180308082855.7113-1-go.wigust@gmail.com> User-agent: mu4e 1.0; emacs 25.3.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <20180308082855.7113-1-go.wigust@gmail.com> Date: Thu, 08 Mar 2018 10:41:27 +0100 Message-ID: <87tvtqaoqg.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Oleg Pykhalov writes: > * gnu/tests/mail.scm (%dovecot-os, %test-dovecot): New variables. > (run-dovecot-test): New procedure. > --- > gnu/tests/mail.scm | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 113 insertions(+), 1 deletion(-) > > diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm > index 312df9b1c..77f273f8b 100644 > --- a/gnu/tests/mail.scm > +++ b/gnu/tests/mail.scm > @@ -29,7 +29,8 @@ > #:use-module (guix store) > #:use-module (ice-9 ftw) > #:export (%test-opensmtpd > - %test-exim)) > + %test-exim > + %test-dovecot)) > > (define %opensmtpd-os > (simple-operating-system > @@ -279,3 +280,114 @@ acl_check_data: > (name "exim") > (description "Send an email to a running an Exim server.") > (value (run-exim-test)))) > + > +(define %dovecot-os > + (simple-operating-system > + (dhcp-client-service) > + (dovecot-service #:config > + (dovecot-configuration > + (disable-plaintext-auth? #f) > + (ssl? "no") > + (auth-mechanisms '("anonymous")) > + (auth-anonymous-username "alice") > + (mail-location > + (string-append "maildir:~/Maildir" > + ":INBOX=~/Maildir/INBOX" > + ":LAYOUT=fs")))))) > + > +(define (run-dovecot-test) > + "Return a test of an OS running Dovecot service." > + (define vm > + (virtual-machine > + (operating-system (marionette-operating-system > + %dovecot-os > + #:imported-modules '((gnu services herd)))) > + (port-forwardings '((8143 . 143))))) > + > + (define test > + (with-imported-modules '((gnu build marionette)) > + #~(begin > + (use-modules (gnu build marionette) > + (ice-9 iconv) > + (ice-9 rdelim) > + (rnrs base) > + (rnrs bytevectors) > + (srfi srfi-64)) > + > + (define marionette > + (make-marionette '(#$vm))) > + > + (define* (message-length message #:key (encoding "iso-8859-1")) > + (bytevector-length (string->bytevector message encoding))) > + > + (define message "From: test@example.com\n\ > +Subject: Hello Nice to meet you!") > + > + (mkdir #$output) > + (chdir #$output) > + > + (test-begin "dovecot") > + > + ;; Wait for dovecot to be up and running. > + (test-eq "dovecot running" > + 'running! > + (marionette-eval > + '(begin > + (use-modules (gnu services herd)) > + (start-service 'dovecot) > + 'running!) > + marionette)) > + > + ;; Give the service time to start talking. > + (wait-for-file "/var/run/dovecot/master.pid" marionette) Could you put it in a test context (test-assert with file-exists? for example, see tests/messaging.scm)? > + (test-assert "accept an email" > + (let ((imap (socket AF_INET SOCK_STREAM 0)) > + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143))) > + (connect imap addr) > + ;; Be greeted. > + (read-line imap) ;OK > + ;; Authenticate > + (write-line "a AUTHENTICATE ANONYMOUS" imap) > + (read-line imap) ;+ > + (write-line "c2lyaGM=" imap) > + (read-line imap) ;OK > + ;; Create a TESTBOX mailbox > + (write-line "a CREATE TESTBOX" imap) > + (read-line imap) ;OK > + ;; Append a message to a TESTBOX mailbox > + (write-line (format #f "a APPEND TESTBOX {~a}" > + (number->string (message-length message))) > + imap) > + (read-line imap) ;+ > + (write-line message imap) > + (read-line imap) ;OK > + ;; Logout > + (write-line "a LOGOUT" imap) > + (close imap) > + #t)) > + > + (test-equal "mail arrived" > + message > + (marionette-eval > + '(begin > + (use-modules (ice-9 ftw) > + (ice-9 match)) > + (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/")) > + (match (scandir TESTBOX/new) > + ((cwd .. message-file) You need to use double quotes, like ("." ".." message-file) I believe. > + (call-with-input-file > + (string-append TESTBOX/new message-file) > + get-string-all))))) > + marionette)) > + > + (test-end) > + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) > + > + (gexp->derivation "dovecot-test" test)) > + > +(define %test-dovecot > + (system-test > + (name "dovecot") > + (description "Connect to a running Dovecot server.") > + (value (run-dovecot-test)))) From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Mar 2018 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152058791018047 (code B ref 30744); Fri, 09 Mar 2018 09:32:02 +0000 Received: (at 30744) by debbugs.gnu.org; 9 Mar 2018 09:31:50 +0000 Received: from localhost ([127.0.0.1]:51728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euENS-0004h1-Eg for submit@debbugs.gnu.org; Fri, 09 Mar 2018 04:31:50 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:38708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euENQ-0004gn-RO for 30744@debbugs.gnu.org; Fri, 09 Mar 2018 04:31:49 -0500 Received: by mail-lf0-f52.google.com with SMTP id i80-v6so12341361lfg.5 for <30744@debbugs.gnu.org>; Fri, 09 Mar 2018 01:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=84+yPN5CO1wimQ+sYv2TphFBjGeeXGQcJ52aSL+MLLg=; b=Mb374z3Vshu4sZRvfdpYFiuaPgScagtQbGiTewh/UA9ixljx1vyeftAwDq2aWCRi+Q EUa0eYu0HLXenPS1O3CLCFFKdmf8iOKhWa5QnJfBoFTiw2CpyFhxtLXT6u547Z7E/ZgA E61zUFLhtlOkcPO2uL0NWgGaY/Iw7F2qWSe9DBHUvbvXI46DSG3HilHWdOqVI5+h3dHK 49Srrw1By0b6JW+ogtD6H/k2O/sjV/AKVI/E2Oaz4plWIMYYgUb7/4inTN2eV4evk6Qk fvDc5NbjfwrNNgALdnOHKg+DblBGoEr5ix5ipo8ff494b40mwYuvzndpgrzphuL/W8S4 pcxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=84+yPN5CO1wimQ+sYv2TphFBjGeeXGQcJ52aSL+MLLg=; b=RK6ULRBppP6oeyuFDlQOsOAblMaDhJMLBwQzyOcCAmZRhSJSE7hgqGAz/PdZHk1yDg mkGHt4vaRvV7FTAApGNSMv25U2f9edz3DiqVVnXAPryjBP9IVTZcEDjcet7BgnsaTgp4 bP2nhcEo3MMXg56OkvTKGL0eq2oMGKgNgRFrX2e/vvV3qpmuo6IBwmB+bWb+NbH7Lw07 D5pkLGt2LPGSnPdUVuNbFyDkUTRSEUw6SItYurKDa//8CeusxEd93+iGJewKfs59qDOH vKx7/fJbBHgZuTKfZbH3f7mPdZLPsuLm12Su4OFE2V9/MjuLwBAQSBIAh1ZRKSQW+BOD sf1A== X-Gm-Message-State: APf1xPDkQa2Cw7V+dV18v999ijc/DLlU99320/qEp5IdIilaQTc7YMVZ CM5uI5BfzUN9bjLZmBKa/7fuLw== X-Google-Smtp-Source: AG47ELtyDkJIPqakQkn4+VdD0aM1eVVNVuu4PfZ5eFY1KaUju28ySGDsNuDqoc/hx8/QNcaZbMu38A== X-Received: by 10.46.93.91 with SMTP id r88mr20657923ljb.82.1520587902112; Fri, 09 Mar 2018 01:31:42 -0800 (PST) Received: from magnolia (ppp91-122-84-173.pppoe.avangarddsl.ru. [91.122.84.173]) by smtp.gmail.com with ESMTPSA id o28-v6sm159623lfc.63.2018.03.09.01.31.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 01:31:41 -0800 (PST) From: Oleg Pykhalov References: <87po4fug8i.fsf@gmail.com> <20180308082855.7113-1-go.wigust@gmail.com> <87tvtqaoqg.fsf@lassieur.org> Date: Fri, 09 Mar 2018 12:31:38 +0300 In-Reply-To: <87tvtqaoqg.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Thu, 08 Mar 2018 10:41:27 +0100") Message-ID: <87sh99lhmt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Cl=C3=A9ment, Cl=C3=A9ment Lassieur writes: > Oleg Pykhalov writes: [=E2=80=A6] >> + ;; Give the service time to start talking. >> + (wait-for-file "/var/run/dovecot/master.pid" marionette) > > Could you put it in a test context (test-assert with file-exists? for > example, see tests/messaging.scm)? OK. I replaced =E2=80=98(wait-for-file =E2=80=A6)=E2=80=99 and a comment with: =2D-8<---------------cut here---------------start------------->8--- ;; Check Dovecot service's PID. (test-assert "service process id" (let ((pid (number->string (wait-for-file "/var/run/dovecot/master.pid" marionette)))) (marionette-eval `(file-exists? (string-append "/proc/" ,pid)) marionette))) =2D-8<---------------cut here---------------end--------------->8--- [=E2=80=A6] >> + (match (scandir TESTBOX/new) >> + ((cwd .. message-file) > > You need to use double quotes, like ("." ".." message-file) I believe. It works. Thank you! [=E2=80=A6] I think it's ready for a push to =E2=80=98origin/master=E2=80=99. WDYT? Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlqiVHoACgkQckbhHGm3 lWmPDQ/9ES86paYF3Q9KEfIhyOuGp+WWSkd4drx3QCzwwjfJ+QNBrn7rbLucaZP7 /MoD3i87zGGVtX5XMD7h024sNG4T0s0zOg3Gtr2iNlRPOsvTkW2X0Iefta9JFzmM SDrP2HvXZKyFoigjD76oKSh7x57tpeg1C4jTaq/sVv0uOsPu/5ee7HAXXRuALrRT pmcUCyoLkLcZKi3MtWtOTyDqXcpS6R2/6ObokRZewABnW8qllNHdQ1USO6ggROd0 8tVuLZM8J/w7lISuOWgRm8cgj2Kc7ivbABerFFjbV3KiS6IoxVwakXGfruWolJmq ORcv8TOprhs4R8aG+OZ0vZuG23xspirdNivdf2b85SKIotBidrv4KXQGVIT0KRlo x6CmOLIlcOgG6bAecpNu5dAM5flfJonosbrE0AQ6qsk125Ekl25HzxsQaK2OzCI1 pHqZB7soXzHZURytSx/VOFzyeCIy+UgKpDNM/pybTovgGwBwAaBctkKwqyENyEYJ 4swVihPZu8vg8vBdRMQtS9Bh/JWCGcPiKq13w7PxxLnaoYeLdRNE8sQhsSxLvzXo iwxH1HmCDoRwd2dSXZQGRYZhg0FTFmg8+wmS7/ky0MJJX2rH4lFhcedS6XrdIsBc VdF4JkNGToAS4VG16b07LTQCc4bXkJ5SNCg+jU/Ia508JCQR3P8= =8NhZ -----END PGP SIGNATURE----- --=-=-=-- From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Mar 2018 10:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 30744@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152059058222354 (code B ref 30744); Fri, 09 Mar 2018 10:17:01 +0000 Received: (at 30744) by debbugs.gnu.org; 9 Mar 2018 10:16:22 +0000 Received: from localhost ([127.0.0.1]:51754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euF4Y-0005oU-CP for submit@debbugs.gnu.org; Fri, 09 Mar 2018 05:16:22 -0500 Received: from mail.lassieur.org ([83.152.10.219]:56016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euF4X-0005oM-5f for 30744@debbugs.gnu.org; Fri, 09 Mar 2018 05:16:21 -0500 Received: from newt (46.218.109.88 [46.218.109.88]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id d0c45cf0 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Fri, 9 Mar 2018 10:16:19 +0000 (UTC) References: <87po4fug8i.fsf@gmail.com> <20180308082855.7113-1-go.wigust@gmail.com> <87tvtqaoqg.fsf@lassieur.org> <87sh99lhmt.fsf@gmail.com> User-agent: mu4e 1.0; emacs 25.3.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <87sh99lhmt.fsf@gmail.com> Date: Fri, 09 Mar 2018 11:16:19 +0100 Message-ID: <87woylimfg.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Oleg Pykhalov writes: > Hello Clément, > > Clément Lassieur writes: > >> Oleg Pykhalov writes: > > […] > >>> + ;; Give the service time to start talking. >>> + (wait-for-file "/var/run/dovecot/master.pid" marionette) >> >> Could you put it in a test context (test-assert with file-exists? for >> example, see tests/messaging.scm)? > > OK. > > I replaced ‘(wait-for-file …)’ and a comment with: > --8<---------------cut here---------------start------------->8--- > ;; Check Dovecot service's PID. > (test-assert "service process id" > (let ((pid > (number->string (wait-for-file "/var/run/dovecot/master.pid" > marionette)))) > (marionette-eval `(file-exists? (string-append "/proc/" ,pid)) > marionette))) > --8<---------------cut here---------------end--------------->8--- Cool, thank you! > […] > >>> + (match (scandir TESTBOX/new) >>> + ((cwd .. message-file) >> >> You need to use double quotes, like ("." ".." message-file) I believe. > > It works. Thank you! > > […] > > I think it's ready for a push to ‘origin/master’. WDYT? Sure, you can push to master :-) From unknown Thu Jun 19 16:22:59 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#30744] [PATCH] tests: mail: Add test for dovecot. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Mar 2018 14:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30744 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 30744@debbugs.gnu.org, 30744-done@debbugs.gnu.org Received: via spool by 30744-submit@debbugs.gnu.org id=B30744.152060587430362 (code B ref 30744); Fri, 09 Mar 2018 14:32:02 +0000 Received: (at 30744) by debbugs.gnu.org; 9 Mar 2018 14:31:14 +0000 Received: from localhost ([127.0.0.1]:51899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euJ3B-0007tY-Tx for submit@debbugs.gnu.org; Fri, 09 Mar 2018 09:31:14 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:46644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euJ39-0007tH-Lq; Fri, 09 Mar 2018 09:31:12 -0500 Received: by mail-lf0-f43.google.com with SMTP id u26-v6so2256772lfk.13; Fri, 09 Mar 2018 06:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=jKXbVjM5mXcFWh4osxZEhiXlnZRqPav6dqtXfABXQoI=; b=eAxPh6zwz0IlZD2imZfepmd2LSdGRsU4KFfpd6PvEG0RR+75YaD1VaYess15jTHWHM AUyRFYseFdMrkPAT7M8TCGCbEzbFkKnJLYyogJpe6Oq5bxdr1JxeqNEBMe6FspiCkjma 9U8ffE2+tBV+oHfB5LMktaRl2grkHg6E2fu7pUTGB8lF6/9pVsLWNLsXW1pMKQzqq1tp hKqCnzbMR3U5VfkETJM9g0rjxw5uHUJLUkiusoRWtx5qc3avq1afwwFCkpGEXSfdORkM id6lNMiFAvH1TWxO5JIqHI1hUuUrF0kmzeNXUMTLl9/Py4Pt2T7rL3t/Xy7aqzInYlwc l8UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=jKXbVjM5mXcFWh4osxZEhiXlnZRqPav6dqtXfABXQoI=; b=nhxQVbNAUr0YihzDLJyqCDWh/Rj+oxWmHCxck2XCAC+99Q94HZ3Cym9ZSwavGXWTPV i/tXyp7T2ORHLTTlu1TRqEuBO7+2EPvso6Z0av/Bx9Hh6Rxtnrar1x+yrkN5aSWEog5y MqkvPbGPXIRyGO6bkLwcYy4zjm6J0+FOCv1tn5iXOLU4JVPOMVVTJqqKJiM98QpAHnXj LT0RIcCXtOEgbZY/Hy/1HXgwKnb325p1dqa5M8YDKcR6cgQwvPIAdleztk0qUGube7XI /5XyGHssc7fWU7eQEz7GVtchSehGaXLoyMkNdg33g14G9O2Yv0qMWavMdpYYPSFJsQiW fYKg== X-Gm-Message-State: APf1xPBP72tFeovwTvmTmFRRYou14+16fg5hGSg70fXUiZWaJdIiMunS BWNBp9PzH87o4HpQcioQ0hbFYQ== X-Google-Smtp-Source: AG47ELu9GOGyY/JSvDLGVqIDmQ0Y7HtgE75mOR3WbsJZbuBZl+u82L6Ll8lG95atkpJ+z/jM0BMvHA== X-Received: by 10.46.108.6 with SMTP id h6mr20936662ljc.125.1520605865387; Fri, 09 Mar 2018 06:31:05 -0800 (PST) Received: from magnolia (95-55-116-55.dynamic.avangarddsl.ru. [95.55.116.55]) by smtp.gmail.com with ESMTPSA id w204-v6sm320291lff.9.2018.03.09.06.31.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 06:31:03 -0800 (PST) From: Oleg Pykhalov References: <87po4fug8i.fsf@gmail.com> <20180308082855.7113-1-go.wigust@gmail.com> <87tvtqaoqg.fsf@lassieur.org> <87sh99lhmt.fsf@gmail.com> <87woylimfg.fsf@lassieur.org> Date: Fri, 09 Mar 2018 17:30:59 +0300 In-Reply-To: <87woylimfg.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Fri, 09 Mar 2018 11:16:19 +0100") Message-ID: <87lgf1l3rw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cl=C3=A9ment Lassieur writes: [=E2=80=A6] >> I think it's ready for a push to =E2=80=98origin/master=E2=80=99. WDYT? > > Sure, you can push to master :-) Also I added a copyright line for myself in =E2=80=98gnu/tests/mail.scm=E2= =80=99. Pushed as: 6310dff1dc3d9a6979312f93466d58650c1fe322 a9079b488037371f90514b82961dc075ea0b3985 I'll close the bug report. Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlqimqMACgkQckbhHGm3 lWlINg//f2VG/yxZUC+RTo9JnTHFtiXTUslhSmgBLF+T/CehcSOLyNMPQX1D3+ry Fo5+EgQqhi8liCxnJFJqJ4Lu52BSzUrFj4qtVUhnAkm2mssFQ/GbxfKl6ZUkOX0s 6nGihlyLu8kAQ7am147hyFn/CLOpd3bgGgw1hcAvJSe3Rgxl8vPwE+IxWg0xfO/5 ZVdgi8jK5mQ8eR9ZB8I2LeTHWdxs17Dp/ARJ2ANDXKUFyApNl1Vnr+/wAjRLoEXp 3ZyX3+Y1Su9Yirs54Vtypmg5f6BvYLB7HGngt4OAQZDb/dQttPtglRNlUCUn/V6w eHIK2gbsDPD2DZ+g3UV6EMR7vmbIl4Rhrs3Tet1Q+5gqcK+XMZbarRUiMdESuXa0 lNftTTIA+XyNBdd5Jbl4SaF8wRylyWgllZnGWCiamkq4gZoqS49W14hPF7kpDbZT 6YRnLKNZvglGsVWjM4W67nbuVFXHePoH/dkSo0KPN2JZpI8+5i3tnqXbeGTdjpWR DBEa2urvHkMbCUCRNK0T4KmHEeElX8KZFv+jy41hNaoc8kOJ5g8fvSVjpeOxyha3 1z1T5w2RJLWzTd0bZptKrreR/7K/ZTsmB0nkt6yowyDIKkEFnIaOz+sfcGTxdmy2 wRiIGF2rqnCXzNzPIOuhss/mevwGRQOYo/F8VkT0cEsTi+qnW6s= =GpeI -----END PGP SIGNATURE----- --=-=-=-- From unknown Thu Jun 19 16:22:59 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Oleg Pykhalov Subject: bug#30744: closed (Re: [bug#30744] [PATCH] tests: mail: Add test for dovecot.) Message-ID: References: <87lgf1l3rw.fsf@gmail.com> <20180307213030.30466-1-go.wigust@gmail.com> X-Gnu-PR-Message: they-closed 30744 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 30744@debbugs.gnu.org Date: Fri, 09 Mar 2018 14:32:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1520605924-30438-1" This is a multi-part message in MIME format... ------------=_1520605924-30438-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #30744: [PATCH 1/2] services: dovecot: Copy dovecot.conf to /etc/dovecot. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 30744@debbugs.gnu.org. --=20 30744: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30744 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1520605924-30438-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 30744-done) by debbugs.gnu.org; 9 Mar 2018 14:31:14 +0000 Received: from localhost ([127.0.0.1]:51897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euJ3B-0007tW-LI for submit@debbugs.gnu.org; Fri, 09 Mar 2018 09:31:13 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:46644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euJ39-0007tH-Lq; Fri, 09 Mar 2018 09:31:12 -0500 Received: by mail-lf0-f43.google.com with SMTP id u26-v6so2256772lfk.13; Fri, 09 Mar 2018 06:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=jKXbVjM5mXcFWh4osxZEhiXlnZRqPav6dqtXfABXQoI=; b=eAxPh6zwz0IlZD2imZfepmd2LSdGRsU4KFfpd6PvEG0RR+75YaD1VaYess15jTHWHM AUyRFYseFdMrkPAT7M8TCGCbEzbFkKnJLYyogJpe6Oq5bxdr1JxeqNEBMe6FspiCkjma 9U8ffE2+tBV+oHfB5LMktaRl2grkHg6E2fu7pUTGB8lF6/9pVsLWNLsXW1pMKQzqq1tp hKqCnzbMR3U5VfkETJM9g0rjxw5uHUJLUkiusoRWtx5qc3avq1afwwFCkpGEXSfdORkM id6lNMiFAvH1TWxO5JIqHI1hUuUrF0kmzeNXUMTLl9/Py4Pt2T7rL3t/Xy7aqzInYlwc l8UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=jKXbVjM5mXcFWh4osxZEhiXlnZRqPav6dqtXfABXQoI=; b=nhxQVbNAUr0YihzDLJyqCDWh/Rj+oxWmHCxck2XCAC+99Q94HZ3Cym9ZSwavGXWTPV i/tXyp7T2ORHLTTlu1TRqEuBO7+2EPvso6Z0av/Bx9Hh6Rxtnrar1x+yrkN5aSWEog5y MqkvPbGPXIRyGO6bkLwcYy4zjm6J0+FOCv1tn5iXOLU4JVPOMVVTJqqKJiM98QpAHnXj LT0RIcCXtOEgbZY/Hy/1HXgwKnb325p1dqa5M8YDKcR6cgQwvPIAdleztk0qUGube7XI /5XyGHssc7fWU7eQEz7GVtchSehGaXLoyMkNdg33g14G9O2Yv0qMWavMdpYYPSFJsQiW fYKg== X-Gm-Message-State: APf1xPBP72tFeovwTvmTmFRRYou14+16fg5hGSg70fXUiZWaJdIiMunS BWNBp9PzH87o4HpQcioQ0hbFYQ== X-Google-Smtp-Source: AG47ELu9GOGyY/JSvDLGVqIDmQ0Y7HtgE75mOR3WbsJZbuBZl+u82L6Ll8lG95atkpJ+z/jM0BMvHA== X-Received: by 10.46.108.6 with SMTP id h6mr20936662ljc.125.1520605865387; Fri, 09 Mar 2018 06:31:05 -0800 (PST) Received: from magnolia (95-55-116-55.dynamic.avangarddsl.ru. [95.55.116.55]) by smtp.gmail.com with ESMTPSA id w204-v6sm320291lff.9.2018.03.09.06.31.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 06:31:03 -0800 (PST) From: Oleg Pykhalov To: =?utf-8?Q?Cl=C3=A9ment?= Lassieur Subject: Re: [bug#30744] [PATCH] tests: mail: Add test for dovecot. References: <87po4fug8i.fsf@gmail.com> <20180308082855.7113-1-go.wigust@gmail.com> <87tvtqaoqg.fsf@lassieur.org> <87sh99lhmt.fsf@gmail.com> <87woylimfg.fsf@lassieur.org> Date: Fri, 09 Mar 2018 17:30:59 +0300 In-Reply-To: <87woylimfg.fsf@lassieur.org> (=?utf-8?Q?=22Cl=C3=A9ment?= Lassieur"'s message of "Fri, 09 Mar 2018 11:16:19 +0100") Message-ID: <87lgf1l3rw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30744-done Cc: 30744@debbugs.gnu.org, 30744-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cl=C3=A9ment Lassieur writes: [=E2=80=A6] >> I think it's ready for a push to =E2=80=98origin/master=E2=80=99. WDYT? > > Sure, you can push to master :-) Also I added a copyright line for myself in =E2=80=98gnu/tests/mail.scm=E2= =80=99. Pushed as: 6310dff1dc3d9a6979312f93466d58650c1fe322 a9079b488037371f90514b82961dc075ea0b3985 I'll close the bug report. Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlqimqMACgkQckbhHGm3 lWlINg//f2VG/yxZUC+RTo9JnTHFtiXTUslhSmgBLF+T/CehcSOLyNMPQX1D3+ry Fo5+EgQqhi8liCxnJFJqJ4Lu52BSzUrFj4qtVUhnAkm2mssFQ/GbxfKl6ZUkOX0s 6nGihlyLu8kAQ7am147hyFn/CLOpd3bgGgw1hcAvJSe3Rgxl8vPwE+IxWg0xfO/5 ZVdgi8jK5mQ8eR9ZB8I2LeTHWdxs17Dp/ARJ2ANDXKUFyApNl1Vnr+/wAjRLoEXp 3ZyX3+Y1Su9Yirs54Vtypmg5f6BvYLB7HGngt4OAQZDb/dQttPtglRNlUCUn/V6w eHIK2gbsDPD2DZ+g3UV6EMR7vmbIl4Rhrs3Tet1Q+5gqcK+XMZbarRUiMdESuXa0 lNftTTIA+XyNBdd5Jbl4SaF8wRylyWgllZnGWCiamkq4gZoqS49W14hPF7kpDbZT 6YRnLKNZvglGsVWjM4W67nbuVFXHePoH/dkSo0KPN2JZpI8+5i3tnqXbeGTdjpWR DBEa2urvHkMbCUCRNK0T4KmHEeElX8KZFv+jy41hNaoc8kOJ5g8fvSVjpeOxyha3 1z1T5w2RJLWzTd0bZptKrreR/7K/ZTsmB0nkt6yowyDIKkEFnIaOz+sfcGTxdmy2 wRiIGF2rqnCXzNzPIOuhss/mevwGRQOYo/F8VkT0cEsTi+qnW6s= =GpeI -----END PGP SIGNATURE----- --=-=-=-- ------------=_1520605924-30438-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Mar 2018 21:31:05 +0000 Received: from localhost ([127.0.0.1]:49922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etgeO-00036w-Fc for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:31:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etgeM-0002zp-UX for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:31:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etgeG-0004Fu-AG for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:30:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etgeG-0004Fo-60 for submit@debbugs.gnu.org; Wed, 07 Mar 2018 16:30:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etgeE-0007wh-E4 for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etgeA-0004Eh-C3 for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:54 -0500 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:44262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etge9-0004EY-VV for guix-patches@gnu.org; Wed, 07 Mar 2018 16:30:50 -0500 Received: by mail-lf0-x22b.google.com with SMTP id v9-v6so5359228lfa.11 for ; Wed, 07 Mar 2018 13:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZyhN2XkGRbRGQHW/MBIH2aMiFps1y35wdq58fvmpn9E=; b=NCR1LNFL9uMAh/uzPxD9jkNMaC5RhKA9Q3rb937swPgEUmBRyHjLxqAuz7r0xpwD48 QCnR3Hli0Lny0UY0YqUJWA6UtNJ/DFx3upyWyyeHjZHyyRYa+u+xK1zwKlteZ5bmNn7f kVOLJefrusk0zOfgfhJu3RgAZs24yHjy82UbN2kGets+JQuf8yo5dVVDdvntP638LSrN q1c4ZMUfNlFTK4R3YHkgS4JnwdZxmNH1mW8uJsXqTgjdpI8UOQX+yEQ5kibcw8yXBDgj eIJ9FmUgI0LXPCDEr72aX2sL/EebRuoC7n59y7nDUIVAU17msE88cSDj9RHZ4fIxVtgI 55FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZyhN2XkGRbRGQHW/MBIH2aMiFps1y35wdq58fvmpn9E=; b=Rnuth0MuqgqxTjyRyj7WeTfWrGZcVJ02FpSCs4nMiFY2CehCv4TW0/GgyiJI90UUXO VEW0AVkDvdxdvqXQxb2pId6AQeezi2dDKkxyHNyKinn3ZEACFk1dzi3SptebS8QZ6Bq9 rwlvGwsgztthe04lISUCcDs+bI4fyGFRamrICe2f6+mrpp+cnzgt5eqTV+D74LXn01dY sqIgRFH3nMqRrGv7H1DZybDvy4BlHIG1/Wswi1d8If0NCAK6FC3iXGhmA6s2aAxTrR7I OQLH3ZmshexttTYZWtp7U8K9MADcF7k/FgT4IZ+fu9l/U3tMcarh9bQB8lm6JFvSZ357 eIqg== X-Gm-Message-State: AElRT7FGdzIHCNi/lJmfBsmOJXVVXug30QWzbjJycqT+rCCJNfQnjzuX yuRe71LRO691aCypv9OTJ3PdOw== X-Google-Smtp-Source: AG47ELuBpN6DcaVzhr4vP1UfB73D7qRJ/J+8v5YR16y6lIl/iEe8jGmzY+Br3IEtzyoruxyBcnmleg== X-Received: by 10.25.15.98 with SMTP id e95mr15317849lfi.36.1520458247785; Wed, 07 Mar 2018 13:30:47 -0800 (PST) Received: from localhost.localdomain (92-100-247-246.dynamic.avangarddsl.ru. [92.100.247.246]) by smtp.gmail.com with ESMTPSA id w23sm3924653lfd.10.2018.03.07.13.30.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 13:30:46 -0800 (PST) From: Oleg Pykhalov To: guix-patches@gnu.org Subject: [PATCH 1/2] services: dovecot: Copy dovecot.conf to /etc/dovecot. Date: Thu, 8 Mar 2018 00:30:29 +0300 Message-Id: <20180307213030.30466-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Oleg Pykhalov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Many Dovecot utilities compiled with assumption of ‘/etc/dovecot/dovecot.conf’ existence. * gnu/services/mail.scm (dovecot-shepherd-service): Move config generation. Invoke ‘dovecot’ without ‘-c’ flag. (%dovecot-activation): Copy ‘dovecot.conf’ to ‘/etc/dovecot’. (dovecot-service-type): Make ‘%dovecot-activation’ non-constant. --- gnu/services/mail.scm | 147 +++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index ab9094273..573efa043 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1435,90 +1435,91 @@ greyed out, instead of only later giving \"not selectable\" popup error. (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) -(define %dovecot-activation +(define (%dovecot-activation config) ;; Activation gexp. - #~(begin - (use-modules (guix build utils)) - (define (mkdir-p/perms directory owner perms) - (mkdir-p directory) - (chown "/var/run/dovecot" (passwd:uid owner) (passwd:gid owner)) - (chmod directory perms)) - (define (build-subject parameters) - (string-concatenate - (map (lambda (pair) - (let ((k (car pair)) (v (cdr pair))) - (define (escape-char str chr) - (string-join (string-split str chr) (string #\\ chr))) - (string-append "/" k "=" - (escape-char (escape-char v #\=) #\/)))) - (filter (lambda (pair) (cdr pair)) parameters)))) - (define* (create-self-signed-certificate-if-absent - #:key private-key public-key (owner (getpwnam "root")) - (common-name (gethostname)) - (organization-name "GuixSD") - (organization-unit-name "Default Self-Signed Certificate") - (subject-parameters `(("CN" . ,common-name) - ("O" . ,organization-name) - ("OU" . ,organization-unit-name))) - (subject (build-subject subject-parameters))) - ;; Note that by default, OpenSSL outputs keys in PEM format. This - ;; is what we want. - (unless (file-exists? private-key) - (cond - ((zero? (system* (string-append #$openssl "/bin/openssl") - "genrsa" "-out" private-key "2048")) - (chown private-key (passwd:uid owner) (passwd:gid owner)) - (chmod private-key #o400)) - (else - (format (current-error-port) - "Failed to create private key at ~a.\n" private-key)))) - (unless (file-exists? public-key) - (cond - ((zero? (system* (string-append #$openssl "/bin/openssl") - "req" "-new" "-x509" "-key" private-key - "-out" public-key "-days" "3650" - "-batch" "-subj" subject)) - (chown public-key (passwd:uid owner) (passwd:gid owner)) - (chmod public-key #o444)) - (else - (format (current-error-port) - "Failed to create public key at ~a.\n" public-key))))) - (let ((user (getpwnam "dovecot"))) - (mkdir-p/perms "/var/run/dovecot" user #o755) - (mkdir-p/perms "/var/lib/dovecot" user #o755) - (mkdir-p/perms "/etc/dovecot" user #o755) - (mkdir-p/perms "/etc/dovecot/private" user #o700) - (create-self-signed-certificate-if-absent - #:private-key "/etc/dovecot/private/default.pem" - #:public-key "/etc/dovecot/default.pem" - #:owner (getpwnam "root") - #:common-name (format #f "Dovecot service on ~a" (gethostname)))))) + (let ((config-str + (cond + ((opaque-dovecot-configuration? config) + (opaque-dovecot-configuration-string config)) + (else + (with-output-to-string + (lambda () + (serialize-configuration config + dovecot-configuration-fields))))))) + #~(begin + (use-modules (guix build utils)) + (define (mkdir-p/perms directory owner perms) + (mkdir-p directory) + (chown "/var/run/dovecot" (passwd:uid owner) (passwd:gid owner)) + (chmod directory perms)) + (define (build-subject parameters) + (string-concatenate + (map (lambda (pair) + (let ((k (car pair)) (v (cdr pair))) + (define (escape-char str chr) + (string-join (string-split str chr) (string #\\ chr))) + (string-append "/" k "=" + (escape-char (escape-char v #\=) #\/)))) + (filter (lambda (pair) (cdr pair)) parameters)))) + (define* (create-self-signed-certificate-if-absent + #:key private-key public-key (owner (getpwnam "root")) + (common-name (gethostname)) + (organization-name "GuixSD") + (organization-unit-name "Default Self-Signed Certificate") + (subject-parameters `(("CN" . ,common-name) + ("O" . ,organization-name) + ("OU" . ,organization-unit-name))) + (subject (build-subject subject-parameters))) + ;; Note that by default, OpenSSL outputs keys in PEM format. This + ;; is what we want. + (unless (file-exists? private-key) + (cond + ((zero? (system* (string-append #$openssl "/bin/openssl") + "genrsa" "-out" private-key "2048")) + (chown private-key (passwd:uid owner) (passwd:gid owner)) + (chmod private-key #o400)) + (else + (format (current-error-port) + "Failed to create private key at ~a.\n" private-key)))) + (unless (file-exists? public-key) + (cond + ((zero? (system* (string-append #$openssl "/bin/openssl") + "req" "-new" "-x509" "-key" private-key + "-out" public-key "-days" "3650" + "-batch" "-subj" subject)) + (chown public-key (passwd:uid owner) (passwd:gid owner)) + (chmod public-key #o444)) + (else + (format (current-error-port) + "Failed to create public key at ~a.\n" public-key))))) + (let ((user (getpwnam "dovecot"))) + (mkdir-p/perms "/var/run/dovecot" user #o755) + (mkdir-p/perms "/var/lib/dovecot" user #o755) + (mkdir-p/perms "/etc/dovecot" user #o755) + (copy-file #$(plain-file "dovecot.conf" config-str) + "/etc/dovecot/dovecot.conf") + (mkdir-p/perms "/etc/dovecot/private" user #o700) + (create-self-signed-certificate-if-absent + #:private-key "/etc/dovecot/private/default.pem" + #:public-key "/etc/dovecot/default.pem" + #:owner (getpwnam "root") + #:common-name (format #f "Dovecot service on ~a" (gethostname))))))) (define (dovecot-shepherd-service config) "Return a list of for CONFIG." - (let* ((config-str - (cond - ((opaque-dovecot-configuration? config) - (opaque-dovecot-configuration-string config)) - (else - (with-output-to-string - (lambda () - (serialize-configuration config - dovecot-configuration-fields)))))) - (config-file (plain-file "dovecot.conf" config-str)) - (dovecot (if (opaque-dovecot-configuration? config) - (opaque-dovecot-configuration-dovecot config) - (dovecot-configuration-dovecot config)))) + (let ((dovecot (if (opaque-dovecot-configuration? config) + (opaque-dovecot-configuration-dovecot config) + (dovecot-configuration-dovecot config)))) (list (shepherd-service (documentation "Run the Dovecot POP3/IMAP mail server.") (provision '(dovecot)) (requirement '(networking)) (start #~(make-forkexec-constructor (list (string-append #$dovecot "/sbin/dovecot") - "-F" "-c" #$config-file))) + "-F"))) (stop #~(make-forkexec-constructor (list (string-append #$dovecot "/sbin/dovecot") - "-c" #$config-file "stop"))))))) + "stop"))))))) (define %dovecot-pam-services (list (unix-pam-service "dovecot"))) @@ -1533,7 +1534,7 @@ greyed out, instead of only later giving \"not selectable\" popup error. (service-extension pam-root-service-type (const %dovecot-pam-services)) (service-extension activation-service-type - (const %dovecot-activation)))))) + %dovecot-activation))))) (define* (dovecot-service #:key (config (dovecot-configuration))) "Return a service that runs @command{dovecot}, a mail server that can run -- 2.16.2 ------------=_1520605924-30438-1--