From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 2/2] dmd: Make config file if necessary when not run as root. Date: Wed, 05 Feb 2014 21:17:56 +0100 Message-ID: <87ha8d5n63.fsf@gnu.org> References: <1391449065-19063-1-git-send-email-alex.sassmannshausen@gmail.com> <1391449065-19063-3-git-send-email-alex.sassmannshausen@gmail.com> <87txcebogj.fsf@gnu.org> <87ob2l4dqi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8zz-0003Ov-0V for guix-devel@gnu.org; Wed, 05 Feb 2014 15:23:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WB8zr-00007j-N0 for guix-devel@gnu.org; Wed, 05 Feb 2014 15:23:06 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:58280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8zr-00007c-Gp for guix-devel@gnu.org; Wed, 05 Feb 2014 15:22:59 -0500 In-Reply-To: <87ob2l4dqi.fsf@gmail.com> (Alex Sassmannshausen's message of "Wed, 05 Feb 2014 19:27:01 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Sassmannshausen Cc: guix-devel@gnu.org Alex Sassmannshausen skribis: > Ludovic Court=C3=A8s writes: [...] >>> + (register-services) >> ^ >>> +;; Send dmd into the background >>> + (action 'dmd 'daemonize) >> ^ >>> + (for-each start '()) >> ^ >> >> Extra space here. > > The extra spaces were there to stop emacs (maybe Scheme mode?) from > going nutty because of the open parens within a string at column 0. Oh, right, I forgot that. [...] >>> (let ((config-file (string-append user-dmddir "/init.scm"))) >>> (cond ((not (file-exists? user-dmddir)) >>> (mkdir user-dmddir) >>> + (make-bare-init-file config-file) >>> config-file) >>> + ((not (file-exists? config-file)) >>> + (make-bare-init-file config-file)) >>> (else config-file)))))) >> >> So I guess this should be changed to: >> >> (catch 'system-error >> (lambda () >> (mkdir user-dmddir) >> (make-bare-init-file config-file)) >> (const #f)) > > I've changed this to : > > (catch-system-error (mkdir user-dmddir)) > (if (not (file-exists? config-file)) > (make-bare-init-file config-file)) > config-file))) [...] > I also think the race condition should not be a problem for the config > file: if the config file is added after the check, then we simply > override it. If the config file is removed after the check then guix > crashes when it tries to load it, as it always would do before this > patch. Right. Hopefully it=E2=80=99s not a problem with the test suite because te= sts use =E2=80=98-c=E2=80=99 anyway. > Hope this works now. You should find the patch inline. Yep. Pushed, thanks! Ludo=E2=80=99.