From patchwork Sat Jul 17 17:47:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon South X-Patchwork-Id: 31472 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6577D27BC78; Sat, 17 Jul 2021 18:49:33 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 28B4727BC6B for ; Sat, 17 Jul 2021 18:49:33 +0100 (BST) Received: from localhost ([::1]:39862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4oRQ-0003vt-8U for patchwork@mira.cbaines.net; Sat, 17 Jul 2021 13:49:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4oPy-0001eF-Bb for guix-patches@gnu.org; Sat, 17 Jul 2021 13:48:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4oPx-00063J-Vg for guix-patches@gnu.org; Sat, 17 Jul 2021 13:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m4oPx-0001CE-M1 for guix-patches@gnu.org; Sat, 17 Jul 2021 13:48:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49601] [PATCH] services: transmission: Create downloads directory. Resent-From: Simon South Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Jul 2021 17:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49601 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Morgan.J.Smith@outlook.com Cc: 49601@debbugs.gnu.org Received: via spool by 49601-submit@debbugs.gnu.org id=B49601.16265440674577 (code B ref 49601); Sat, 17 Jul 2021 17:48:01 +0000 Received: (at 49601) by debbugs.gnu.org; 17 Jul 2021 17:47:47 +0000 Received: from localhost ([127.0.0.1]:54611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4oPj-0001Bl-EV for submit@debbugs.gnu.org; Sat, 17 Jul 2021 13:47:47 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:43236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4oPh-0001BW-Bv for 49601@debbugs.gnu.org; Sat, 17 Jul 2021 13:47:46 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 35D92A41DF; Sat, 17 Jul 2021 17:47:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo05-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo05-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dPL-wB33ER91; Sat, 17 Jul 2021 17:47:38 +0000 (UTC) Received: from laptop (unknown [108.162.141.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id B88E89FF68; Sat, 17 Jul 2021 17:47:36 +0000 (UTC) From: Simon South References: <87y2a5gnt6.fsf@simonsouth.net> Date: Sat, 17 Jul 2021 13:47:07 -0400 In-Reply-To: <87y2a5gnt6.fsf@simonsouth.net> (Simon South's message of "Sat, 17 Jul 2021 07:52:21 -0400") Message-ID: <87v958g7dw.fsf@simonsouth.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Simon South writes: > Let me see if I can duplicate that... I haven't been able to duplicate whatever issue it was I saw originally. Likely it had to do with the download directory being placed on a separate volume and thus matching a mount point already declared in the operating-system declaration. Probably the system test should be expanded to check this kind of configuration works but a quick test on my end shows that at least for existing setups, it is not a problem. Morgan, just a few pieces of feedback then: > This fixes a bug where transmission doesn't have permission to create > it's download directory. This bug occurs when download-dir is "it's" should be "its" (no apostrophe) here, the possessive form. > + (,download-dir #o755)) Again, the permissions here should be "#o750". Finally, I recommend updating the system test (in gnu/tests/file-sharing.scm) to verify the download directory is created correctly, now that this functionality has been added. I've included a patch below that does this for you. To verify this works, apply the patch and run the test suite with make check-system TESTS="transmission-daemon" The Guix manual has more information[0]. Otherwise, looks good to me. Thanks for submitting this patch. [0] https://guix.gnu.org/en/manual/en/html_node/Running-the-Test-Suite.html diff --git a/gnu/tests/file-sharing.scm b/gnu/tests/file-sharing.scm index 9a8ee6a593..d27a206c4f 100644 --- a/gnu/tests/file-sharing.scm +++ b/gnu/tests/file-sharing.scm @@ -34,6 +34,8 @@ (define %transmission-daemon-group "transmission") (define %transmission-daemon-config-dir "/var/lib/transmission-daemon") +(define %transmission-daemon-download-dir + (string-append %transmission-daemon-config-dir "/downloads")) (define %transmission-daemon-watch-dir (string-append %transmission-daemon-config-dir "/watch")) (define %transmission-daemon-incomplete-dir @@ -110,8 +112,9 @@ #t) marionette)) - ;; Make sure Transmission Daemon's configuration directory has been - ;; created with the correct ownership and permissions. + ;; Make sure Transmission Daemon's configuration and download + ;; directories have been created with the correct ownership and + ;; permissions. (test-assert "configuration directory exists" (marionette-eval '(eq? (stat:type (stat #$%transmission-daemon-config-dir)) @@ -132,6 +135,26 @@ #o750) marionette)) + (test-assert "download directory exists" + (marionette-eval + '(eq? (stat:type (stat #$%transmission-daemon-download-dir)) + 'directory) + marionette)) + (test-assert "download directory has correct ownership" + (marionette-eval + '(let ((download-dir (stat #$%transmission-daemon-download-dir)) + (transmission-user (getpwnam #$%transmission-daemon-user))) + (and (eqv? (stat:uid download-dir) + (passwd:uid transmission-user)) + (eqv? (stat:gid download-dir) + (passwd:gid transmission-user)))) + marionette)) + (test-assert "download directory has expected permissions" + (marionette-eval + '(eqv? (stat:perms (stat #$%transmission-daemon-download-dir)) + #o750) + marionette)) + ;; Make sure the incomplete-downloads and watch directories have been ;; created with the correct ownership and permissions. (test-assert "incomplete-downloads directory exists"