From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OMqPMTUJVmFV+AAAgWs5BA (envelope-from ) for ; Thu, 30 Sep 2021 21:00:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ECNALTUJVmH8agAA1q6Kng (envelope-from ) for ; Thu, 30 Sep 2021 19:00:05 +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 7093184B0 for ; Thu, 30 Sep 2021 21:00:05 +0200 (CEST) Received: from localhost ([::1]:58360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mW1Ho-0002tw-8o for larch@yhetil.org; Thu, 30 Sep 2021 15:00:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mW1B1-0001o5-1W for guix-patches@gnu.org; Thu, 30 Sep 2021 14:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mW1B0-0004n4-PU for guix-patches@gnu.org; Thu, 30 Sep 2021 14:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mW1B0-0002og-GK for guix-patches@gnu.org; Thu, 30 Sep 2021 14:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50878] [PATCH] union: Resolve collisions by stable-sort'ing them. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Sep 2021 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Attila Lendvai Cc: 50878@debbugs.gnu.org Received: via spool by 50878-submit@debbugs.gnu.org id=B50878.163302796810806 (code B ref 50878); Thu, 30 Sep 2021 18:53:02 +0000 Received: (at 50878) by debbugs.gnu.org; 30 Sep 2021 18:52:48 +0000 Received: from localhost ([127.0.0.1]:53993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW1Al-0002oC-4h for submit@debbugs.gnu.org; Thu, 30 Sep 2021 14:52:48 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:42966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW1Ac-0002ns-M1 for 50878@debbugs.gnu.org; Thu, 30 Sep 2021 14:52:45 -0400 Received: by mail-wm1-f68.google.com with SMTP id q127-20020a1ca785000000b0030cb71ea4d1so5088722wme.1 for <50878@debbugs.gnu.org>; Thu, 30 Sep 2021 11:52:38 -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=pJjNtnT/5UuSplnBkGR5L34KNoNlTDd97jc1nOwmIiY=; b=SyReTgiqaZ+N7RaX7i59pTmsyu6G20dD2cr/HaPgFgOgY0zZU3onhJJsUhNUlqkkyg fa/XNVewFpm5iljwaj3LzTGm27BvZ+BPEmva2RHQGVVf2d6ZM47uNPfIbgFfyrNIKr5j Fwz9OQeQ3uk1hQv3lNyYWRguA+FuCShuINEqjFT7+RoJB6uBcQPN5GF2wjQrelMJvP31 hmNOezT30K/OA4thjxAdOiUi0PNDIKuVeLdjTL8x7XtHHI6CZKq1Nv2Ef3DyJ7sMBHPt LWTcci7Dgdqth8Jk54S8BEoHQ1Ar6x4xw0VPtQA6Sl3RsDkAZsYwUlU888Wivn2bZZiJ +XdQ== 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=pJjNtnT/5UuSplnBkGR5L34KNoNlTDd97jc1nOwmIiY=; b=qDvHuY6+qoOo6aLIM7Uj20+T5DqQ7oK7R8k8m847+oNUIrPfpKNVIiJvBd/pmwqOB/ Zl7/cZrLvKuhBbIyyo3WeVMXh4a4DWFfAA+GDHEBnLwrtjdH2L2mrc+oNQQjT9Yu/N6F UYdnn00FJaXf2yfm77xdg9ErosBvd5OFjlo8LT6tZjaBkIDKm7GG85Db7xi+17zevhdv MIpjAuorF2XtsT3LXhopb6j9iy0gVPFXIUq31CDyhKkSccd+1S6LzCrYve+Rk5SLb9WQ Ts41Rgdkro+etF1Wf/8Zkz/N5exRB0BAklqAxE8pACUgcKIt3GkfXE9qgqlXYEqn4h9P 6nZQ== X-Gm-Message-State: AOAM533T60SD58pGGL+6wHq5MtNv9c+J1OVbYNNXw6UxmWNPkkDpyyRL 0oh7v07hrn9M/ac/LXrnDOo= X-Google-Smtp-Source: ABdhPJyKAILyPT36HF57MbRD3qTniu+71stM1X6dhmMaBUCx88iq8agJZSY5jIe5N1qGQHekrdBvwQ== X-Received: by 2002:a05:600c:3b87:: with SMTP id n7mr682436wms.93.1633027952786; Thu, 30 Sep 2021 11:52:32 -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 k17sm3781353wrq.7.2021.09.30.11.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 11:52:32 -0700 (PDT) Message-ID: <93c0bb40dcf98c72b896b837b8be6b06f71161bb.camel@gmail.com> From: Liliana Marie Prikler Date: Thu, 30 Sep 2021 20:52:30 +0200 In-Reply-To: References: <20210928214044.437-1-attila@lendvai.name> <57f1435fd83da8c0e0acaef64d5f08e4ca7b3404.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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=1633028405; 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=pJjNtnT/5UuSplnBkGR5L34KNoNlTDd97jc1nOwmIiY=; b=rxkffrA1AB1LGsHGYt9dq4ptZIgEUcWt+VQOvsEMTJ35U/uzp3miPX7Bbf2Jq4uJ5ZeLNr 1j0ZaLVTxm8MGuYiCRUCYtZ9pcS2Ea3UBtXaWFeT86cFR868wpul1tSjg/PowdNNR3y93Y yUvfhTOq08B0aLPdt6tZE2+mXoyABuo4u+d7vqJYLOSgGWEt9b/SHLWtUiKAT9noJ8anOp b7e2O2WiuSVzXAmzfj7CS1A0vaqrmI9N17+kdkOvRAOPxY2CE5d4jr+9pTOehCo/HknmzD UbnNGoRvFn1wKVM2teoBKGdMeqMe8f3KtSCKohfJD2yhaTnGeiBVW9VLLLNHTw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633028405; a=rsa-sha256; cv=none; b=NaQvZLIOZ86d8NLnBQ18lkq26/JZff9Qv1XmO7hWkAzkbk4cqQhKvpXa9FLbi/QWalK4o0 pREWi1o/vQPYpzuzq5+6VfsFZMkPParpWxDLetPCEoPnmbBGTYdcm7AoQfUvr2q/BvHY9k Z9a4vT7VoCygoFiRwR5YwohlfqZlQJWOIlposde8mTl/2ACOYjmaJoSwCUAWFpnq9cNN/z EwXRuMFZzHJcpLZWTNGw65VPQJQoAYydioEy9Ft+HXnwAbSL9nBPRgILQqWsXaAZxVbtNx 9twSdzbduN722gWdfGPE9x0P3oEjEGBmUwIoH+JGFTRi7lHq5KRCtfCd2DAgjw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SyReTgiq; 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.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SyReTgiq; 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: 7093184B0 X-Spam-Score: -1.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: rMkWiW36z+2R Hi Attila Am Donnerstag, den 30.09.2021, 08:10 +0000 schrieb Attila Lendvai: > > > - (let* ((original-files (list->vector files)) > > > - (count (vector-length original-files)) > > > - (stripped-files (vector-map (lambda (_ el) > > > - (strip-store-file-name > > > el)) > > > - original-files)) > > > - (indices (vector-unfold values count))) > > > > > > - (stable-sort! indices > > > - (lambda (a b) > > > - (string> (vector-ref stripped-files a) > > > - (vector-ref stripped-files b)))) > > > - (vector-ref original-files (vector-ref indices 0)))) > > > > Instead of stable-sort!-ing the indices of a vector, what about > > stable-sort!-ing (map strip-store-file-name original-files) in more > > or less one go? > > the hash also needs to be dropped from the path for sorting to be > useful, but the return value must be the full path, hence the > complexity with sorting the indices, pointing both to the full paths > and the cut parts. This thing has received some replies already to which I already dropped a comment, so I'll try not to repeat myself here. If something is still unclear, go down the sub-thread started by Maxime. > > I don't think the default collision resolver ought to sort the > > files. > > > > The rationale behind ignoring certain collisions, e.g. icon caches > > relies on the fact that Guix will use the correct files because > > they are put first in the manifest. The hooks themselves have no > > special names that could put them "always first" and profiles are > > themselves union-built. > > > > I do however support the addition of sorting methods as collision > > resolvers in general and would welcome a way of doing so for > > profiles > > pre-hook. > > please note that i almost completely lack the knowledge of the > relevant internals. > > with that in mind, do i read you right? this should add a new > exported resolver funtion, and leave the default one as it was? Yes, I think that is safer than actually overriding the default for now at least. > and use the new resolver somewhere (where?) that will affect only the > union of profiles, i.e. user visible effecs when installing software? > (because DIRECTORY-UNION is called in other contexts also?) > > thanks for the insights! i'd appreciate a bit more higher level > guidance, and then i'll resend the patch accordingly. I must admit, I'm at a loss of knowledge myself here. Perhaps someone else can jive in and tell you which union-build is done without hooks, but I fear there might also be none. For now, simply having the resolver is in my opinion enough if we don't find the right location as well. We can default it later with "first-come-first-serve" exceptions where needed. Cheers