From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8EdZNxgliWOujAAAbAwnHQ (envelope-from ) for ; Thu, 01 Dec 2022 23:05:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eE52NhgliWPZOQAAG6o9tA (envelope-from ) for ; Thu, 01 Dec 2022 23:05:12 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A68DF38A45 for ; Thu, 1 Dec 2022 23:05:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0rg1-0004dd-9k; Thu, 01 Dec 2022 17:05:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0rfz-0004dV-Bl for bug-guix@gnu.org; Thu, 01 Dec 2022 17:05:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0rfz-0002Ot-22 for bug-guix@gnu.org; Thu, 01 Dec 2022 17:05:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0rfy-0002Lc-K8 for bug-guix@gnu.org; Thu, 01 Dec 2022 17:05:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#59423: Invalid 'location' field generated in dovecot configuration Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 01 Dec 2022 22:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59423 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 59423@debbugs.gnu.org Cc: mirai X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16699322669011 (code B ref -1); Thu, 01 Dec 2022 22:05:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Dec 2022 22:04:26 +0000 Received: from localhost ([127.0.0.1]:42227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0rf9-0002LG-KY for submit@debbugs.gnu.org; Thu, 01 Dec 2022 17:04:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:42326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0rf2-0002L8-Jh for submit@debbugs.gnu.org; Thu, 01 Dec 2022 17:04:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0rf1-0004FF-Ci for bug-guix@gnu.org; Thu, 01 Dec 2022 17:04:04 -0500 Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0rez-0002Bv-8D for bug-guix@gnu.org; Thu, 01 Dec 2022 17:04:03 -0500 Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N7R1J-1ovHeR3jMD-017kSw; Thu, 01 Dec 2022 23:03:39 +0100 References: <87y1s5wa4p.fsf@gmx.com> User-agent: mu4e 1.8.11; emacs 28.2 From: Pierre Langlois Date: Thu, 01 Dec 2022 21:55:27 +0000 In-reply-to: <87y1s5wa4p.fsf@gmx.com> Message-ID: <87359ydbnq.fsf@gmx.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:U20m6NpfuUgLXQOr0LbtZ8Kj4/0jgt6sc0FJVgTobIhvMjenYjz P84DDbD/Pzs7SX/Sdq5gqt6wrvlMolOtJXxBmztxRn0JEBP5Xs4tylanLKwP8IXRusI4zDP K5osYkLCOV0MM2OBuv0K8PO0wbKCjJ0oD+4ewJNm45KwRBwETPyYTRYz4IyPDySfhctCGjj WMFCOyUNXnUGbqYQ0Us4w== UI-OutboundReport: notjunk:1;M01:P0:/29Eda6/8Vs=;DpIBh18e27D5W+ox4eZ1OYhwTut symV1so9ShGxMTJwbL01/SBjBoO6a/Nc4bbNp4GW2JyXsFCQmyfd9DtJ4SQMRq8Fin2y+xK0J 65PiorbKBJ2cJWCZvwJ4X3QooK7XBslR+UzTIfENVp3Kd/nCfuEJfcImhM2aXNkNAObfgGDO1 nvKrKpUGLIl1G+qRc/PKViEwWRjvf6/MY5BwcH7ojjlRuKjA8jorDaPjXnrtOISXiWnC2bgIK ZkTugieJw8vk0QFez/Twy6eBdH3E4X4eHx7M5Oxkzp9iFUB/x1CubN0pOhbwmXFRFfEFMvS3t pkMpLj/+QsXfVGFq7kVcehp+ixZlZfShsA6kIK5xu2dmSLdn9p4hVWzAZWBVRepw1HJjYjRtX 8Stb5TjxCvQi0up5WhWvzmnlCG/EuMK3lQXF96eKnzCME8BzFiJQJzJEfYoUYxiFmLgZCImYt yWq1PjV4ObMfm9HxEDWzB/vTbyAMP5LmaxDvErpeJU+u5ouM2mR4WtSFG5p81oHqoCoEw/U9e sgKoMsI5yEuNtHB7H5oCfckTXhyNeIP1ktMUCRJZm0xn7HKxOhxuOXL5NZ4wX/LIktT8hbkBj 5Ae+z2kSC58e997bDHEI/Z35JVHk5AYKIaPvvBkXSqybDn11Z7tbx3UkrxsakdluDQF9xJVmy A6n/vs4TY2YnRgxDfIyGreQ8glovKcxfjDhhSWCNcY0GSOCnjtOJ0zCe2zCAY+3pL2v6W4JTA fAn86sVIRc238YG/GYUV50t1GrWAV2+yA33CGjDlZTtNFdQ+akgj2jLJJ/F/e9qCcwG3yhTZz CHNHOvC4OQ6SyVMHRFSvx5xXIQ61nf8wQz24JQe90xGDU+aRkfEpe6dMpBenpdirPMGDUQHSg a4eV1/zWYOZV+c5kna/5J05LNODuhKflHlhQLJRPmb41iq6aw8stqq5uGp0TbQNqZePKeIu/u enzCFpQIfuZ2p4Z+PU8NNp4utOY= Received-SPF: pass client-ip=212.227.17.22; envelope-from=pierre.langlois@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-TUID: Xxyu57gViC9D --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Hi all! As suggested by mirai off-list, it would be nice to have a test that would have caught the issue. How do people feel about something along the following patch? The idea is to use namespaces in the dovecot config to declare the INBOX and another additional mailbox. The bug is quite obscure and not really about dovecot itself, so I don't think adding such a test is strictly necessary, maybe more tests for the configuration macro would be good instead. But I figured expanding the dovecot system test can't hurt. Let me know if you agree and I'll format it properly. --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmOJJLkYHHBpZXJyZS5s YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UtskH/RIxgitO9VsL35yspk8stnRm tQVFcOTEL7bdJrF0YKakC6YXar+K87tlTAeTkWOIv1KLwRP6sxKXiWvFEHWMFv5q mXE7xZMw/6EDkBVdmdFNzone0e6Gx4W3fKLlzojMwhwK7ZMjsF9K+v7BNq1zLHVI UW3ps9XsaLiUdvZ2YiVxcIV4WKhTg1hLmR5UbRy4TDM3GKQAdtV0ZxLUwS+f+PKw SzZoJO4OQ/1cLFzrR0EsfsqufloGU5K4WOXU/U8HVsBylgugbSz/LcajgRYeSjUN E3CQNpt9upx2WsR6nzJyDHAg3RQJ214k8BfxX6AUOcZ9vhgs+hiZh3MiNISnNEI= =651r -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=test.diff diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index f13751b72f..8a2dbd798f 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -301,8 +301,19 @@ (define %dovecot-os (auth-anonymous-username "alice") (mail-location (string-append "maildir:~/Maildir" - ":INBOX=~/Maildir/INBOX" - ":LAYOUT=fs")))))) + ":LAYOUT=fs")) + (namespaces + (list + (namespace-configuration + (name "INBOX") + (inbox? #t) + (separator "/") + (location "maildir:~/Maildir/INBOX")) + (namespace-configuration + (name "guix-devel") + (separator "/") + (prefix "guix-devel/") + (location "maildir:~/Maildir/guix-devel")))))))) (define (run-dovecot-test) "Return a test of an OS running Dovecot service." @@ -351,9 +362,10 @@ (define message "From: test@example.com\n\ (marionette-eval `(file-exists? (string-append "/proc/" ,pid)) marionette))) - (test-assert "accept an email" + (define-syntax-rule (with-imap-connection imap exp ...) (let ((imap (socket AF_INET SOCK_STREAM 0)) - (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143))) + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8143)) + (body (lambda (imap) exp ...))) (connect imap addr) ;; Be greeted. (read-line imap) ;OK @@ -362,6 +374,43 @@ (define message "From: test@example.com\n\ (read-line imap) ;+ (write-line "c2lyaGM=" imap) (read-line imap) ;OK + + (let ((ok (body imap))) + ;; Logout + (write-line "a LOGOUT" imap) + (close imap) + ok))) + + (define (marionette-read-new-mail mailbox marionette) + (marionette-eval + `(begin + (use-modules (ice-9 ftw) + (ice-9 match)) + (match (scandir ,mailbox) + (("." ".." message-file) + (call-with-input-file + (string-append ,mailbox message-file) + get-string-all)))) + marionette)) + + (test-assert "accept an email" + (with-imap-connection imap + ;; Append a message to the INBOX mailbox + (write-line (format #f "a APPEND INBOX {~a}" + (number->string (message-length message))) + imap) + (read-line imap) ;+ + (write-line message imap) + (read-line imap) ;OK + #t)) + + (test-equal "mail arrived" + message + (marionette-read-new-mail "/home/alice/Maildir/INBOX/new/" + marionette)) + + (test-assert "accept an email in fresh mailbox" + (with-imap-connection imap ;; Create a TESTBOX mailbox (write-line "a CREATE TESTBOX" imap) (read-line imap) ;OK @@ -372,24 +421,16 @@ (define message "From: test@example.com\n\ (read-line imap) ;+ (write-line message imap) (read-line imap) ;OK - ;; Logout - (write-line "a LOGOUT" imap) - (close imap) #t)) - (test-equal "mail arrived" + (test-equal "mail arrived in fresh mailbox" message - (marionette-eval - '(begin - (use-modules (ice-9 ftw) - (ice-9 match)) - (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/")) - (match (scandir TESTBOX/new) - (("." ".." message-file) - (call-with-input-file - (string-append TESTBOX/new message-file) - get-string-all))))) - marionette)) + (marionette-read-new-mail "/home/alice/Maildir/TESTBOX/new/" + marionette)) + + (test-assert "mailbox exists" + (marionette-eval `(file-exists? "/home/alice/Maildir/guix-devel") + marionette)) (test-end)))) --=-=-= Content-Type: text/plain Thanks, Pierre --=-=-=--