From unknown Wed Jun 18 00:26:48 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#36375 <36375@debbugs.gnu.org> To: bug#36375 <36375@debbugs.gnu.org> Subject: Status: =?UTF-8?Q?=E2=80=98guix_?= =?UTF-8?Q?package=E2=80=99?= should lock the profile Reply-To: bug#36375 <36375@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:26:48 +0000 retitle 36375 =E2=80=98guix package=E2=80=99 should lock the profile reassign 36375 guix submitter 36375 Ludovic Court=C3=A8s severity 36375 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 10:10:39 2019 Received: (at submit) by debbugs.gnu.org; 25 Jun 2019 14:10:39 +0000 Received: from localhost ([127.0.0.1]:33122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfm9f-00005D-Cz for submit@debbugs.gnu.org; Tue, 25 Jun 2019 10:10:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:57518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfm9d-000051-Hd for submit@debbugs.gnu.org; Tue, 25 Jun 2019 10:10:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40620) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfm9Y-0003jS-CI for bug-Guix@gnu.org; Tue, 25 Jun 2019 10:10:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hfm9T-0005Wf-5j; Tue, 25 Jun 2019 10:10:30 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=53118 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hfm9Q-00030T-6i; Tue, 25 Jun 2019 10:10:24 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: bug-Guix@gnu.org Subject: =?utf-8?Q?=E2=80=98guix_package=E2=80=99?= should lock the profile X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 Messidor an 227 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 25 Jun 2019 16:10:22 +0200 Message-ID: <875zotn4c1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: julien@lepiller.eu 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 (---) The article at mentions things like: For instance, after installing Icecat, I installed a few other desktop programs and then found Icecat had disappeared from my path again. It=E2=80=99s likely that the person ran several =E2=80=98guix package=E2=80= =99 commands in parallel, and that one undoed the effects of the other. Julien suggested that =E2=80=98guix package=E2=80=99 could grab a lock file= , and I guess it could simply error out when the lock is already taken. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 25 15:45:12 2019 Received: (at submit) by debbugs.gnu.org; 25 Oct 2019 19:45:12 +0000 Received: from localhost ([127.0.0.1]:39369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO5WH-0000Bk-Qm for submit@debbugs.gnu.org; Fri, 25 Oct 2019 15:45:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:58044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO5WG-0000Bd-De for submit@debbugs.gnu.org; Fri, 25 Oct 2019 15:45:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iO5WD-0007nj-96 for bug-Guix@gnu.org; Fri, 25 Oct 2019 15:45:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iO5WB-0007xn-Lq for bug-Guix@gnu.org; Fri, 25 Oct 2019 15:45:04 -0400 Received: from lepiller.eu ([89.234.186.109]:56238) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iO5W8-0007rB-AK; Fri, 25 Oct 2019 15:45:00 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id caf883bd; Fri, 25 Oct 2019 19:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=ma9YD10f+84UoBW2d9lHCDXEGKk=; b=dmdOO4 IT0pe2WB6YSysWyxFR3C7TdDQvFAzkkAWS+UaXNgwdTcTiuNqfHHshyc3I5Av4HR acKAa4ujMIxsYoNKVcAKdMXVvLUvt3yn908cywcar1yatt1PrjgWTzjDyW+a2CWG znp3QE7LKYxkZiuU0Dklwoc3TvM+mOuxF1CM/WKFo7ziFJbdBMEaJUxTzlBA+Nzg FgXSIiStRXDe23pdT9cpNCc5c6zeh44ACs5l9IGoiYznNNNAemfON/km76lgX+Yq SHt3b9rPuS75Jt6jt0aRwLS2t3GMOC7URyEbGqrlRnPflMHECgylL9p/+CPcXryf kzzYeDPMzUNFAqLA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 92c1e133 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Fri, 25 Oct 2019 19:44:55 +0000 (UTC) Date: Fri, 25 Oct 2019 21:44:51 +0200 From: Julien Lepiller To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Subject: [PATCH] Re: =?UTF-8?B?4oCYZ3VpeCBwYWNrYWdl4oCZ?= should lock the profile Message-ID: <20191025214451.284c3530@sybil.lepiller.eu> In-Reply-To: <875zotn4c1.fsf@gnu.org> References: <875zotn4c1.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/NjXHDtYF7MwzvaUEg6ae_qD" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 89.234.186.109 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: bug-Guix@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: -3.3 (---) --MP_/NjXHDtYF7MwzvaUEg6ae_qD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Tue, 25 Jun 2019 16:10:22 +0200, Ludovic Court=C3=A8s a =C3=A9crit : > The article at > mentions > things like: >=20 > For instance, after installing Icecat, I installed a few other > desktop programs and then found Icecat had disappeared from my path > again. >=20 > It=E2=80=99s likely that the person ran several =E2=80=98guix package=E2= =80=99 commands in > parallel, and that one undoed the effects of the other. >=20 > Julien suggested that =E2=80=98guix package=E2=80=99 could grab a lock fi= le, and I > guess it could simply error out when the lock is already taken. >=20 > Ludo=E2=80=99. Hi! attached is a patch for guix package to grab a lock file. Note that I'm using flock, so it won't work on NFS shares. The other option would be to use fcntl but guile doesn't seem to implement the locking function from it. --MP_/NjXHDtYF7MwzvaUEg6ae_qD Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-package-lock-profiles-when-processing-them.patch >From 987e9711f1fa6bfd270e48ee5624f69696e7e5c4 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 25 Oct 2019 21:39:21 +0200 Subject: [PATCH] guix: package: lock profiles when processing them. * guix/scripts/package.scm (process-actions): Get a per-profile lock to prevent concurrent actions on profiles. --- guix/scripts/package.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1a58d43e5c..e4f0f416f5 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -876,7 +876,17 @@ processed, #f otherwise." (package-version item) (manifest-entry-version entry)))))) - ;; First, process roll-backs, generation removals, etc. + ;; First, acquire a lock on the profile, to ensure only one guix process + ;; is modifying it at a time. + (define lock-file (open (string-append profile ".lock") O_CREAT)) + (catch 'system-error + (lambda _ + (flock lock-file (logior LOCK_EX LOCK_NB))) + (lambda (key . args) + (leave (G_ "profile ~a is being locked by another guix process.~%") + profile))) + + ;; Then, process roll-backs, generation removals, etc. (for-each (match-lambda ((key . arg) (and=> (assoc-ref %actions key) @@ -905,7 +915,10 @@ processed, #f otherwise." #:allow-collisions? allow-collisions? #:bootstrap? bootstrap? #:use-substitutes? substitutes? - #:dry-run? dry-run?)))) + #:dry-run? dry-run?))) + + ;; Finaly, close the lock file + (close lock-file)) ;;; -- 2.22.0 --MP_/NjXHDtYF7MwzvaUEg6ae_qD-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 25 17:21:46 2019 Received: (at 36375) by debbugs.gnu.org; 25 Oct 2019 21:21:46 +0000 Received: from localhost ([127.0.0.1]:39478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO71m-0002rZ-51 for submit@debbugs.gnu.org; Fri, 25 Oct 2019 17:21:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO71j-0002rK-Fh for 36375@debbugs.gnu.org; Fri, 25 Oct 2019 17:21:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iO71d-00021t-MI; Fri, 25 Oct 2019 17:21:37 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46774 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iO71d-0000xL-7w; Fri, 25 Oct 2019 17:21:37 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Julien Lepiller Subject: Re: [PATCH] Re: =?utf-8?Q?=E2=80=98guix_package=E2=80=99?= should lock the profile References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 Brumaire an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 25 Oct 2019 23:21:34 +0200 In-Reply-To: <20191025214451.284c3530@sybil.lepiller.eu> (Julien Lepiller's message of "Fri, 25 Oct 2019 21:44:51 +0200") Message-ID: <87tv7wldwh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36375 Cc: 36375@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: -3.3 (---) Hello, Julien Lepiller skribis: > attached is a patch for guix package to grab a lock file. Note that I'm > using flock, so it won't work on NFS shares. The other option would be > to use fcntl but guile doesn't seem to implement the locking function > from it. (guix build syscalls) has it though, so you should probably use it. :-) > From 987e9711f1fa6bfd270e48ee5624f69696e7e5c4 Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Fri, 25 Oct 2019 21:39:21 +0200 > Subject: [PATCH] guix: package: lock profiles when processing them. > > * guix/scripts/package.scm (process-actions): Get a per-profile lock to > prevent concurrent actions on profiles. [...] > - ;; First, process roll-backs, generation removals, etc. > + ;; First, acquire a lock on the profile, to ensure only one guix proce= ss > + ;; is modifying it at a time. > + (define lock-file (open (string-append profile ".lock") O_CREAT)) > + (catch 'system-error > + (lambda _ > + (flock lock-file (logior LOCK_EX LOCK_NB))) > + (lambda (key . args) > + (leave (G_ "profile ~a is being locked by another guix process.~%") > + profile))) Nitpick: "profile ~a is locked by another process~%". > + ;; Then, process roll-backs, generation removals, etc. > (for-each (match-lambda > ((key . arg) > (and=3D> (assoc-ref %actions key) > @@ -905,7 +915,10 @@ processed, #f otherwise." > #:allow-collisions? allow-collisions? > #:bootstrap? bootstrap? > #:use-substitutes? substitutes? > - #:dry-run? dry-run?)))) > + #:dry-run? dry-run?))) > + > + ;; Finaly, close the lock file > + (close lock-file)) I=E2=80=99d recommend wrapping the body in =E2=80=98with-file-lock=E2=80=99= (from (guix build syscalls)), which handles non-local exits. However you=E2=80=99d first need to add a #:wait? argument to =E2=80=98with= -file-lock=E2=80=99 and perhaps an additional argument to handle the already-locked case. Or maybe call that =E2=80=98with-file-lock/no-wait=E2=80=99. How does that sound? Thanks for working on it! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 25 18:08:17 2019 Received: (at 36375) by debbugs.gnu.org; 25 Oct 2019 22:08:17 +0000 Received: from localhost ([127.0.0.1]:39517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO7kl-0006BT-RN for submit@debbugs.gnu.org; Fri, 25 Oct 2019 18:08:17 -0400 Received: from lepiller.eu ([89.234.186.109]:50430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iO7ki-0006BJ-Sw for 36375@debbugs.gnu.org; Fri, 25 Oct 2019 18:08:13 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id bae4453f; Fri, 25 Oct 2019 22:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=BKORScJZ/Oqo4rjFRGz9/Fn6VDw=; b=I/Y/I/ kgv2VZuqUVtHyMt6uaRJS0MA+XsapH9RZ9xHeV2fH+buKdRt9fLl1kDHHJY2hOEG 156O/IRC8zriKOjyFaibfEI7A+gzChr8EAva8JaOrM4AJrj4h6cIQEYbV9VjlhWk TbunLQUFy/a3k2BRlS97P4eStbJw392vN5iBlvqqVy1MxxsKqNigCcO0N1VnfEQa JDxmVPITxJ96X94JG1Q0Vwv/RRVLVXBpmgw+olQwVrKPwZUytLt5hU5x4Ltcgh/Q SWvyX6Wf1ZRierpJYZhKxHcUYJAaXuHkye5A7xbhLV1Wjie5gZgf/59YpcDUcdKe qtlRM1ZgenW3jQwA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id a40813bb (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Fri, 25 Oct 2019 22:08:10 +0000 (UTC) Date: Sat, 26 Oct 2019 00:08:06 +0200 From: Julien Lepiller To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Subject: Re: [PATCH] Re: =?UTF-8?B?4oCYZ3VpeCBwYWNrYWdl4oCZ?= should lock the profile Message-ID: <20191026000806.7eb6342b@sybil.lepiller.eu> In-Reply-To: <87tv7wldwh.fsf@gnu.org> References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> <87tv7wldwh.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/60YbQDeCEhoBxDR8CJlH1yb" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36375 Cc: 36375@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: -1.0 (-) --MP_/60YbQDeCEhoBxDR8CJlH1yb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Fri, 25 Oct 2019 23:21:34 +0200, Ludovic Court=C3=A8s a =C3=A9crit : >=20 > I=E2=80=99d recommend wrapping the body in =E2=80=98with-file-lock=E2=80= =99 (from (guix build > syscalls)), which handles non-local exits. >=20 > However you=E2=80=99d first need to add a #:wait? argument to =E2=80=98wi= th-file-lock=E2=80=99 > and perhaps an additional argument to handle the already-locked case. > Or maybe call that =E2=80=98with-file-lock/no-wait=E2=80=99. >=20 > How does that sound? >=20 > Thanks for working on it! >=20 > Ludo=E2=80=99. Thanks! here is a new patch with your suggestions. --MP_/60YbQDeCEhoBxDR8CJlH1yb Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-package-lock-profiles-when-processing-them.patch >From 5d86226f318a111cc1bdf5a6f044c6f540f51b45 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 25 Oct 2019 21:39:21 +0200 Subject: [PATCH] guix: package: lock profiles when processing them. * guix/scripts/package.scm (process-actions): Get a per-profile lock to prevent concurrent actions on profiles. * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. (lock-file): Take a #:wait? key. --- guix/build/syscalls.scm | 33 ++++++++++++++++++-- guix/scripts/package.scm | 65 +++++++++++++++++++++++----------------- 2 files changed, 69 insertions(+), 29 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index bbf2531c79..d843194cce 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -80,6 +80,7 @@ lock-file unlock-file with-file-lock + with-file-lock/no-wait set-thread-name thread-name @@ -1087,10 +1088,10 @@ exception if it's already taken." ;; Presumably we got EAGAIN or so. (throw 'flock-error err)))))) -(define (lock-file file) +(define* (lock-file file #:key (wait? #t)) "Wait and acquire an exclusive lock on FILE. Return an open port." (let ((port (open-file file "w0"))) - (fcntl-flock port 'write-lock) + (fcntl-flock port 'write-lock #:wait? wait?) port)) (define (unlock-file port) @@ -1119,10 +1120,38 @@ exception if it's already taken." (when port (unlock-file port)))))) +(define (call-with-file-lock/no-wait file thunk handler) + (let ((port (catch 'system-error + (lambda () + (catch 'flock-error + (lambda () + (lock-file file #:wait? #f)) + handler)) + (lambda args + ;; When using the statically-linked Guile in the initrd, + ;; 'fcntl-flock' returns ENOSYS unconditionally. Ignore + ;; that error since we're typically the only process running + ;; at this point. + (if (or (= ENOSYS (system-error-errno args)) (= 'flock-error args)) + #f + (apply throw args)))))) + (dynamic-wind + (lambda () + #t) + thunk + (lambda () + (when port + (unlock-file port)))))) + (define-syntax-rule (with-file-lock file exp ...) "Wait to acquire a lock on FILE and evaluate EXP in that context." (call-with-file-lock file (lambda () exp ...))) +(define-syntax-rule (with-file-lock/no-wait file handler exp ...) + "Try to acquire a lock on FILE and evaluate EXP in that context. Execute +handler if the lock is already held by another process." + (call-with-file-lock/no-wait file (lambda () exp ...) handler)) + ;;; ;;; Miscellaneous, aka. 'prctl'. diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1a58d43e5c..4776d61077 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -42,6 +42,8 @@ #:autoload (guix store roots) (gc-roots) #:use-module ((guix build utils) #:select (directory-exists? mkdir-p)) + #:use-module ((guix build syscalls) + #:select (with-file-lock/no-wait)) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -876,36 +878,45 @@ processed, #f otherwise." (package-version item) (manifest-entry-version entry)))))) - ;; First, process roll-backs, generation removals, etc. - (for-each (match-lambda - ((key . arg) - (and=> (assoc-ref %actions key) - (lambda (proc) - (proc store profile arg opts - #:dry-run? dry-run?))))) - opts) - ;; Then, process normal package removal/installation/upgrade. - (let* ((manifest (profile-manifest profile)) - (step1 (options->removable opts manifest - (manifest-transaction))) - (step2 (options->installable opts manifest step1)) - (step3 (manifest-transaction - (inherit step2) - (install (map transform-entry - (manifest-transaction-install step2))))) - (new (manifest-perform-transaction manifest step3))) + ;; First, acquire a lock on the profile, to ensure only one guix process + ;; is modifying it at a time. + (with-file-lock/no-wait + (string-append profile ".lock") + (lambda (key . args) + (leave (G_ "profile ~a is locked by another guix process.~%") + profile)) - (warn-about-old-distro) + ;; Then, process roll-backs, generation removals, etc. + (for-each (match-lambda + ((key . arg) + (and=> (assoc-ref %actions key) + (lambda (proc) + (proc store profile arg opts + #:dry-run? dry-run?))))) + opts) - (unless (manifest-transaction-null? step3) - (show-manifest-transaction store manifest step3 - #:dry-run? dry-run?) - (build-and-use-profile store profile new - #:allow-collisions? allow-collisions? - #:bootstrap? bootstrap? - #:use-substitutes? substitutes? - #:dry-run? dry-run?)))) + ;; Then, process normal package removal/installation/upgrade. + (let* ((manifest (profile-manifest profile)) + (step1 (options->removable opts manifest + (manifest-transaction))) + (step2 (options->installable opts manifest step1)) + (step3 (manifest-transaction + (inherit step2) + (install (map transform-entry + (manifest-transaction-install step2))))) + (new (manifest-perform-transaction manifest step3))) + + (warn-about-old-distro) + + (unless (manifest-transaction-null? step3) + (show-manifest-transaction store manifest step3 + #:dry-run? dry-run?) + (build-and-use-profile store profile new + #:allow-collisions? allow-collisions? + #:bootstrap? bootstrap? + #:use-substitutes? substitutes? + #:dry-run? dry-run?))))) ;;; -- 2.22.0 --MP_/60YbQDeCEhoBxDR8CJlH1yb-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 06 08:25:10 2019 Received: (at 36375) by debbugs.gnu.org; 6 Nov 2019 13:25:10 +0000 Received: from localhost ([127.0.0.1]:39587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSLJ7-0003pP-Gm for submit@debbugs.gnu.org; Wed, 06 Nov 2019 08:25:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSLJ3-0003oj-IV for 36375@debbugs.gnu.org; Wed, 06 Nov 2019 08:25:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iSLIx-0004GM-Qw; Wed, 06 Nov 2019 08:24:59 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=52306 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iSLIu-0006zb-MD; Wed, 06 Nov 2019 08:24:57 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Julien Lepiller Subject: Re: bug#36375: [PATCH] Re: =?utf-8?Q?=E2=80=98guix_package?= =?utf-8?Q?=E2=80=99?= should lock the profile References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> <87tv7wldwh.fsf@gnu.org> <20191026000806.7eb6342b@sybil.lepiller.eu> Date: Wed, 06 Nov 2019 14:24:54 +0100 In-Reply-To: <20191026000806.7eb6342b@sybil.lepiller.eu> (Julien Lepiller's message of "Sat, 26 Oct 2019 00:08:06 +0200") Message-ID: <87mud95e8p.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36375 Cc: 36375@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: -3.3 (---) Hello! Julien Lepiller skribis: >>>From 5d86226f318a111cc1bdf5a6f044c6f540f51b45 Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Fri, 25 Oct 2019 21:39:21 +0200 > Subject: [PATCH] guix: package: lock profiles when processing them. > > * guix/scripts/package.scm (process-actions): Get a per-profile lock to > prevent concurrent actions on profiles. > * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. > (lock-file): Take a #:wait? key. Nice! Could you make the syscalls.scm changes a separate patch? > +(define (call-with-file-lock/no-wait file thunk handler) > + (let ((port (catch 'system-error > + (lambda () > + (catch 'flock-error > + (lambda () > + (lock-file file #:wait? #f)) > + handler)) > + (lambda args > + ;; When using the statically-linked Guile in the initr= d, > + ;; 'fcntl-flock' returns ENOSYS unconditionally. Igno= re > + ;; that error since we're typically the only process r= unning > + ;; at this point. > + (if (or (=3D ENOSYS (system-error-errno args)) (=3D 'f= lock-error args)) Please remove tabs. :-) This is wrong because (1) =E2=80=98args=E2=80=99 is always a list, and (2) = =E2=80=98=3D=E2=80=99 is defined for numbers, not for symbols and lists. I think you actually want to catch two exceptions here: =E2=80=98system-err= or=E2=80=99 and =E2=80=98flock-error=E2=80=99. For that, you have to do: (catch #t (lambda () (lock-file =E2=80=A6)) (lambda (key . args) (match key ('flock-error =E2=80=A6) ('system-error (if (=3D ENOSYS (system-error-errno (cons key args))) =E2=80=A6)) (_ (apply throw key args))))) =20=20=20=20=20=20=20=20 Does that make sense? > + ;; First, acquire a lock on the profile, to ensure only one guix proce= ss > + ;; is modifying it at a time. > + (with-file-lock/no-wait > + (string-append profile ".lock") Nitpick: I=E2=80=99d move the lock file name on the same line as =E2=80=98with-file-lock/no-wait=E2=80=99. > + (lambda (key . args) > + (leave (G_ "profile ~a is locked by another guix process.~%") > + profile)) s/guix// and remove the trailing period. Could you add a test for that in tests/guix-package.sh? One way to do it may be to do something like: echo '(sleep 60) > /=E2=80=A6/manifest.scm guix package -m /=E2=80=A6/manifest.scm -p whatever & pid=3D$! if guix install emacs -p whatever; then false; else true; fi kill $pid Could you send updated patches? Thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 07 16:19:46 2019 Received: (at 36375) by debbugs.gnu.org; 7 Nov 2019 21:19:46 +0000 Received: from localhost ([127.0.0.1]:44021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSpBx-00039a-AJ for submit@debbugs.gnu.org; Thu, 07 Nov 2019 16:19:46 -0500 Received: from lepiller.eu ([89.234.186.109]:33484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSpBu-00039R-JA for 36375@debbugs.gnu.org; Thu, 07 Nov 2019 16:19:44 -0500 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id f66c56ca; Thu, 7 Nov 2019 21:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=vv5Voucr/n6oYNtJuCw1g0KOygc=; b=dmvIst TrxN/TuqooQ0p/v9kty9oY5Y1gNlSlbszP3cu91Kpo+zB/x3JGbJwiR9MXqrBJXa 1m3to+Bo1LC0A2o/OWWaH41ZJC2ggk3I3os4itmcjK8/kOqm2tTlkEhmFB/PO9/H TGXBhssm3YiWLRrUfXYg2FlYb3bI/Huttfzz32CZyDRL5OSv/PB9nzDWNiSPhSgc yCzy3ofh3R6NpJ07pc12/0NjFYbk1V5ZpyicW1ZDpFGaQx5IDIM83ZLIHFxQwLgY SkzWHYabWLPGqUf48FFAH5v2UtePnlP7DqdMPAZ9vYqMrL7ThjE8qB494Wel0qh1 Albrcmk+/2kFSWZg== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 99951677 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Thu, 7 Nov 2019 21:19:40 +0000 (UTC) Date: Thu, 7 Nov 2019 22:19:36 +0100 From: Julien Lepiller To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Subject: Re: bug#36375: [PATCH] Re: =?UTF-8?B?4oCYZ3VpeCBwYWNrYWdl4oCZ?= should lock the profile Message-ID: <20191107221936.1ff9bed6@sybil.lepiller.eu> In-Reply-To: <87mud95e8p.fsf@gnu.org> References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> <87tv7wldwh.fsf@gnu.org> <20191026000806.7eb6342b@sybil.lepiller.eu> <87mud95e8p.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/54Pg=3SZ85vyjmuXtm1k9n+" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36375 Cc: 36375@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: -1.0 (-) --MP_/54Pg=3SZ85vyjmuXtm1k9n+ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Wed, 06 Nov 2019 14:24:54 +0100, Ludovic Court=C3=A8s a =C3=A9crit : > Hello! >=20 > Julien Lepiller skribis: >=20 > >>From 5d86226f318a111cc1bdf5a6f044c6f540f51b45 Mon Sep 17 00:00:00 > >>2001 =20 > > From: Julien Lepiller > > Date: Fri, 25 Oct 2019 21:39:21 +0200 > > Subject: [PATCH] guix: package: lock profiles when processing them. > > > > * guix/scripts/package.scm (process-actions): Get a per-profile > > lock to prevent concurrent actions on profiles. > > * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. > > (lock-file): Take a #:wait? key. =20 >=20 > Nice! Could you make the syscalls.scm changes a separate patch? >=20 > > +(define (call-with-file-lock/no-wait file thunk handler) > > + (let ((port (catch 'system-error > > + (lambda () > > + (catch 'flock-error > > + (lambda () > > + (lock-file file #:wait? #f)) > > + handler)) > > + (lambda args > > + ;; When using the statically-linked Guile in the > > initrd, > > + ;; 'fcntl-flock' returns ENOSYS > > unconditionally. Ignore > > + ;; that error since we're typically the only > > process running > > + ;; at this point. > > + (if (or (=3D ENOSYS (system-error-errno args)) (=3D > > 'flock-error args)) =20 >=20 > Please remove tabs. :-) >=20 > This is wrong because (1) =E2=80=98args=E2=80=99 is always a list, and (2= ) =E2=80=98=3D=E2=80=99 is > defined for numbers, not for symbols and lists. >=20 > I think you actually want to catch two exceptions here: =E2=80=98system-e= rror=E2=80=99 > and =E2=80=98flock-error=E2=80=99. For that, you have to do: >=20 > (catch #t > (lambda () > (lock-file =E2=80=A6)) > (lambda (key . args) > (match key > ('flock-error =E2=80=A6) > ('system-error > (if (=3D ENOSYS (system-error-errno (cons key args))) > =E2=80=A6)) > (_ > (apply throw key args))))) > =20 > Does that make sense? >=20 > > + ;; First, acquire a lock on the profile, to ensure only one guix > > process > > + ;; is modifying it at a time. > > + (with-file-lock/no-wait > > + (string-append profile ".lock") =20 >=20 > Nitpick: I=E2=80=99d move the lock file name on the same line as > =E2=80=98with-file-lock/no-wait=E2=80=99. >=20 > > + (lambda (key . args) > > + (leave (G_ "profile ~a is locked by another guix process.~%") > > + profile)) =20 >=20 > s/guix// and remove the trailing period. >=20 > Could you add a test for that in tests/guix-package.sh? >=20 > One way to do it may be to do something like: >=20 > echo '(sleep 60) > /=E2=80=A6/manifest.scm > guix package -m /=E2=80=A6/manifest.scm -p whatever & > pid=3D$! > if guix install emacs -p whatever; then false; else true; fi > kill $pid >=20 > Could you send updated patches? >=20 > Thanks! >=20 > Ludo=E2=80=99. Attached are updated patches! I also made sure the new test passes. --MP_/54Pg=3SZ85vyjmuXtm1k9n+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-Add-file-locking-with-no-wait.patch >From 71a85b5a8aac6c0bd5a1a4e3b52e409b2112df7a Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 7 Nov 2019 21:50:54 +0100 Subject: [PATCH 1/2] guix: Add file-locking with no wait. * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. (lock-file): Take a #:wait? key. --- guix/build/syscalls.scm | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index bbf2531c79..a5a9c92a42 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -80,6 +80,7 @@ lock-file unlock-file with-file-lock + with-file-lock/no-wait set-thread-name thread-name @@ -1087,10 +1088,10 @@ exception if it's already taken." ;; Presumably we got EAGAIN or so. (throw 'flock-error err)))))) -(define (lock-file file) +(define* (lock-file file #:key (wait? #t)) "Wait and acquire an exclusive lock on FILE. Return an open port." (let ((port (open-file file "w0"))) - (fcntl-flock port 'write-lock) + (fcntl-flock port 'write-lock #:wait? wait?) port)) (define (unlock-file port) @@ -1119,10 +1120,40 @@ exception if it's already taken." (when port (unlock-file port)))))) +(define (call-with-file-lock/no-wait file thunk handler) + (let ((port (catch #t + (lambda () + (lock-file file #:wait? #f)) + (lambda (key . args) + (match key + ('flock-error + (handler args)) + ('system-error + ;; When using the statically-linked Guile in the initrd, + ;; 'fcntl-flock' returns ENOSYS unconditionally. Ignore + ;; that error since we're typically the only process running + ;; at this point. + (if (= ENOSYS (system-error-errno (cons key args))) + #f + (apply throw args))) + (_ (apply throw key args))))))) + (dynamic-wind + (lambda () + #t) + thunk + (lambda () + (when port + (unlock-file port)))))) + (define-syntax-rule (with-file-lock file exp ...) "Wait to acquire a lock on FILE and evaluate EXP in that context." (call-with-file-lock file (lambda () exp ...))) +(define-syntax-rule (with-file-lock/no-wait file handler exp ...) + "Try to acquire a lock on FILE and evaluate EXP in that context. Execute +handler if the lock is already held by another process." + (call-with-file-lock/no-wait file (lambda () exp ...) handler)) + ;;; ;;; Miscellaneous, aka. 'prctl'. -- 2.22.0 --MP_/54Pg=3SZ85vyjmuXtm1k9n+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-guix-package-lock-profiles-when-processing-them.patch >From 50c792e155d1207127f10ff0c0360442b7736a64 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 25 Oct 2019 21:39:21 +0200 Subject: [PATCH 2/2] guix: package: lock profiles when processing them. * guix/scripts/package.scm (process-actions): Get a per-profile lock to prevent concurrent actions on profiles. * tests/guix-package.sh: Add test. --- guix/scripts/package.scm | 64 +++++++++++++++++++++++----------------- tests/guix-package.sh | 10 ++++++- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1a58d43e5c..bcd03a1df9 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -42,6 +42,8 @@ #:autoload (guix store roots) (gc-roots) #:use-module ((guix build utils) #:select (directory-exists? mkdir-p)) + #:use-module ((guix build syscalls) + #:select (with-file-lock/no-wait)) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -876,36 +878,44 @@ processed, #f otherwise." (package-version item) (manifest-entry-version entry)))))) - ;; First, process roll-backs, generation removals, etc. - (for-each (match-lambda - ((key . arg) - (and=> (assoc-ref %actions key) - (lambda (proc) - (proc store profile arg opts - #:dry-run? dry-run?))))) - opts) - ;; Then, process normal package removal/installation/upgrade. - (let* ((manifest (profile-manifest profile)) - (step1 (options->removable opts manifest - (manifest-transaction))) - (step2 (options->installable opts manifest step1)) - (step3 (manifest-transaction - (inherit step2) - (install (map transform-entry - (manifest-transaction-install step2))))) - (new (manifest-perform-transaction manifest step3))) + ;; First, acquire a lock on the profile, to ensure only one guix process + ;; is modifying it at a time. + (with-file-lock/no-wait (string-append profile ".lock") + (lambda (key . args) + (leave (G_ "profile ~a is locked by another process~%") + profile)) - (warn-about-old-distro) + ;; Then, process roll-backs, generation removals, etc. + (for-each (match-lambda + ((key . arg) + (and=> (assoc-ref %actions key) + (lambda (proc) + (proc store profile arg opts + #:dry-run? dry-run?))))) + opts) - (unless (manifest-transaction-null? step3) - (show-manifest-transaction store manifest step3 - #:dry-run? dry-run?) - (build-and-use-profile store profile new - #:allow-collisions? allow-collisions? - #:bootstrap? bootstrap? - #:use-substitutes? substitutes? - #:dry-run? dry-run?)))) + ;; Then, process normal package removal/installation/upgrade. + (let* ((manifest (profile-manifest profile)) + (step1 (options->removable opts manifest + (manifest-transaction))) + (step2 (options->installable opts manifest step1)) + (step3 (manifest-transaction + (inherit step2) + (install (map transform-entry + (manifest-transaction-install step2))))) + (new (manifest-perform-transaction manifest step3))) + + (warn-about-old-distro) + + (unless (manifest-transaction-null? step3) + (show-manifest-transaction store manifest step3 + #:dry-run? dry-run?) + (build-and-use-profile store profile new + #:allow-collisions? allow-collisions? + #:bootstrap? bootstrap? + #:use-substitutes? substitutes? + #:dry-run? dry-run?))))) ;;; diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 0de30bf6c1..7ad0699380 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -33,7 +33,7 @@ profile="t-profile-$$" tmpfile="t-guix-package-file-$$" rm -f "$profile" "$tmpfile" -trap 'rm -f "$profile" "$profile-"[0-9]* "$tmpfile"; rm -rf "$module_dir" t-home-'"$$" EXIT +trap 'rm -f "$profile" "$profile.lock" "$profile-"[0-9]* "$tmpfile"; rm -rf "$module_dir" t-home-'"$$" EXIT # Use `-e' with a non-package expression. if guix package --bootstrap -e +; @@ -452,3 +452,11 @@ rm -rf "$module_dir" # Make sure we can see user profiles. guix package --list-profiles | grep "$profile" guix package --list-profiles | grep '\.guix-profile' + +# Make sure we can properly lock a profile. +mkdir "$module_dir" +echo '(sleep 60)' > "$module_dir/manifest.scm" +guix package -m "$module_dir/manifest.scm" -p "$module_dir/profile" & +pid=$! +if guix install emacs -p "$module_dir/profile"; then kill $pid; false; else true; fi +kill $pid -- 2.22.0 --MP_/54Pg=3SZ85vyjmuXtm1k9n+-- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 08 15:03:19 2019 Received: (at 36375) by debbugs.gnu.org; 8 Nov 2019 20:03:19 +0000 Received: from localhost ([127.0.0.1]:47665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTATX-0001Dh-Cb for submit@debbugs.gnu.org; Fri, 08 Nov 2019 15:03:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTATT-0001DR-2i for 36375@debbugs.gnu.org; Fri, 08 Nov 2019 15:03:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iTATN-0007Wd-94; Fri, 08 Nov 2019 15:03:09 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42180 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iTATM-0000JL-H8; Fri, 08 Nov 2019 15:03:08 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Julien Lepiller Subject: Re: bug#36375: [PATCH] Re: =?utf-8?Q?=E2=80=98guix_package?= =?utf-8?Q?=E2=80=99?= should lock the profile References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> <87tv7wldwh.fsf@gnu.org> <20191026000806.7eb6342b@sybil.lepiller.eu> <87mud95e8p.fsf@gnu.org> <20191107221936.1ff9bed6@sybil.lepiller.eu> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 18 Brumaire an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 08 Nov 2019 21:03:05 +0100 In-Reply-To: <20191107221936.1ff9bed6@sybil.lepiller.eu> (Julien Lepiller's message of "Thu, 7 Nov 2019 22:19:36 +0100") Message-ID: <871ruif85i.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36375 Cc: 36375@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: -3.3 (---) Hello! Julien Lepiller skribis: > From 71a85b5a8aac6c0bd5a1a4e3b52e409b2112df7a Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Thu, 7 Nov 2019 21:50:54 +0100 > Subject: [PATCH 1/2] guix: Add file-locking with no wait. > > * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. > (lock-file): Take a #:wait? key. [...] > From 50c792e155d1207127f10ff0c0360442b7736a64 Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Fri, 25 Oct 2019 21:39:21 +0200 > Subject: [PATCH 2/2] guix: package: lock profiles when processing them. > > * guix/scripts/package.scm (process-actions): Get a per-profile lock to > prevent concurrent actions on profiles. > * tests/guix-package.sh: Add test. LGTM! I tested =E2=80=98with-file-lock=E2=80=99 on an NFSv3 mount, and =E2=80=98F= _SETLKW=E2=80=99 is correctly implemented, FWIW. Thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 08 16:03:16 2019 Received: (at 36375-done) by debbugs.gnu.org; 8 Nov 2019 21:03:16 +0000 Received: from localhost ([127.0.0.1]:47761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTBPY-0002m7-Hm for submit@debbugs.gnu.org; Fri, 08 Nov 2019 16:03:16 -0500 Received: from lepiller.eu ([89.234.186.109]:34034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTBPW-0002lv-8I for 36375-done@debbugs.gnu.org; Fri, 08 Nov 2019 16:03:15 -0500 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 4b5ba954 for <36375-done@debbugs.gnu.org>; Fri, 8 Nov 2019 21:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=dkim; bh=omEUmLoz0u8x afm54Pb7KJWmFXQ=; b=HaqXY5CzhMKHBTj8RJX+uE1i4gGc4GT9Veel8YB2u0eN RTldErjw64wICu5mj5DmdT8dP42fcDjgMY65+UQfD1YPsxE5Ql2zB4sJDVC8U7sd snHDbtIInXoupSdYjf+Lkk6jQgmHZdd0QRLsWdtFLFEQTAZalevMYa0JUH3iwfEv jPuR5IAAWHw2slsMRWvb8d09GoLvTBd/48mvZzXh0MnI5Bb0S9JfcmQyTsAWFxAJ fDx3CQMsf4Ydh06Fd/pTUvv30JZLrZeU62gEcdA1kOg1tGYtzgThjGcTRLhs96SW G77sFdRt0mQZns3svBPfiuj+dnf6nnkPaR5JfIXW6A== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id b7b42e3d (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <36375-done@debbugs.gnu.org>; Fri, 8 Nov 2019 21:03:11 +0000 (UTC) Date: Fri, 8 Nov 2019 22:03:04 +0100 From: Julien Lepiller To: 36375-done@debbugs.gnu.org Subject: Re: bug#36375: [PATCH] Re: =?UTF-8?B?4oCYZ3VpeCBwYWNrYWdl4oCZ?= should lock the profile Message-ID: <20191108220304.7dd04d45@sybil.lepiller.eu> In-Reply-To: <871ruif85i.fsf@gnu.org> References: <875zotn4c1.fsf@gnu.org> <20191025214451.284c3530@sybil.lepiller.eu> <87tv7wldwh.fsf@gnu.org> <20191026000806.7eb6342b@sybil.lepiller.eu> <87mud95e8p.fsf@gnu.org> <20191107221936.1ff9bed6@sybil.lepiller.eu> <871ruif85i.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36375-done 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 (-) Le Fri, 08 Nov 2019 21:03:05 +0100, Ludovic Court=C3=A8s a =C3=A9crit : > Hello! >=20 > Julien Lepiller skribis: >=20 > > From 71a85b5a8aac6c0bd5a1a4e3b52e409b2112df7a Mon Sep 17 00:00:00 > > 2001 From: Julien Lepiller > > Date: Thu, 7 Nov 2019 21:50:54 +0100 > > Subject: [PATCH 1/2] guix: Add file-locking with no wait. > > > > * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. > > (lock-file): Take a #:wait? key. =20 >=20 > [...] >=20 > > From 50c792e155d1207127f10ff0c0360442b7736a64 Mon Sep 17 00:00:00 > > 2001 From: Julien Lepiller > > Date: Fri, 25 Oct 2019 21:39:21 +0200 > > Subject: [PATCH 2/2] guix: package: lock profiles when processing > > them. > > > > * guix/scripts/package.scm (process-actions): Get a per-profile > > lock to prevent concurrent actions on profiles. > > * tests/guix-package.sh: Add test. =20 >=20 > LGTM! >=20 > I tested =E2=80=98with-file-lock=E2=80=99 on an NFSv3 mount, and =E2=80= =98F_SETLKW=E2=80=99 is > correctly implemented, FWIW. >=20 > Thank you! >=20 > Ludo=E2=80=99. Pushed as f49e9131889775a74a85c1f9b29f108030337b8b and b1fb663404894268b5ee92c040f12c52c0bee425. From unknown Wed Jun 18 00:26:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 07 Dec 2019 12:24:05 +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