Danny Milosavljevic <[email protected]> skribis:

> Hi Ludo,
>
> On Fri, 15 Dec 2017 10:41:37 +0100
> [email protected] (Ludovic Courtès) wrote:
>
>> This looks good, but would it be enough to do:
>> 
>>   (mkdir-p (dirname (string-append "/dev/" name)))
>
> mkdir permission needs to be specified to be #o755.
>
> I've seen some variants in guix - but they are all buried somewhere deep:
>
> ./gnu/services/cups.scm:        (define (mkdir-p/perms directory owner perms)
> ./gnu/services/dns.scm:      (define (mkdir-p/perms directory owner perms)
> ./gnu/services/mail.scm:      (define (mkdir-p/perms directory owner perms)
> ./guix/build/utils.scm:(define (mkdir-p dir)
> ./guix/build/graft.scm:(define* (mkdir-p* dir #:optional (mode #o755))

Oh, I didn’t think we had this many variants.

> I don't feel good relying on magical unspecified permissions in code required 
> to boot the system.  I think mkdir-p itself subtracts the umask or something. 
>  Is the umask guaranteed to be 0 at the point of usage of 
> make-static-device-nodes ?

I’m not 100% sure.  You could set ‘umask’ explicitly given that it’s
single-threaded and all at this point, but it’s probably clearer to
explicitly specify the mode like you did initially.

So I guess you can forget my comment and apply the original variant (or
perhaps explicitly copy ‘mkdir-p/perms’ so we can find it more easily
when we factorize!).

Thanks for explaining!

Ludo’.



Reply via email to