From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +l8YGQJZfmFM7QAAgWs5BA (envelope-from ) for ; Sun, 31 Oct 2021 09:51:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CFcZFAJZfmHGQAAAbx9fmQ (envelope-from ) for ; Sun, 31 Oct 2021 08:51:14 +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 DC55AD4EA for ; Sun, 31 Oct 2021 09:51:13 +0100 (CET) Received: from localhost ([::1]:46110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mh6Yb-0003TU-36 for larch@yhetil.org; Sun, 31 Oct 2021 04:51:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mh6YQ-0003T5-SL for guix-patches@gnu.org; Sun, 31 Oct 2021 04:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mh6YQ-0007ed-IU for guix-patches@gnu.org; Sun, 31 Oct 2021 04:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mh6YQ-0007mm-DJ for guix-patches@gnu.org; Sun, 31 Oct 2021 04:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51427] [PATCH] nix: libstore: Do not remove unused links when deleting specific items. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Oct 2021 08:51:02 +0000 Resent-Message-ID: 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?= , Maxim Cournoyer Cc: 51427@debbugs.gnu.org Received: via spool by 51427-submit@debbugs.gnu.org id=B51427.163567022529882 (code B ref 51427); Sun, 31 Oct 2021 08:51:02 +0000 Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 08:50:25 +0000 Received: from localhost ([127.0.0.1]:58941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mh6Xp-0007lu-7p for submit@debbugs.gnu.org; Sun, 31 Oct 2021 04:50:25 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mh6Xm-0007le-VR for 51427@debbugs.gnu.org; Sun, 31 Oct 2021 04:50:23 -0400 Received: by mail-wr1-f67.google.com with SMTP id i5so15944787wrb.2 for <51427@debbugs.gnu.org>; Sun, 31 Oct 2021 01:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=x6DMZ0vYqLdsWqSNytgshtEZMdz0DaxdFAkpwKVaiTs=; b=RQCuHlPRDBw48s79kjeS62/4AE3h2Q0rqc5cebuEA8/pEcN40jahX+5cJ/mlZNtkFY BFjLXC2aF+UzDhPVNnfpzeZ0AHwG/Pp5Cp1+ActnkaED4aApny81rSKNAcyYsItGd+H4 mtmAMjzsdkiaACIaIBiu4l2oBC+cOEsiU3ZIsCJYHOyOYi0KRQKvX10BTm6B2p+fviQ6 bGKnIgne1z9LrZaA+pzvif2kVG3LUQvWVPMgCkelPecZdyOVAOkWvwZKuJc09+/AT+Zs emzlQ7+uO8betxayIInUoosuRSfHiphtoaKQSh9YJkw3pLvWhFwEFMqATzeJlP+Ion/q 0M2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=x6DMZ0vYqLdsWqSNytgshtEZMdz0DaxdFAkpwKVaiTs=; b=nrwT8eMhYrwgf5WITKqYSAgxKTTi+kA3/mWCUOqbtNhiRowAb7MS3bxJktM0dly0ZX kvu5rfl98lBaA7FEgiePLUnTFCj47YTaYopAN8Us5S5dEEgGn/0MCT3vVW/EPpnuxgym EVbO5Hrz0DS5y1IbrI7WCtYjgx793p4rrxnmFKWrqDDmnX+x1BMAjKg40QZyo3R1E72q ihnAW+/PBVCEhlYtepHpd6EMaxwR1iyQJoo5loJPaFgIC+oNxWim/FkSUUoo+GCWjBSp PMgXXL2e0BmBo17425Q57gRlgFlZcKOxJeDaVuMO/8m9eF1Mu2jKvcHN/OnFW5W1O+Ie ZPOA== X-Gm-Message-State: AOAM533qKTY+dKBVcDX6QVhTusAxMEWz1uMRznD/XHeXxv2ri4DufV7J ZM829IsDDB6awEcgR5I+34c= X-Google-Smtp-Source: ABdhPJywHONltLbg5zbHgqBjRVMh29TqGskGxaJMglftCOnQTmjuiqA+5J0DFYUefv2+VbPdGW/Cqw== X-Received: by 2002:adf:a30c:: with SMTP id c12mr29310988wrb.366.1635670216941; Sun, 31 Oct 2021 01:50:16 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id v4sm10310463wrs.86.2021.10.31.01.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 01:50:16 -0700 (PDT) Message-ID: <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@gmail.com> From: Liliana Marie Prikler Date: Sun, 31 Oct 2021 09:50:15 +0100 In-Reply-To: <87o8795j61.fsf@gnu.org> References: <20211027034918.4591-1-maxim.cournoyer@gmail.com> <87o8795j61.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635670273; 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=x6DMZ0vYqLdsWqSNytgshtEZMdz0DaxdFAkpwKVaiTs=; b=mYdylnT6gg9zdTdppgLinggWo9xsx31mPQPNAFlH9ewXvY2KxgkczjHZl578NLHPXNbVBY poogEIzjpBe7Cigo7luddlHxRYtxzvRG0hxXzaQz69Kkdfbb7Cd8wwZ9AX7ab2BX/tdMLf /woMcmz8u1ljubSpOifIWl3qo/d3F6J1o4sWGKKf8Vx/DFt+UjdNFcHrWSET1tjqf5+pLA ItwDT5ZjjeVgq18608ao7zOuODElIVEAM6UyWRbhoBDu6oZKp1+XgKyy9YM0/xRnmHtlSh esaR/O/RppZn0AWBx+8yXBDv6ibFzZ/qfB6FMTDAsGrQXYahzGLnagyN/fIzQw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635670273; a=rsa-sha256; cv=none; b=U4XQRPu7g3rt/L7OBzzGnEXuFG38bFCzxxDYRwkConVu+NrXbWjzUf9ssXV4ns7EQylrV6 Zp1vOFljiIpL7EXy8xz7av3y9Fm1XbZw3M5nZUpfsgX0ohD6KwwQhF6Srqv37i7C7SZhCh zkj+EpSQfNVrRU7mzGkBs0oJ/daL2KILgMbQw7F/GJrfPOChViwko9ui0/0N2cR4UkvtNq kwmgAMY+trmA+zHryUwobtbej2drEZNv4BeVPrj9VHAqbXIxsZEH1u3GWqPQfW/fsbGaY1 6BssPA0hXv12JYF9z72VrEL51BN2qjVwQtti65X0bpfy1ZTKcXbXwvszql0LpQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RQCuHlPR; 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: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RQCuHlPR; 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: DC55AD4EA X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: yEb7VGP16rkV Hi, Am Donnerstag, den 28.10.2021, 16:16 +0200 schrieb Ludovic Courtès: > Hi, > > Maxim Cournoyer skribis: > > > Deleting unused links can be a very costly operation, especially on > > rotative hard drives. As removing single store items is often used > > for experimentation rather than for cleaning purposes, this change > > allows it to run without the links cleanup. > > > > * nix/libstore/gc.cc (LocalStore::collectGarbage): Do not clean up > > links when > > the specified action is GCOptions::gcDeleteSpecific. > > --- > > nix/libstore/gc.cc | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc > > index e1d0765154..7d872d8cc1 100644 > > --- a/nix/libstore/gc.cc > > +++ b/nix/libstore/gc.cc > > @@ -771,7 +771,7 @@ void LocalStore::collectGarbage(const GCOptions > > & options, GCResults & results) > > deleteGarbage(state, state.trashDir); > > > > /* Clean up the links directory. */ > > - if (options.action == GCOptions::gcDeleteDead || > > options.action == GCOptions::gcDeleteSpecific) { > > + if (options.action == GCOptions::gcDeleteDead) { > > I believe the effect is that ‘guix gc -D /gnu/store/…-disk-image’ > would remove nothing: /gnu/store/.links would still contain a copy of > that big disk image, so as a result, you’ve freed zero bytes. > > Am I right? I think that might be the point. As Maxim said, single items are (likely) not removed for cleaning purposes, so freeing the disk image has little effect. Plus, you could invoke it like guix gc -D dead-item dead-item live-item dead-item It would fail at live-item and then not continue to free the links of the two dead items prior. So there's a few things we could do here: 1. simply fail and have the user deal with it (including the option of doing a normal `guix gc' or `guix gc -C 1') 2. remember which paths were live and dead and always clean up the links, only reporting errors afterwards 3. add an option to explicitly check the .links directory (which defaults to true for the current things, but could also be used to clean links after a liveness check or after a do-nothing `guix gc -F'). 4. ... WDYT?