From unknown Thu Aug 14 20:54:54 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#55941 <55941@debbugs.gnu.org> To: bug#55941 <55941@debbugs.gnu.org> Subject: Status: [PATCH core-updates 0/3] Move switch-symlinks to (guix build utils) Reply-To: bug#55941 <55941@debbugs.gnu.org> Date: Fri, 15 Aug 2025 03:54:54 +0000 retitle 55941 [PATCH core-updates 0/3] Move switch-symlinks to (guix build = utils) reassign 55941 guix-patches submitter 55941 Arun Isaac severity 55941 normal tag 55941 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 13 08:13:20 2022 Received: (at submit) by debbugs.gnu.org; 13 Jun 2022 12:13:20 +0000 Received: from localhost ([127.0.0.1]:57432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iwa-000472-9C for submit@debbugs.gnu.org; Mon, 13 Jun 2022 08:13:20 -0400 Received: from lists.gnu.org ([209.51.188.17]:40868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iwY-00046v-Qi for submit@debbugs.gnu.org; Mon, 13 Jun 2022 08:13:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0iwW-0000zy-Ei for guix-patches@gnu.org; Mon, 13 Jun 2022 08:13:18 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:34132) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0iwS-0007tS-Cx for guix-patches@gnu.org; Mon, 13 Jun 2022 08:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cHK7ri7sVfXich4o4LTs91Yq4vmq5oyn19eKrJG0pmw=; b=ZAW43s7A5vzYdSsv2xo7jeaXwx P3P2wneiaod4JnBewJ0Xu87GQBBS5thxGcYGw/WjXeoCFKQ6nW8vG+n7sMU3Dpk3d+zov1Zt318/8 cAV10J5T6qoacYtEhQ/VUXk0VGOLaUd/zdwjqyKxWTTWGp9KYO9Z/EdcWKNh1DQ/TVsyvAF3FOo4w /EdGa+z6p0LsMdccrf8EOes7DxE36Ha9xGJWfgznRVg/apfCjmFyUrx50g289+lr6YEZRKoopDiaL grNewzm9vpebsVlh1QWb36kzJTDfGHHxlWSB99XXYmodUYgRXlgyqKW4+Akc6PH2B0JNK58+FCzgW rJTvQu6Q==; Received: from [192.168.2.1] (port=3934 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0iwI-0004fW-Rz; Mon, 13 Jun 2022 17:43:02 +0530 From: Arun Isaac To: guix-patches@gnu.org, Maxime Devos Subject: [PATCH core-updates 0/3] Move switch-symlinks to (guix build utils) Date: Mon, 13 Jun 2022 17:43:00 +0530 Message-Id: <20220613121300.20227-1-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=139.59.75.54; envelope-from=arunisaac@systemreboot.net; helo=mugam.systemreboot.net 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Arun Isaac 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: -2.4 (--) Hi, As discussed on guix-devel, here are the patches moving switch-symlinks to (guix build utils). I ran `make check'. I don't think this patchset introduces any new failures, that is, other than those that are already failing on core-updates. Regards, Arun Arun Isaac (3): utils: Move switch-symlinks to (guix build utils). utils: Make switch-symlinks robust against interruption. services: pcscd: Use switch-symlinks from (guix build utils). gnu/services/security-token.scm | 9 ++------- guix/build/utils.scm | 24 ++++++++++++++++++++++-- guix/profiles.scm | 3 ++- guix/scripts/home.scm | 3 ++- guix/scripts/package.scm | 3 ++- guix/scripts/system/reconfigure.scm | 4 +++- guix/utils.scm | 8 -------- 7 files changed, 33 insertions(+), 21 deletions(-) base-commit: 0d09e2e29d1ef0afabebd843f51d41d6cfe340ee -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 13 08:15:42 2022 Received: (at 55941) by debbugs.gnu.org; 13 Jun 2022 12:15:42 +0000 Received: from localhost ([127.0.0.1]:57449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iyg-0004C5-5W for submit@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:42 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:46410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iye-0004Bp-Mf for 55941@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dlCNoGuS+wP5MLLp3DnFcE7nCVhugh+XXI7sOlRb0Z8=; b=iSrFDOIr4Zl//DHuWji92uk39t C/dR4deGKg3tPNZZKRmh6lyOydHREC+u2WF8iLePz5N0M+59k3SkuE/mlbx8cbE2OXR2iIxkOZLp6 GS2Z9gMKUQ6MxSn/LImkefayr36HCnxUzOhX97p3dgDB5GkSWd0OFbFyEwFwe6tlVAGpMjgMuiLQ/ GFZh1HuULVXMO6euCfkKemfngWOFGTcaWK+6TnC50vvHu59IK93j7SJtdCxVt9xDpJzUqep+U8r9U 1EYDkiSf1n0bllAhPUG5tDkjuF63S5Pm6EjXIKKXzPH4M5cXvle5zVuUOrdRgiJMPLpQYrm2JCfuO 2Y3wUMTA==; Received: from [192.168.2.1] (port=5296 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0iyb-0004fy-Ce; Mon, 13 Jun 2022 17:45:25 +0530 From: Arun Isaac To: 55941@debbugs.gnu.org, Maxime Devos Subject: [PATCH core-updates 1/3] utils: Move switch-symlinks to (guix build utils). Date: Mon, 13 Jun 2022 17:45:21 +0530 Message-Id: <20220613121523.20327-1-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 1.6 (+) 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: * guix/utils.scm (switch-symlinks): Move to ... * guix/build/utils.scm (switch-symlinks): ... here. * guix/profiles.scm, guix/scripts/home.scm, guix/scripts/package.scm: Import switch-symlinks from (g [...] Content analysis details: (1.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.6 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: jpoiret.xyz (xyz)] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 55941 Cc: Arun Isaac 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.6 (/) * guix/utils.scm (switch-symlinks): Move to ... * guix/build/utils.scm (switch-symlinks): ... here. * guix/profiles.scm, guix/scripts/home.scm, guix/scripts/package.scm: Import switch-symlinks from (guix build utils). * guix/scripts/system/reconfigure.scm (switch-system-program): Import (guix build utils) in G-expression. --- guix/build/utils.scm | 8 ++++++++ guix/profiles.scm | 3 ++- guix/scripts/home.scm | 3 ++- guix/scripts/package.scm | 3 ++- guix/scripts/system/reconfigure.scm | 4 +++- guix/utils.scm | 8 -------- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index b822caf619..ce7bdb2024 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -60,6 +60,7 @@ (define-module (guix build utils) directory-exists? executable-file? symbolic-link? + switch-symlinks call-with-temporary-output-file call-with-ascii-input-file file-header-match @@ -240,6 +241,13 @@ (define (symbolic-link? file) "Return #t if FILE is a symbolic link (aka. \"symlink\".)" (eq? (stat:type (lstat file)) 'symlink)) +(define (switch-symlinks link target) + "Atomically switch LINK, a symbolic link, to point to TARGET. Works +both when LINK already exists and when it does not." + (let ((pivot (string-append link ".new"))) + (symlink target pivot) + (rename-file pivot link))) + (define (call-with-temporary-output-file proc) "Call PROC with a name of a temporary file and open output port to that file; close the file and delete it when leaving the dynamic extent of this diff --git a/guix/profiles.scm b/guix/profiles.scm index bf50c00a1e..d3ff8379ad 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -12,6 +12,7 @@ ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020 Danny Milosavljevic ;;; Copyright © 2014 David Thompson +;;; Copyright © 2022 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,7 +33,7 @@ (define-module (guix profiles) #:use-module ((guix config) #:select (%state-directory)) #:use-module ((guix utils) #:hide (package-name->name+version)) #:use-module ((guix build utils) - #:select (package-name->name+version mkdir-p)) + #:select (package-name->name+version mkdir-p switch-symlinks)) #:use-module ((guix diagnostics) #:select (&fix-hint formatted-message)) #:use-module (guix i18n) #:use-module (guix records) diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 0f5c3388a1..8ba7693a83 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2021 Pierre Langlois ;;; Copyright © 2021 Oleg Pykhalov ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -63,7 +64,7 @@ (define-module (guix scripts home) #:autoload (guix scripts home edit) (guix-home-edit) #:autoload (guix scripts home import) (import-manifest) #:use-module ((guix status) #:select (with-status-verbosity)) - #:use-module ((guix build utils) #:select (mkdir-p)) + #:use-module ((guix build utils) #:select (mkdir-p switch-symlinks)) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (srfi srfi-1) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 99a6cfaa29..14a8e1f5e8 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2020 Simon Tournier ;;; Copyright © 2018 Steve Sprang ;;; Copyright © 2022 Josselin Poiret +;;; Copyright © 2022 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,7 +50,7 @@ (define-module (guix scripts package) #:autoload (guix channels) (channel-name channel-commit channel->code) #:autoload (guix store roots) (gc-roots user-owned?) #:use-module ((guix build utils) - #:select (directory-exists? mkdir-p)) + #:select (directory-exists? mkdir-p switch-symlinks)) #:use-module (ice-9 format) #:use-module (ice-9 match) #:autoload (ice-9 pretty-print) (pretty-print) diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm index 9ca66687ee..a173e011b4 100644 --- a/guix/scripts/system/reconfigure.scm +++ b/guix/scripts/system/reconfigure.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Christopher Baines ;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2022 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -94,7 +95,8 @@ (define* (switch-system-program os #:optional profile) #:select? not-config?) ((guix config) => ,(make-config.scm))) #~(begin - (use-modules (guix config) + (use-modules (guix build utils) + (guix config) (guix profiles) (guix utils)) diff --git a/guix/utils.scm b/guix/utils.scm index 37b2e29800..ed791cce1c 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -120,7 +120,6 @@ (define-module (guix utils) file-sans-extension tarball-sans-extension compressed-file? - switch-symlinks call-with-temporary-directory with-atomic-file-output @@ -892,13 +891,6 @@ (define (compressed-file? file) (->bool (member (file-extension file) '("gz" "bz2" "xz" "lz" "lzma" "tgz" "tbz2" "zip")))) -(define (switch-symlinks link target) - "Atomically switch LINK, a symbolic link, to point to TARGET. Works -both when LINK already exists and when it does not." - (let ((pivot (string-append link ".new"))) - (symlink target pivot) - (rename-file pivot link))) - (define* (string-replace-substring str substr replacement #:optional (start 0) base-commit: 0d09e2e29d1ef0afabebd843f51d41d6cfe340ee -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 13 08:15:46 2022 Received: (at 55941) by debbugs.gnu.org; 13 Jun 2022 12:15:46 +0000 Received: from localhost ([127.0.0.1]:57451 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iys-0004CT-R3 for submit@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:46 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:46414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iye-0004Br-Mf for 55941@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VbqhoA6ff8iWGT2D2kFiygOwvvstSXmjUx4dA3fPRm4=; b=pjHPDLq9EljxT5Fwe/2pXL7Kz9 b7HEMwqIKNoPNIUB19k8AGUhkcLBywwMHvs80eQnnqFClJP/aYAnLqniRfFD7PBQeJmWuyd0EITrA OgND1HtFUylWAqGCkUpTq8qD0bosxpwo1C/cTLzM3vAkhLTrMTgoDAmr0wVSBcLYqpdYyFUkgghwV ZbA3WkcdcVEiI7vA/3Rv5mOTgMG38+78haTDFDherhBRE6rObVnCNoGE4EkHJaFJSKJX6PUSa6U91 9UI13ujDfi2T0ZFVKdTrMJ1ABuXBuAw+4F1gYdqZVa2kRfTFGN0RqJ74F0hHGHOcYrUlVcIZYJERz hyJ4zqAw==; Received: from [192.168.2.1] (port=5296 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0iyb-0004fy-Oa; Mon, 13 Jun 2022 17:45:25 +0530 From: Arun Isaac To: 55941@debbugs.gnu.org, Maxime Devos Subject: [PATCH core-updates 3/3] services: pcscd: Use switch-symlinks from (guix build utils). Date: Mon, 13 Jun 2022 17:45:23 +0530 Message-Id: <20220613121523.20327-3-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613121523.20327-1-arunisaac@systemreboot.net> References: <20220613121523.20327-1-arunisaac@systemreboot.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55941 Cc: Arun Isaac 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 (-) switch-symlinks has been moved to (guix build utils). We need not duplicate it anymore. * gnu/services/security-token.scm (pcscd-activation): Use switch-symlinks from (guix build utils). --- gnu/services/security-token.scm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gnu/services/security-token.scm b/gnu/services/security-token.scm index 52afad84a6..2356273398 100644 --- a/gnu/services/security-token.scm +++ b/gnu/services/security-token.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018 Arun Isaac +;;; Copyright © 2018, 2022 Arun Isaac ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; Copyright © 2021 Brice Waegeneire ;;; @@ -74,12 +74,7 @@ (define pcscd-activation '((guix build utils))) #~(begin (use-modules (guix build utils)) - ;; XXX: We can't use (guix utils) because it requires a - ;; dynamically-linked Guile, hence the duplicate switch-symlinks. - (define (switch-symlinks link target) - (let ((pivot (string-append link ".new"))) - (symlink target pivot) - (rename-file pivot link))) + (mkdir-p "/var/lib") (switch-symlinks "/var/lib/pcsc" #$(directory-union -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 13 08:15:49 2022 Received: (at 55941) by debbugs.gnu.org; 13 Jun 2022 12:15:49 +0000 Received: from localhost ([127.0.0.1]:57453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iyw-0004Ce-Dz for submit@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:49 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:46412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0iye-0004Bq-N2 for 55941@debbugs.gnu.org; Mon, 13 Jun 2022 08:15:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Kof9tc4lW0D+8E8RqFR3cKRVrp2VHJY3zzVyjfFYuRw=; b=MP7Nlvg4JBWG4noocZrV75gAXx iPpcxE0XBWmQMZATH7YymyubWmMUqDz9eLTfVeQFVRI6U0aiTyFOlm2uwg/Xe5GdtaAH2hQMs6jDE VnsglvzW2RJn1PdaMoyvGmk0Q8CSNQpJCK0npdaDpqDXe8UmFKiuSaO+ORySHUXQ/Us6Y+vqFd+CE /ZixEpU/HEBYAtA206TKiG76ErEHZLjTOLzfa5VL9+1ymIDubXM0S7DGmkrgokVxPYR3uWwXIa/Q1 wivJggVm0ILFNA2KKG0u9ViVSbXxu5oDe0jw0z5kFmHjlP/gGGU0KuwdneIIT8faUurknuUHtXQuQ 83meT+wg==; Received: from [192.168.2.1] (port=5296 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0iyb-0004fy-JE; Mon, 13 Jun 2022 17:45:25 +0530 From: Arun Isaac To: 55941@debbugs.gnu.org, Maxime Devos Subject: [PATCH core-updates 2/3] utils: Make switch-symlinks robust against interruption. Date: Mon, 13 Jun 2022 17:45:22 +0530 Message-Id: <20220613121523.20327-2-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613121523.20327-1-arunisaac@systemreboot.net> References: <20220613121523.20327-1-arunisaac@systemreboot.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55941 Cc: Arun Isaac 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 (-) * guix/build/utils.scm (switch-symlinks): Delete pivot link if it already exists. Co-authored-by: Maxime Devos --- guix/build/utils.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index ce7bdb2024..5ea3b98353 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -3,11 +3,11 @@ ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2015, 2018, 2021 Mark H Weaver -;;; Copyright © 2018 Arun Isaac +;;; Copyright © 2018, 2022 Arun Isaac ;;; Copyright © 2018, 2019 Ricardo Wurmus ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2020, 2021 Maxim Cournoyer -;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021, 2022 Maxime Devos ;;; Copyright © 2021 Brendan Tildesley ;;; ;;; This file is part of GNU Guix. @@ -245,7 +245,19 @@ (define (switch-symlinks link target) "Atomically switch LINK, a symbolic link, to point to TARGET. Works both when LINK already exists and when it does not." (let ((pivot (string-append link ".new"))) - (symlink target pivot) + ;; Create pivot link, deleting it if it already exists. This can + ;; happen if a previous switch-symlinks was interrupted. + (let symlink/remove-old () + (catch 'system-error + (lambda () + (symlink target pivot)) + (lambda args + (if (= (system-error-errno args) EEXIST) + (begin + ;; Remove old link and retry. + (delete-file pivot) + (symlink/remove-old)) + (apply throw args))))) (rename-file pivot link))) (define (call-with-temporary-output-file proc) -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 23 16:47:18 2022 Received: (at 55941) by debbugs.gnu.org; 23 Jun 2022 20:47:18 +0000 Received: from localhost ([127.0.0.1]:40073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4TjQ-0006ba-UV for submit@debbugs.gnu.org; Thu, 23 Jun 2022 16:47:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4TjA-0006ap-Gj for 55941@debbugs.gnu.org; Thu, 23 Jun 2022 16:47:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4Tj2-0007L3-Gy; Thu, 23 Jun 2022 16:46:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=F23FoWBuNOpMgi/48d9W0nreQze+d8rJXm38b4RaZIk=; b=djD4EX64N6mMab+cicFd 7yAB+4Cefwpsqr4BfqsR6ukiy5JZ3sR17ACi1IS/iYo76tBSs3+HqCHaHFjJ1yN2iQHHp9IrjWdcT V2MEfECNcdwYgXdgGbgPZ3F3XlijASzU0dd8OfSouUQh/v0ZcKScKh1Mzki2vGO7BT6yZ/wIfOD+l lGnU00q3yAwgJ+VOg+joelu7q3EXGs6O26WSkn0Dnacdk1PlJpLHxmhlkqS0Yj36/EjrL2BGijIl7 XSbF72LTCAvFswHgxvxP6USoxW6CYP5YpfqKwCKUoEySJKy8q/fKl+HTySX4ttuHh8qZ0TY2epUWl 7J5J0HTc5ABtCQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=59072 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4Tj2-0007dh-4I; Thu, 23 Jun 2022 16:46:52 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Arun Isaac Subject: Re: bug#55941: [PATCH core-updates 0/3] Move switch-symlinks to (guix build utils) References: <20220613121300.20227-1-arunisaac@systemreboot.net> Date: Thu, 23 Jun 2022 22:46:50 +0200 In-Reply-To: <20220613121300.20227-1-arunisaac@systemreboot.net> (Arun Isaac's message of "Mon, 13 Jun 2022 17:43:00 +0530") Message-ID: <87letnw1j9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) 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: 55941 Cc: maximedevos@telenet.be, 55941@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 (---) Hi Arun, Arun Isaac skribis: > utils: Move switch-symlinks to (guix build utils). > utils: Make switch-symlinks robust against interruption. > services: pcscd: Use switch-symlinks from (guix build utils). LGTM, thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 24 16:30:30 2022 Received: (at 55941-done) by debbugs.gnu.org; 24 Jun 2022 20:30:30 +0000 Received: from localhost ([127.0.0.1]:43647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4pwk-0007bO-1C for submit@debbugs.gnu.org; Fri, 24 Jun 2022 16:30:30 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:46426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4pwc-0007b9-QX for 55941-done@debbugs.gnu.org; Fri, 24 Jun 2022 16:30:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LBK7FF8fRUPTBtM6ZE0cLf0bp1CQK3Y1D6Nhk+6Gvok=; b=XXFLOf1yyiUKWnKwKwZ5zIQYTl XizBL/x6TPMNsiAuFGqiM8ObB9F+7K7XSd0MRqK0E3usuhjS3qCiBZIjf6Xs52PYdYB1v7dSrQ1g0 DSvdzQwBoI6jq1o7DThM4fxTHP8gYUkSL3HydnG/QQK6NflyK7cpsGCc/cHaQQR6UBQG43zmCgb0N YOJGF9+KAeCa9/vTCVmzsrIBAKqQu3/QuUcjVKnHMPdLGqAeEys/bdw/Fcj+xVqziC0YoyBXoeMLF 8YrqZSNgkdvJM26iFj2TwSozM+OQvfnAblNFN6MisK/vSegBxO6DoMdURzorX04Y3Qi5G7dGXNYE7 rzi9+tBw==; Received: from [192.168.2.1] (port=4376 helo=steel) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o4pwZ-000Apb-QU; Sat, 25 Jun 2022 02:00:19 +0530 From: Arun Isaac To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#55941: [PATCH core-updates 0/3] Move switch-symlinks to (guix build utils) In-Reply-To: <87letnw1j9.fsf@gnu.org> References: <20220613121300.20227-1-arunisaac@systemreboot.net> <87letnw1j9.fsf@gnu.org> Date: Sat, 25 Jun 2022 02:00:19 +0530 Message-ID: <87fsjtls84.fsf@systemreboot.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55941-done Cc: maximedevos@telenet.be, 55941-done@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 (-) Thanks, pushed to core-updates! From unknown Thu Aug 14 20:54:54 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, 23 Jul 2022 11:24:06 +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