From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IEMVI5vxnWLVTQEAbAwnHQ (envelope-from ) for ; Mon, 06 Jun 2022 14:22:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id qGIZIpvxnWJIwgAAG6o9tA (envelope-from ) for ; Mon, 06 Jun 2022 14:22:51 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 56A6D31D01 for ; Mon, 6 Jun 2022 14:22:51 +0200 (CEST) Received: from localhost ([::1]:53044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyBkw-0001Lr-EP for larch@yhetil.org; Mon, 06 Jun 2022 08:22:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyBjY-0000hv-ST for guix-devel@gnu.org; Mon, 06 Jun 2022 08:21:26 -0400 Received: from xavier.telenet-ops.be ([2a02:1800:120:4::f00:14]:42776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyBjW-0000Z6-FE for guix-devel@gnu.org; Mon, 06 Jun 2022 08:21:24 -0400 Received: from [172.20.10.5] ([188.188.162.14]) by xavier.telenet-ops.be with bizsmtp id foMG2700B0JwnGC01oMHCp; Mon, 06 Jun 2022 14:21:18 +0200 Message-ID: <6eca3fbfe370f650dfddd5eaf5fbe7193a80cd91.camel@telenet.be> Subject: Re: Move switch-symlinks to (guix build utils) From: Maxime Devos To: Arun Isaac , Ludovic =?ISO-8859-1?Q?Court=E8s?= Cc: Guix Devel Date: Mon, 06 Jun 2022 14:20:51 +0200 In-Reply-To: <87czfmm3pm.fsf@systemreboot.net> References: <87pmjsdeh7.fsf@systemreboot.net> <72a63d9badd632af81adb75b66cd95d9c05bc31a.camel@telenet.be> <87ee07cdfn.fsf@systemreboot.net> <8735glk8gs.fsf@gnu.org> <2c194c3b2f192ba49caaf585703f95b6c6bcb7d9.camel@telenet.be> <87czfmm3pm.fsf@systemreboot.net> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-pt3j+6KUMggHqj5KfRmc" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654518078; bh=Em0Talu4GqLtjMd+bIw9vj5HeNcscUNvGdmeNg/TpJ0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RqMIIfcq4ikIoa2nw+xsnkQH1LsaY6ttb4yFyerPYg/c1dNSpx6wNk1VDFQtKyLFi UAiyKn7jqXw7VBF8RNg/BTKHwKla5oh/NC4OSQea3m5ea95Kt32SxFe1i5XJ4cYmR9 BPpFstUyZN0dUhbi1+V5BaOsuRkmKgTNGg3GCxhOpEvp7p4C6ArYtCD9jXsGRHYUnb lD4p4iFmveqgLiqux9CxASkz1jBL9snqRj1JTSZE/RCfRMDIUvTN3nkit3xz85N/to IkZ5CIN7J0O6NUday6VO8aZW+LYQIpck01s1Lk1C/kYVvE5n6qdUZiVrQBZZeZ5s4U rKCVwk9nL9xRg== Received-SPF: pass client-ip=2a02:1800:120:4::f00:14; envelope-from=maximedevos@telenet.be; helo=xavier.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, 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-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654518171; h=from:from:sender:sender: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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Em0Talu4GqLtjMd+bIw9vj5HeNcscUNvGdmeNg/TpJ0=; b=RK5Wop/735NcdfMafj03AERVEyqO9pzbt2oIymmVQfoJZPAhLlH3Yaq1oJexi4P8Ewyck+ YICUGZgUDZHbrmZL5ys/mwEwDz4xfyV9AS0ieOVwi0EeHrq+RWrZJv1+dw2y1mE28/DiBf y4jhlVuU1pPmETK6ux6RuDkOUUArixuxtZYJxWN0Tp3aSx3I4iVkfFawA0wtAv96hspfg5 B36U5CYmqAthBqvsJtoDz1ZJg/1mNOFtpmy3btrMlfW73KtuCblIGGzwRRRVC8kmivbbrV lgMRhFM6qxKsSYcbh44SN1VJbkcxsmsWPk+GlTG1X5k+UgEjkGg8/aojwNEBew== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654518171; a=rsa-sha256; cv=none; b=Jj63ppW67zkLEP5I4thatXOWqMJKlgd+KpmfV/AnRmIA+GoyONoMmkdYZx3eeAJmBxig7c hHiKmWFguAlVptiZS26F4IgoOQGNYWadv+N40/WCGtCO6FD8GUa9c6LBtye6DC49X7vX2C KvInjHYlBv82KUU0mVmy2MY2Mn2InRw4paim99KXC/W47BEyXKsX8MPx+OjsWNMi50B5oT syFtVTk3TBDbTpmSvLfulGpmv6JDwBAkcTKSsZhaSxUAvZKF/ZwvN8Smt79xjZ+oL+JpYt Zgg3wvypjNGiRS6AhJB27glNlTTDN3Pp/3YTvRSyoll5NqT9GCihVH/XYkuolA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r22 header.b=RqMIIfcq; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -8.41 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r22 header.b=RqMIIfcq; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 56A6D31D01 X-Spam-Score: -8.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5gCrsV5pElJD --=-pt3j+6KUMggHqj5KfRmc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Arun Isaac schreef op ma 06-06-2022 om 16:57 [+0530]: > Could we implement symlink/remove-old without catch and throw? Something > like: >=20 > --8<---------------cut here---------------start------------->8--- > (define (symlink/remove-old target link) > =C2=A0 "Make a symbolic link named LINK pointing to TARGET. If LINK alrea= dy > exists, it will be removed first.=C2=A0 This is not an atomic operation." > =C2=A0 (when (file-exists? link) > =C2=A0=C2=A0=C2=A0 (delete-file link)) > =C2=A0 (symlink target link)) > --8<---------------cut here---------------end--------------->8--- file-exists? does not check if the file exists -- for a broken symlink, it will return #false instead of #true. Also, this introduces additional non-atomicity (though in this particular case, this does not seem to be a problem). It would also make things a tiny bit slower, because file-exists? makes an additional syscall. For these three reasons, I would go for the more robust catch+throw. Greetings, Maxime. --=-pt3j+6KUMggHqj5KfRmc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYp3xIxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gHdAP95j+0CZMIAqdARE2Q0tORlU6Xb pHuaSGck9xgYz0O4DwEA1ccT7+2DTlTZjWOW5klo/laAUAngXkX8kFDTse4VJAk= =ptTe -----END PGP SIGNATURE----- --=-pt3j+6KUMggHqj5KfRmc--