From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp0 ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id wPjVL43ulGFkegEAgWs5BA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 17 Nov 2021 12:59:09 +0100
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp0 with LMTPS
	id AMKoK43ulGF3MwAA1q6Kng
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 17 Nov 2021 11:59:09 +0000
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 47BFAA79F
	for <larch@yhetil.org>; Wed, 17 Nov 2021 12:59:09 +0100 (CET)
Received: from localhost ([::1]:39288 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	id 1mnJam-0002vD-Dd
	for larch@yhetil.org; Wed, 17 Nov 2021 06:59:08 -0500
Received: from eggs.gnu.org ([209.51.188.92]:44502)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1mnJaf-0002uk-Un
 for guix-patches@gnu.org; Wed, 17 Nov 2021 06:59:01 -0500
Received: from debbugs.gnu.org ([209.51.188.43]:48816)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1mnJaf-0006xW-L9
 for guix-patches@gnu.org; Wed, 17 Nov 2021 06:59:01 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1mnJaf-0003sS-I3
 for guix-patches@gnu.org; Wed, 17 Nov 2021 06:59:01 -0500
X-Loop: help-debbugs@gnu.org
Subject: [bug#51427] [PATCH] nix: libstore: Do not remove unused links when
 deleting specific items.
Resent-From: zimoun <zimon.toutoune@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Wed, 17 Nov 2021 11:59:01 +0000
Resent-Message-ID: <handler.51427.B51427.163715033814895@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 51427
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Cc: 51427@debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@gmail.com>,
 Maxim Cournoyer <maxim.cournoyer@gmail.com>
Received: via spool by 51427-submit@debbugs.gnu.org id=B51427.163715033814895
 (code B ref 51427); Wed, 17 Nov 2021 11:59:01 +0000
Received: (at 51427) by debbugs.gnu.org; 17 Nov 2021 11:58:58 +0000
Received: from localhost ([127.0.0.1]:60362 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1mnJac-0003sB-JN
 for submit@debbugs.gnu.org; Wed, 17 Nov 2021 06:58:58 -0500
Received: from mail-wr1-f53.google.com ([209.85.221.53]:46698)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@gmail.com>) id 1mnJaa-0003rs-Ng
 for 51427@debbugs.gnu.org; Wed, 17 Nov 2021 06:58:57 -0500
Received: by mail-wr1-f53.google.com with SMTP id u1so4119942wru.13
 for <51427@debbugs.gnu.org>; Wed, 17 Nov 2021 03:58:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version:content-transfer-encoding;
 bh=2jRpBQul3Xzshxmjc1Hg0hj0NgrZmXAOKWVANS+TntQ=;
 b=OWzPFFaC+QOUy0qY7hqcVRUbpks5Cnv7I1/PZxR98/In8kEEk8290jL4Se6D4Hkzyn
 thDqpMeKf3G791I+iaPwta6z5wV311JsgV+xtL2yfvnucZB/w7b5Ngdcp1QoCnNiwgCG
 pL4fkcVlZNTDzo4aqNPuYkHWefDvhvvi7QpnQHJdX49sZljv2cEnA866sjCxh+0NfltA
 OM9c7jbeUfoCv2qu5kYB8/OUbvFjWl8BW73XdCASpwGjHGDGFutNimSrfU/Rf91GgPtJ
 Yuy4kajD4HRvA//V/eClpocEUrvMegr+i5VhiSa7vGSD0WvHfOY8wH1e2coRG/c6OONS
 tcTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version:content-transfer-encoding;
 bh=2jRpBQul3Xzshxmjc1Hg0hj0NgrZmXAOKWVANS+TntQ=;
 b=TlRmiajUCajTu6+8BKiuMLQ1648sVLLuAb97UeNDPra9GMP5NGUhXDqrhVq36jG2e8
 EYXznn1kgbkTcugNMmvqlTtsILOEbbMjYPWvlW3DkW0LmEJ/E+HGaB0MIW7A9GCBvM83
 IOTh8b7TTqSHElYDFBsU/1sogITo7nXQhBt54TQaVAVo2/MgmHnhUQZYlceV/w5wLjaV
 ec0Uy7T1B9t5+g4pOU0L8PbbRKaZLJlfWbVzkHJKLAcBf9a0hO4gTB9hO8i9xScuuKbN
 pZMik1V8eetr2wR3f2eSa11BbtUGd+hPmdHTMmhA/SjRze6DjBo3dqG/obPoWG+q2jCl
 Vegg==
X-Gm-Message-State: AOAM531SASHL9oHlI9n62oTp2wt/CAXvIasqQkUdbKaJnLIr/HkZu5uY
 +yzZMDsWg+OLjs9l6Gmoff4=
X-Google-Smtp-Source: ABdhPJxysU9QxIfCVlCAfkPpgIadN43xrEVwc3yqPVAu2w2nAcl6AcTrc35Eboarex3j/yLEeKEZHQ==
X-Received: by 2002:adf:e882:: with SMTP id d2mr19618998wrm.389.1637150330718; 
 Wed, 17 Nov 2021 03:58:50 -0800 (PST)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id h204sm5753278wmh.33.2021.11.17.03.58.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 17 Nov 2021 03:58:50 -0800 (PST)
From: zimoun <zimon.toutoune@gmail.com>
In-Reply-To: <871r3f2j7y.fsf@gnu.org>
References: <20211027034918.4591-1-maxim.cournoyer@gmail.com>
 <87o8795j61.fsf@gnu.org>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@gmail.com>
 <87h7cxp9tl.fsf@gnu.org> <87sfwg7w9z.fsf@gmail.com>
 <87ee7tmdbd.fsf@gnu.org> <86k0hhnqss.fsf@gmail.com>
 <871r3f2j7y.fsf@gnu.org>
Date: Wed, 17 Nov 2021 12:49:09 +0100
Message-ID: <867dd7roi2.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1637150349;
	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:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=2jRpBQul3Xzshxmjc1Hg0hj0NgrZmXAOKWVANS+TntQ=;
	b=BzuUe8uMG3H2IwMGqUcE3o8VIi+gi3kcz+P9aajZk4/fDs7Xv4TOWCB0fR8shVXZe7T1Zn
	sDwjpqO1XJ4YnRqa3ZXIsx10LrC3p8V72xX4ZSmC4jxClb3Rjw3EdX/hWuXfNk68lBNjq2
	RQcNNSRT5gnKHdchveiFC+eVZ0a5k8sJk6w8PKRmA8vUECCtzXVqEmVwKx05MOrYq94vUp
	TiY3yqZnnbe6thmQ6LbbKz0mnblZY6dmBSmu6WUr8jhsxA16q1xWgPp0sPKjqg7xhARiU1
	3rOsabK0Wnc6c8XGI5BDMI1tWMrVFW+Tbsy9zRPdG7MEPzHwxfvThfg1OqzutQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637150349; a=rsa-sha256; cv=none;
	b=SFECcpDwQppcMjpadycVtj7mm4ur6zdNjv9QR3T8G3FbDDqBk//g+iK+Uobfdu6ioCNmql
	4IE8tn3ERpzAvUq3CgAacBcA/Vef5/iNd6CyvKfxMyDRmKvldnQVcuAA810zD15mFIe/NF
	AqnoU1iHJX5v6AjVPdtY9PMUj/a+XFGMDEi/H5ALUf5cNz9ycX8i7+znjDh6gP4oHAQ5C0
	hCtXykbZHHIq9Qp6psnD+bCw/0nf62CaSmt4tshRGdHXHqAbepMs6rvjXJXySef+kifTdi
	8xUYOIwxBSleMJAFVTBcr0WrNq89puJNhwV43y+FvY78D3RyRzj2qWZ5EbnGCw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=OWzPFFaC;
	dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none);
	spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org
X-Migadu-Spam-Score: -0.25
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=OWzPFFaC;
	dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none);
	spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org
X-Migadu-Queue-Id: 47BFAA79F
X-Spam-Score: -0.25
X-Migadu-Scanner: scn1.migadu.com
X-TUID: Q4J+hRkmN32A

Hi Ludo,

On Wed, 17 Nov 2021 at 11:02, Ludovic Court=C3=A8s <ludo@gnu.org> wrote:
> zimoun <zimon.toutoune@gmail.com> skribis:
>
>> I have not checked the code, maybe I should start by that. ;-) Is it not
>> possible to simply skip the deleting phase when the option =E2=80=99-D=
=E2=80=99 is used?
>
> No; like I wrote, it would have the effect of not deleting anything:

After giving a look at the code, yeah it is not so simple. :-)


>   https://issues.guix.gnu.org/51427#1
>
> Needs more thought=E2=80=A6

The logic is complicated, thus adding this guard=E2=80=A6

--8<---------------cut here---------------start------------->8---
    if (options.maxFreed > 0) {=20=20=20=20=20=20
      /* Clean up the links directory. */
      if (options.action =3D=3D GCOptions::gcDeleteDead || options.action =
=3D=3D GCOptions::gcDeleteSpecific) {
        printMsg(lvlError, format("deleting unused links..."));
        removeUnusedLinks(state);
      }=20=20=20=20=20=20
    }
--8<---------------cut here---------------end--------------->8---

=E2=80=A6is probably dumb.  From my understanding, it should bypass the pha=
se
=E2=80=99removeUnusedLinks=E2=80=99 when using =E2=80=9Cguix gc -D=E2=80=9D=
.  Well, I have not tested
it.


Cheers,
simon