guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] dmd: Use ~/.dmd.d/ by default when not run as root.


From: Ludovic Courtès
Subject: Re: [PATCH 1/2] dmd: Use ~/.dmd.d/ by default when not run as root.
Date: Tue, 04 Feb 2014 21:34:19 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Alex Sassmannshausen <address@hidden> skribis:

> * modules/dmd/support.scm: Add copyright.
>   (user-dmddir): New variable.
>   (default-logfile): Use it instead of user-homedir.
>   (default-persistency-state-file): Use it instead of user-homedir.
>   (default-configfile): Use it instead of user-homedir, use init.scm
>   as default name for configfile, ensure .dmd.d exists.
>   (default-socket-dir): Add check for root, if #f, use user-dmddir as
>   base for socket.

Applied, thanks!

>  ;; Configuration file.
>  (define default-config-file
>    (if (zero? (getuid))
>        (string-append Prefix-dir "/etc/dmdconf.scm")
> -    (string-append user-homedir "/.dmdconf.scm")))
> +      (begin
> +        (let ((config-file (string-append user-dmddir "/init.scm")))
> +          (cond ((not (file-exists? user-dmddir))
> +                 (mkdir user-dmddir)
> +                 config-file)
> +                (else config-file))))))

The file-exists?/mkdir pattern above introduces a TOCTTOU problem: when
running ‘make check -j’ the first time, one of the tests failed because
‘mkdir’ failed with EEXIST.

So I changed it to (catch-system-error (mkdir user-dmddir)).

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]