From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YJrXD4afmmKxIwAAbAwnHQ (envelope-from ) for ; Sat, 04 Jun 2022 01:55:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WDvuD4afmmJHdAAA9RJhRA (envelope-from ) for ; Sat, 04 Jun 2022 01:55:50 +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 DFBE6BF41 for ; Sat, 4 Jun 2022 01:55:49 +0200 (CEST) Received: from localhost ([::1]:40980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxH8u-0000Ab-W3 for larch@yhetil.org; Fri, 03 Jun 2022 19:55:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxH8d-000089-5t for guix-devel@gnu.org; Fri, 03 Jun 2022 19:55:31 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:41894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxH8b-0001sI-4g; Fri, 03 Jun 2022 19:55:30 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 6DBB360EAE; Fri, 3 Jun 2022 23:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1654300523; bh=mekufzutL1fb189Hezk7Rr1v4qeKzTa0LfevscEijB8=; h=From:Date:To:Cc:Subject:References:In-Reply-To:From; b=ek8LQT5vejAmyZZfVkoXukjwmC9v47c4Ju0+0EijBvcXfdpHGuGzkAIMt90k2d4kH /FxZadr2//UMFWyqkliVlRdR4nW9Q1GAdUTrZRKCqk/Qa0KOUusjkd09peIJJwtj6R xr1taByNABvuofYhhGrOzfKK4n4rUdcm8ce4D+5fo6+iz+srz9ke6wnTrZhaJLaNHZ sT+NcnOECKAteUxuhV0aC4T2HrUtq3C7nyKwV0okDiVv/kV7lCSh7jX7FIoBbkmnQP +o/xuwxjA32AacMuJ+/pROIczAUMNxQcsttW0FrRj5M6L7DrK1AwfEGvIwOUcuI0Ts KrYKWoAXREQPQ== X-Virus-Scanned: Debian amavisd-new at emo07-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo07-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bms6EhNx3nCz; Fri, 3 Jun 2022 23:55:23 +0000 (UTC) Received: from localhost (m83-185-40-251.cust.tele2.se [83.185.40.251]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 8D73860E3C; Fri, 3 Jun 2022 23:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1654300523; bh=mekufzutL1fb189Hezk7Rr1v4qeKzTa0LfevscEijB8=; h=From:Date:To:Cc:Subject:References:In-Reply-To:From; b=ek8LQT5vejAmyZZfVkoXukjwmC9v47c4Ju0+0EijBvcXfdpHGuGzkAIMt90k2d4kH /FxZadr2//UMFWyqkliVlRdR4nW9Q1GAdUTrZRKCqk/Qa0KOUusjkd09peIJJwtj6R xr1taByNABvuofYhhGrOzfKK4n4rUdcm8ce4D+5fo6+iz+srz9ke6wnTrZhaJLaNHZ sT+NcnOECKAteUxuhV0aC4T2HrUtq3C7nyKwV0okDiVv/kV7lCSh7jX7FIoBbkmnQP +o/xuwxjA32AacMuJ+/pROIczAUMNxQcsttW0FrRj5M6L7DrK1AwfEGvIwOUcuI0Ts KrYKWoAXREQPQ== From: bokr@bokr.com Date: Sat, 4 Jun 2022 01:55:05 +0200 To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Maxime Devos , Arun Isaac , Guix Devel Subject: Re: Move switch-symlinks to (guix build utils) Message-ID: <20220603235505.GA2742@LionPure> References: <87pmjsdeh7.fsf@systemreboot.net> <72a63d9badd632af81adb75b66cd95d9c05bc31a.camel@telenet.be> <87ee07cdfn.fsf@systemreboot.net> <8735glk8gs.fsf@gnu.org> <2c194c3b2f192ba49caaf585703f95b6c6bcb7d9.camel@telenet.be> <87h751ily8.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87h751ily8.fsf@gnu.org> User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=64.68.200.34; envelope-from=bokr@bokr.com; helo=mailout.easymail.ca X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01, 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=1654300550; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=ix08FP1fDbi75ylSdfBz8rzgmczxGTQVqeTsf9eOSMo=; b=NvtUbRsMZN3n/NvFCTs6YjZ1y/qjEoGqXMeuuasbsnb88iKpoxlrmJrkT3gjbiklu+L8Aj ht5CDUpxePBIpM/MeNfgqbLc+zOQiMQ8N7qUKjf6RRfOsA3lVvPgExKoxVaJUjGpm4jiI6 clxIG8Tkx/1tTsNbgp1x7Q1dA8DpJsj9/zhvAJN37iKqj7IS6nrITX1VA/7ijPrzCb7qYx hgkoia+AsPNXno+y5vg1b5V/x8xXSWkzGPsYDPojqHqHd7hOYsAqzEE+nn6pHCR47HwzE1 mj97J6j+c56oeEwzfOuixpMHeYddqpkMxz47qQOOhQY94KQ5p4LO3UnpquF1vQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654300550; a=rsa-sha256; cv=none; b=dKSWoX0uqGh4GPBDdw3Tg56iFmjEowXT71YJvFvtgsWuwRnKB5SdxYRNN9c1Jks0E4uSzk 5XFhM42BYxDZL8kRpFUYeXpjhVShNO1ZMB76REwPBrFPuLZgwrdXAjYOpAf4yanYzIoASr YSnuk9SOyHYbXFC3vmMASFll+4nWEIqXp6EYYHdA3G/Ly4tIvIAq3YeIx/kuhWqBnDitUT rBeQKWEV93hEZJ2tMCMAK6CpKpbGXj0YN6Yvd84jqrqcB52U89WxHvAUb8OPOrH/bqIr/N B/iSMs2rfUPNcW1zTHu4UXqfhfxN/SVI638henH2kT7cHi+RB5TF/r3XHd1dtw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=ek8LQT5v; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=ek8LQT5v; dmarc=none; 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: 1.48 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=ek8LQT5v; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=ek8LQT5v; dmarc=none; 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: DFBE6BF41 X-Spam-Score: 1.48 X-Migadu-Scanner: scn1.migadu.com X-TUID: V55QrbkmCBt2 Hi, I am not expert on kernel link internals, but if you need/prefer atomic change to a specific link, does my log [1] below suggest a way? On +2022-06-03 21:30:39 +0200, Ludovic Courtès wrote: > Hi, > > Maxime Devos skribis: > > >, Maybe replace > > > > (symlink target pivot) > > > > by (symlink/remove-old target pivot) > > > > where > > > > (define (symlink/remove-old target link) > > "Make a symbolic link named LINK pointing to TARGET. > > If LINK already exists, it will be removed first. > > This is not an atomic operation." > > (catch 'system-error > > (lambda () > > (symlink target link)) > > (lambda stuff > > (if (= (system-error-errno stuff) EEXIST) > > (begin > > ;; remove old link and retry > > (delete-file link) > > (symlink/remove-old link target)) > > (apply throw stuff))))) > > Alright, SGTM (this procedure would be kept private). > > So Arun, the floor is yours! :-) > > Ludo’. > [0]: (some "<--= note" notes edited in) BTW: notice that Size: is number of chars in TARGET name, not the LINK name --8<---------------cut here---------------start------------->8--- $ ln -sT TARGET LINK $ stat LINK File: LINK -> TARGET Size: 6 Blocks: 0 IO Block: 4096 symbolic link Device: fe00h/65024d Inode: 19401553 Links: 1 # <--= note inode number: mv will not change it Access: (0777/lrwxrwxrwx) Uid: ( 1000/ bokr) Gid: ( 1000/ bokr) Access: 2022-06-04 00:57:47.680832044 +0200 Modify: 2022-06-04 00:57:47.680832044 +0200 Change: 2022-06-04 00:57:47.680832044 +0200 Birth: - $ mv -v LINK WAS-LINK renamed 'LINK' -> 'WAS-LINK' $ stat WAS-LINK File: WAS-LINK -> TARGET Size: 6 Blocks: 0 IO Block: 4096 symbolic link # <--= TARGET is still 6 chars :) Device: fe00h/65024d Inode: 19401553 Links: 1 # <--= note inode number: did not change with mv Access: (0777/lrwxrwxrwx) Uid: ( 1000/ bokr) Gid: ( 1000/ bokr) Access: 2022-06-04 00:57:47.680832044 +0200 Modify: 2022-06-04 00:57:47.680832044 +0200 Change: 2022-06-04 00:58:33.617240104 +0200 Birth: - $ ln -sT NEW-TARGET LINK $ stat LINK File: LINK -> NEW-TARGET Size: 10 Blocks: 0 IO Block: 4096 symbolic link # <--= NEW-TARGET is 10 chars :) Device: fe00h/65024d Inode: 19401638 Links: 1 <--= note inode number: new for new use of LINK name Access: (0777/lrwxrwxrwx) Uid: ( 1000/ bokr) Gid: ( 1000/ bokr) Access: 2022-06-04 01:00:10.630121441 +0200 Modify: 2022-06-04 01:00:10.630121441 +0200 Change: 2022-06-04 01:00:10.630121441 +0200 Birth: - $ rm -v WAS-LINK <--= note no OS objection to removing renamed old LINK removed 'WAS-LINK' $ stat *LINK* File: LINK -> NEW-TARGET Size: 10 Blocks: 0 IO Block: 4096 symbolic link Device: fe00h/65024d Inode: 19401638 Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 1000/ bokr) Gid: ( 1000/ bokr) Access: 2022-06-04 01:00:10.630121441 +0200 Modify: 2022-06-04 01:00:10.630121441 +0200 Change: 2022-06-04 01:00:10.630121441 +0200 Birth: - $ --8<---------------cut here---------------end--------------->8--- I'm guessing the inode rewrite involved in mv -v LINK WAS-LINK should be atomic? Maybe some kernels have to struggle without good hardware support, but still atomic? Maybe a kernel insider will chime in? HTH some way. -- Regards, Bengt Richter