diff mbox series

[bug#49601] services: transmission: Create downloads directory.

Message ID BYAPR05MB40231D4388D70966EC26C79CC5109@BYAPR05MB4023.namprd05.prod.outlook.com
State New
Headers show
Series [bug#49601] services: transmission: Create downloads directory. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Morgan Smith July 17, 2021, 12:28 a.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/services/file-sharing.scm (transmission-daemon-activation): Create
downloads directory.

This fixes a bug where transmission doesn't have permission to create it's
download directory. This bug occurs when download-dir is configured to a
location where the transmission user doesn't have permission to create a directory.
---
 gnu/services/file-sharing.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon South July 17, 2021, 11:52 a.m. UTC | #1
Morgan.J.Smith@outlook.com writes:
> This fixes a bug where transmission doesn't have permission to create
> it's download directory. This bug occurs when download-dir is
> configured to a location where the transmission user doesn't have
> permission to create a directory.

Morgan,

I recall originally having the service activation create the downloads
directory, as your change makes it do, but then removing this as there
was some common case where it made service activation fail.
Unfortunately, I've forgotten what that was.

Let me see if I can duplicate that and if so, perhaps we can find a
solution that will handle both cases. At any rate:

> +                              (,download-dir #o755))

The folder permissions should be #o750, not #o755. The reasoning here is
that it ought to be possible to place limits on who can see and access
files being shared by other users.
Efraim Flashner July 19, 2021, 12:13 p.m. UTC | #2
On Sat, Jul 17, 2021 at 07:52:21AM -0400, Simon South wrote:
> Morgan.J.Smith@outlook.com writes:
> > This fixes a bug where transmission doesn't have permission to create
> > it's download directory. This bug occurs when download-dir is
> > configured to a location where the transmission user doesn't have
> > permission to create a directory.
> 
> Morgan,
> 
> I recall originally having the service activation create the downloads
> directory, as your change makes it do, but then removing this as there
> was some common case where it made service activation fail.
> Unfortunately, I've forgotten what that was.
> 
> Let me see if I can duplicate that and if so, perhaps we can find a
> solution that will handle both cases. At any rate:
> 
> > +                              (,download-dir #o755))
> 
> The folder permissions should be #o750, not #o755. The reasoning here is
> that it ought to be possible to place limits on who can see and access
> files being shared by other users.
> 

It's possible it was mkdir vs mkdir-p

(ins)scheme@(guile-user)> (mkdir "tmp")
(ins)scheme@(guile-user)> (mkdir "tmp")
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure mkdir: File exists

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
(ins)scheme@(guile-user) [1]> ,q
(ins)scheme@(guile-user)> (use-modules (guix build utils))
(ins)scheme@(guile-user)> (mkdir-p "tmp")
$1 = #t
Simon South July 21, 2021, 1:14 p.m. UTC | #3
Efraim Flashner <efraim@flashner.co.il> writes:
> It's possible it was mkdir vs mkdir-p

Yes, or perhaps I hadn't yet added the code that sets the ownership and
permissions on the directory.

Morgan, I hope you'll submit a revised patch so others can review.
diff mbox series

Patch

diff --git a/gnu/services/file-sharing.scm b/gnu/services/file-sharing.scm
index 72cd6478d6..143fd3ed75 100644
--- a/gnu/services/file-sharing.scm
+++ b/gnu/services/file-sharing.scm
@@ -746,6 +746,7 @@  produces a Transmission settings file (@file{settings.json}) matching CONFIG."
 (define (transmission-daemon-activation config)
   "Return the Transmission Daemon activation GEXP for CONFIG."
   (let ((config-dir %transmission-daemon-configuration-directory)
+        (download-dir (transmission-daemon-configuration-download-dir config))
         (incomplete-dir-enabled
          (transmission-daemon-configuration-incomplete-dir-enabled? config))
         (incomplete-dir
@@ -769,7 +770,8 @@  produces a Transmission settings file (@file{settings.json}) matching CONFIG."
             (for-each (lambda (directory-specification)
                         (apply mkdir-p/perms directory-specification))
                       '(#$@(append
-                            `((,config-dir #o750))
+                            `((,config-dir #o750)
+                              (,download-dir #o755))
                             (if incomplete-dir-enabled
                                 `((,incomplete-dir #o750))
                                 '())