From unknown Mon Aug 18 11:10:27 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#66387 <66387@debbugs.gnu.org> To: bug#66387 <66387@debbugs.gnu.org> Subject: Status: [PATCH] home: services: Fix race condition when detecting first login Reply-To: bug#66387 <66387@debbugs.gnu.org> Date: Mon, 18 Aug 2025 18:10:27 +0000 retitle 66387 [PATCH] home: services: Fix race condition when detecting fir= st login reassign 66387 guix-patches submitter 66387 Carlo Zancanaro severity 66387 normal tag 66387 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 07 08:07:15 2023 Received: (at submit) by debbugs.gnu.org; 7 Oct 2023 12:07:15 +0000 Received: from localhost ([127.0.0.1]:53516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qp65S-00068o-O1 for submit@debbugs.gnu.org; Sat, 07 Oct 2023 08:07:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:36482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qp65Q-00068Y-GL for submit@debbugs.gnu.org; Sat, 07 Oct 2023 08:07:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qp650-0002nX-BV for guix-patches@gnu.org; Sat, 07 Oct 2023 08:06:46 -0400 Received: from voltorb.zancanaro.id.au ([45.77.50.64]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qp64u-0004Vq-7V for guix-patches@gnu.org; Sat, 07 Oct 2023 08:06:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=FUXcxK4ThRsG/md zQsqSMvKac9bKZ/ZdHWTBgcjDdi8=; h=date:subject:to:from; d=zancanaro.id.au; b=RfeQ4tC6VjEL+D8OIJG58Xx54mIO0nqPREz16O1cAUCKSJ/Ju EFFEunjBRvLIM9IZbWyjVi6SjbPWTxO4tARjEINGx635aI5qLmVkoGHJxi1SZ2yZk//ais uFYi88HrkmoeukbpjdD75rN/SY8ueDfSJI5cLmzfhD5wN9CoPSPk= Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id 3ca1b165 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sat, 7 Oct 2023 12:06:13 +0000 (UTC) From: Carlo Zancanaro To: guix-patches@gnu.org Subject: [PATCH] home: services: Fix race condition when detecting first login Date: Sat, 7 Oct 2023 22:59:05 +1100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=45.77.50.64; envelope-from=carlo@zancanaro.id.au; helo=voltorb.zancanaro.id.au X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/home/services.scm (compute-on-first-login-script): Use open to atomically check whether a file exists and create it if not. --- I run Guix Home on NixOS with SDDM as my display manager. When I log in, I find that there are two shepherd processes running. Looking at the on-first-login script I noticed a race condition that I suspect was causing the issue. I believe the "open" incantation I have used is atomic, except on NFS, so this should ensure that the gexps are only run once. I have confirmed that this patch fixes my problem. With this patch, when I login I only have a single shepherd process. gnu/home/services.scm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 8d53f2f4d3..95ef66e091 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Carlo Zancanaro ;;; ;;; This file is part of GNU Guix. ;;; @@ -412,20 +413,29 @@ (define (compute-on-first-login-script _ gexps) #~(begin (use-modules (guix i18n) (guix diagnostics)) + + (define (claim-first-run file-name) + (catch #t + (lambda () + ;; This incantation will raise an error if the file at + ;; flag-file-path already exists, and will create it otherwise. + (close (open file-name (logior O_CREAT O_EXCL))) + #t) + (lambda (e) + #f))) + #$%initialize-gettext (let* ((xdg-runtime-dir (or (getenv "XDG_RUNTIME_DIR") (format #f "/run/user/~a" (getuid)))) (flag-file-path (string-append - xdg-runtime-dir "/on-first-login-executed")) - (touch (lambda (file-name) - (call-with-output-file file-name (const #t))))) + xdg-runtime-dir "/on-first-login-executed"))) ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick ;; allows to launch on-first-login script on first login only ;; after complete logout/reboot. (if (file-exists? xdg-runtime-dir) - (unless (file-exists? flag-file-path) - (begin #$@gexps (touch flag-file-path))) + (when (claim-first-run flag-file-path) + #$@gexps) ;; TRANSLATORS: 'on-first-login' is the name of a service and ;; shouldn't be translated (warning (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login script base-commit: b566e1a98a74d84d3978cffefd05295602c9445d -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 09 09:10:43 2023 Received: (at 66387) by debbugs.gnu.org; 9 Oct 2023 13:10:44 +0000 Received: from localhost ([127.0.0.1]:59515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpq1z-0007kr-Kk for submit@debbugs.gnu.org; Mon, 09 Oct 2023 09:10:43 -0400 Received: from voltorb.zancanaro.id.au ([45.77.50.64]:40768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpq1v-0007kR-Vu for 66387@debbugs.gnu.org; Mon, 09 Oct 2023 09:10:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=+dcUXIAtvy6Mbfm 3iyskgBZCHKvM/gp109lBWYItk5M=; h=in-reply-to:date:subject:cc:from: references; d=zancanaro.id.au; b=PjMAzyOT0ry7bt9rrG2Nj9emjSQgn3g6DS38a EAgBVVgXkWvJZok1rM8r+IGpQfC8s2qb0zzMnbFFb6/owHE6WNkzXxGFG5/TdAPXctyh44 hQFqCiTR+UhdctknFuijui+RMPBvRgkZUtl3aGxD6tfrmMfqAiKr5FuM4ASEXxJ4= Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id 346e88bf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <66387@debbugs.gnu.org>; Mon, 9 Oct 2023 13:09:52 +0000 (UTC) References: User-agent: mu4e 1.10.7; emacs 29.1 From: Carlo Zancanaro Subject: Re: [bug#66387] [PATCH] home: services: Fix race condition when detecting first login Date: Tue, 10 Oct 2023 00:08:06 +1100 In-reply-to: Message-ID: <87bkd8djri.fsf@zancanaro.id.au> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sat, Oct 07 2023, Carlo Zancanaro wrote: > @@ -412, 20 +413, 29 @@ (define (compute-on-first-login-script _ > gexps) > #~(begin > (use-modules (guix i18n) > (guix diagnostics)) > + > + (define (claim [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 MISSING_HEADERS Missing To: header -0.0 SPF_PASS SPF: sender matches SPF record X-Debbugs-Envelope-To: 66387 Cc: 66387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) On Sat, Oct 07 2023, Carlo Zancanaro wrote: > @@ -412,20 +413,29 @@ (define (compute-on-first-login-script _ > gexps) > #~(begin > (use-modules (guix i18n) > (guix diagnostics)) > + > + (define (claim-first-run file-name) > + (catch #t > + (lambda () > + ;; This incantation will raise an error if the > file at > + ;; flag-file-path already exists, and will create > it otherwise. > + (close (open file-name (logior O_CREAT O_EXCL))) > + #t) > + (lambda (e) Whoops, just noticed this should be _, not (e). It still works, because it crashes the script which stops the gexps from running, but writes a message to the console. I'll send an updated patch tomorrow. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 11 07:58:37 2023 Received: (at 66387) by debbugs.gnu.org; 11 Oct 2023 11:58:37 +0000 Received: from localhost ([127.0.0.1]:37687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqXrI-0000BF-Q4 for submit@debbugs.gnu.org; Wed, 11 Oct 2023 07:58:37 -0400 Received: from voltorb.zancanaro.id.au ([45.77.50.64]:59542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqXrG-0000B3-5v for 66387@debbugs.gnu.org; Wed, 11 Oct 2023 07:58:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=xSfowpn6ptj3E0e O6DXSIuON0h7+cn6GdA62mhtGlzk=; h=references:in-reply-to:date:subject: to:from; d=zancanaro.id.au; b=Wg8QwHPBGWtrrSteFCwEHYTWgZbD2jGSRe5gxzw5 RaeFXD9gtfFJRfSMYa0cjpDbN3cW5qhdOfnP533JzshWK7UvnC+x0mhKFY5XLw6xBw+38g bgKVCxAKeoFCa1Es05xQ6TPpx+h84AyVIrrdMpiqjc20E8G9XSBHof+zvte8Q= Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id 1f5d753f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <66387@debbugs.gnu.org>; Wed, 11 Oct 2023 11:57:46 +0000 (UTC) From: Carlo Zancanaro To: 66387@debbugs.gnu.org Subject: [PATCH] home: services: Fix race condition when detecting first login Date: Wed, 11 Oct 2023 22:57:19 +1100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <87bkd8djri.fsf@zancanaro.id.au> References: <87bkd8djri.fsf@zancanaro.id.au> MIME-Version: 1.0 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66387 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (compute-on-first-login-script): Use open to atomically check whether a file exists and create it if not. --- gnu/home/services.scm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 8d53f2f4d3..7137925b30 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Carlo Zancanaro ;;; ;;; This file is part of GNU Guix. ;;; @@ -412,20 +413,29 @@ (define (compute-on-first-login-script _ gexps) #~(begin (use-modules (guix i18n) (guix diagnostics)) + + (define (claim-first-run file-name) + (catch #t + (lambda () + ;; This incantation will raise an error if the file at + ;; flag-file-path already exists, and will create it otherwise. + (close (open file-name (logior O_CREAT O_EXCL))) + #t) + (lambda _ + #f))) + #$%initialize-gettext (let* ((xdg-runtime-dir (or (getenv "XDG_RUNTIME_DIR") (format #f "/run/user/~a" (getuid)))) (flag-file-path (string-append - xdg-runtime-dir "/on-first-login-executed")) - (touch (lambda (file-name) - (call-with-output-file file-name (const #t))))) + xdg-runtime-dir "/on-first-login-executed"))) ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick ;; allows to launch on-first-login script on first login only ;; after complete logout/reboot. (if (file-exists? xdg-runtime-dir) - (unless (file-exists? flag-file-path) - (begin #$@gexps (touch flag-file-path))) + (when (claim-first-run flag-file-path) + #$@gexps) ;; TRANSLATORS: 'on-first-login' is the name of a service and ;; shouldn't be translated (warning (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login script base-commit: 9ad9113fc238ee8de5191a5e15b5153fd149e9fa -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 19 16:30:14 2023 Received: (at 66387-done) by debbugs.gnu.org; 19 Oct 2023 20:30:14 +0000 Received: from localhost ([127.0.0.1]:37924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZen-0000fo-Vi for submit@debbugs.gnu.org; Thu, 19 Oct 2023 16:30:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZel-0000eS-2v for 66387-done@debbugs.gnu.org; Thu, 19 Oct 2023 16:30:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtZeC-0004iR-V7; Thu, 19 Oct 2023 16:29:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=YuqmrsYRuZzp5Hu4lr6tEXVqT58o0HgxfKW4i77voLg=; b=Zh+f3B5mIHAynh35A9FD 8NPi4KgMe62Q9yJHOTl0NKpl/xVHqpxY0fy9C+FgwwVLRTRYEiIPOG/faRjRPboTkLoOXxlz97bKj 3A3ztyHswunyllo4shdYdvjsZQA5pTtY6VOLhECgTFRjU4G1hZziJUy2ZUtXLBKTGfgLVAUgYNhnH YW22sb7qMtLqVKb08QMZb607eSdMfQ59Cg7TyAiqdSR/P4i3C9oh0MYNTylqIZTGWVC2hmKk2yMmm w2i9dcUjXPfulGgzEyhjBuQ1CAIn80z69fL7u2s0FcA4mlIGkAqdvolJE+Gh9IrgqgUlvczjyLMPo IlGGfE+qhl3Vsw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Carlo Zancanaro Subject: Re: [bug#66387] [PATCH] home: services: Fix race condition when detecting first login In-Reply-To: (Carlo Zancanaro's message of "Wed, 11 Oct 2023 22:57:19 +1100") References: <87bkd8djri.fsf@zancanaro.id.au> Date: Thu, 19 Oct 2023 22:29:34 +0200 Message-ID: <87v8b2xsnl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 66387-done Cc: 66387-done@debbugs.gnu.org, Andrew Tropin , paren@disroot.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Carlo, Carlo Zancanaro skribis: > * gnu/home/services.scm (compute-on-first-login-script): Use open to > atomically check whether a file exists and create it if not. Good catch! I made the following cosmetic changes (=E2=80=98open-fdes=E2=80=99 is cheap= er than =E2=80=98open=E2=80=99) and applied it. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 7137925b30..651c068f79 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -414,15 +414,15 @@ (define (compute-on-first-login-script _ gexps) (use-modules (guix i18n) (guix diagnostics)) - (define (claim-first-run file-name) + (define (claim-first-run file) (catch #t (lambda () - ;; This incantation will raise an error if the file at - ;; flag-file-path already exists, and will create it otherwise. - (close (open file-name (logior O_CREAT O_EXCL))) + ;; This incantation raises an error if FILE already exists, and + ;; creates it otherwise. + (close-fdes + (open-fdes file (logior O_CREAT O_EXCL O_CLOEXEC))) #t) - (lambda _ - #f))) + (const #f))) #$%initialize-gettext --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 20 02:56:27 2023 Received: (at 66387-done) by debbugs.gnu.org; 20 Oct 2023 06:56:27 +0000 Received: from localhost ([127.0.0.1]:38511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtjQp-0003fS-1L for submit@debbugs.gnu.org; Fri, 20 Oct 2023 02:56:27 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:50051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtjQl-0003fC-Rz for 66387-done@debbugs.gnu.org; Fri, 20 Oct 2023 02:56:26 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3B1C160002; Fri, 20 Oct 2023 06:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1697784951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uWUwm4UuJ5TlVjgrB7v4ovnCqtclASiLJHCn9RgTWKY=; b=LiIJsvhFCHInni/+R5w0Zy9+d8CcGAhs5nUuX1M5BeourDt2LSkU8HTgZcj+hjNTtEE9cf 5LbAcvVE8/u1wzTqn8Yi9yard3BY9vVSaZPk/KhiIHTRiuCTJK0ixBXfj6SqK7naKU+Fnr /I+yw0YVDubSSQOH5hq/+zR61TNA+pW+U/dzw0P5BYJjkqLUyAmeAsUycObrEEsqN3tmNs hjTJiv3woxLhqaH1Sh3Z4EdCWVu5hmWbvQ9EMIfJ+t1E+II3A+gyi7RnDHt+w3Xd5Qjgcy eV8zGORBVHxDK/a24dSJfuMb3zog4kJigEMUSPRKPZhMVG/rcrJKqbMARRVL5w== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Carlo Zancanaro Subject: Re: [bug#66387] [PATCH] home: services: Fix race condition when detecting first login In-Reply-To: <87v8b2xsnl.fsf@gnu.org> References: <87bkd8djri.fsf@zancanaro.id.au> <87v8b2xsnl.fsf@gnu.org> Date: Fri, 20 Oct 2023 10:55:46 +0400 Message-ID: <87v8b1hjf1.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-GND-Sasl: andrew@trop.in X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66387-done Cc: 66387-done@debbugs.gnu.org, paren@disroot.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-10-19 22:29, Ludovic Court=C3=A8s wrote: > Hi Carlo, > > Carlo Zancanaro skribis: > >> * gnu/home/services.scm (compute-on-first-login-script): Use open to >> atomically check whether a file exists and create it if not. > > Good catch! > > I made the following cosmetic changes (=E2=80=98open-fdes=E2=80=99 is che= aper than > =E2=80=98open=E2=80=99) and applied it. > > Thanks! > > Ludo=E2=80=99. > > diff --git a/gnu/home/services.scm b/gnu/home/services.scm > index 7137925b30..651c068f79 100644 > --- a/gnu/home/services.scm > +++ b/gnu/home/services.scm > @@ -414,15 +414,15 @@ (define (compute-on-first-login-script _ gexps) > (use-modules (guix i18n) > (guix diagnostics)) >=20=20 > - (define (claim-first-run file-name) > + (define (claim-first-run file) Very nice trick! Carol, Ludo, Thank you for the fix! > (catch #t > (lambda () > - ;; This incantation will raise an error if the file at > - ;; flag-file-path already exists, and will create it otherw= ise. > - (close (open file-name (logior O_CREAT O_EXCL))) > + ;; This incantation raises an error if FILE already exists,= and > + ;; creates it otherwise. > + (close-fdes > + (open-fdes file (logior O_CREAT O_EXCL O_CLOEXEC))) > #t) > - (lambda _ > - #f))) > + (const #f))) >=20=20 > #$%initialize-gettext >=20=20 =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmUyJHIACgkQIgjSCVjB 3rAYug/7BkuTr4lnW54Mbtc+/SadOYy6DcmvGysj+EbvYJkbIkp+otnX4jeC1sXk KkYP9lCqJzlP3mOxv+yBmpq87ZDNnaRwfS8VfdIhLdnTNx89PlBXU/9s6aQ2CQ7a OIzoBJIJXLTTpMGCrskFXspdpsluFbguleuDy0mD8B619YZipxZnt/lJd2yQTAOG yLaT9eBoIqWSQjDATpH10dWRBYcAfTq5XczCmiyea2DektYqAg6GFqPnAYIwmgRv mSZiF9SBUjKIObp/jGjtc+texplNecCu70W9D1PYfPycIZVFhL/Xw8HWHR3lwcr1 ynmlVuCgYiuX7QHubfsbffKAHAYdNSyvjxgZH9nle7pLm9CffM1sPHjSWMaqpXdf VMWETOpD2DIcrL6s7QzRqoOTQXDeC4xJzRKGCylP9L3PAzKrG4nw5LOBL9dyNGbf dUk02arHBcw0+PnJjrQOYsvTZa+e5gQ6wrHnUfRNrAOdZzC1j67JQ2KXbNTUVWMA qjbRZcC5uKaXB0Bo0AIrmMNulqWO0QI48+OpizMaiTwHZ3nRDGFz83YI6R4kGZme GR3Ueo/wlg1JpUdG3kP5FoA3ujgbX1LlaM9A4lly1AHKCPfmb4/PnmY/iijpbcjw 4j7kqQPdz9a17Yc+SZ0kG0AGsoxByrs7kUWpo5/YO3DJgWjpZXE= =MSho -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Aug 18 11:10:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 17 Nov 2023 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator