From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mBi3GnRxVWE7LQEAgWs5BA (envelope-from ) for ; Thu, 30 Sep 2021 10:12:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iCBfFnRxVWEvfwAAB5/wlQ (envelope-from ) for ; Thu, 30 Sep 2021 08:12:36 +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 9D86B4670 for ; Thu, 30 Sep 2021 10:12:35 +0200 (CEST) Received: from localhost ([::1]:33746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVrBB-00026u-3J for larch@yhetil.org; Thu, 30 Sep 2021 04:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVrAg-0001ou-T5 for guix-patches@gnu.org; Thu, 30 Sep 2021 04:12:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVrAg-0000RS-Kh for guix-patches@gnu.org; Thu, 30 Sep 2021 04:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mVrAg-0005rp-AC for guix-patches@gnu.org; Thu, 30 Sep 2021 04:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50878] [PATCH] union: Resolve collisions by stable-sort'ing them. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Sep 2021 08:12: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: Liliana Marie Prikler Cc: 50878@debbugs.gnu.org Received: via spool by 50878-submit@debbugs.gnu.org id=B50878.163298946822485 (code B ref 50878); Thu, 30 Sep 2021 08:12:02 +0000 Received: (at 50878) by debbugs.gnu.org; 30 Sep 2021 08:11:08 +0000 Received: from localhost ([127.0.0.1]:51392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVr9o-0005qb-HK for submit@debbugs.gnu.org; Thu, 30 Sep 2021 04:11:08 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]:51442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVr9j-0005q5-RD for 50878@debbugs.gnu.org; Thu, 30 Sep 2021 04:11:08 -0400 Date: Thu, 30 Sep 2021 08:10:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail2; t=1632989453; bh=IgR4Xdxn9r8J2ggAbxf6UomV9BVRdHITHMDsyhpKxoU=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=AL1Eh3atoNKMEv9OlSrE2MSbbip1rrbturLy2Gw7Epv/NSDz2I1mNOjl4HxfjYPaa S2IMKd2x5mbhJ252tB8uaH+XImwZbbtJmAkFLjB87DNi/TUAgieEvDg1WlZbCb+ydM qkxmwgipoLYPNJqM3JZBbb6/3OSPelQXIdqRKSFogrT5bGbhiGqsNuTaCyGcXlxpiF udWlI6HwFMD1oA8yqlR70bHLatqAEzma48jRxc2ikHCLzbYCYgbDnIl0IRgXP3Ae7N ePQKlb7QLPDy8KZQqC1MckWJyAEbUbmpkoShnhkRu+ZVvyqbJzi0b6BC0u3HvC6NI5 VJd3CAzuZyJVA== From: Attila Lendvai Message-ID: In-Reply-To: <57f1435fd83da8c0e0acaef64d5f08e4ca7b3404.camel@gmail.com> References: <20210928214044.437-1-attila@lendvai.name> <57f1435fd83da8c0e0acaef64d5f08e4ca7b3404.camel@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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Attila Lendvai 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=1632989556; h=from:from:sender:sender:reply-to: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=IgR4Xdxn9r8J2ggAbxf6UomV9BVRdHITHMDsyhpKxoU=; b=rvcbUw4LbqV6o8sExL3i76KHqsQrTRj73ZJOjA4gyMVdsWGl9unjXheKTkjkIv8OuryEFS US00+sLjtctAW0QJTBePuuDBj57Aj3jN4Yb9DMzzR6BFNhgl6q0aohAZ3R05Sd5BUt+NAw 6sBB/I8eqREBzJxSDjEvmCBMqtRcKQZ21m7g3t6mJCiniXqj4q7yDG/JW2G1xOnd6lYzB7 o5Dt7RITguu++OEZ4GnITMevV6yPUuXBh2g6ZQotIXd1U/S3UdjQ+ApXaDEZgzZL+8Wepj Tg7ZE/SOBzv00oTKdriflKFQP+c8KkRQ9YZDze+A/vxwA/hBVj5g8ZeDweK2pw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632989556; a=rsa-sha256; cv=none; b=FuPpr1C7Sc4qUn86RKjt04UnvLKq3z+CvH8eHJzSJKlPjTY3oKhBx4Lk/slJ827myGhCoK Fel7Ubo7eO/WbZ3ewy2XuoghzV8tihRQ3TrNTAio74hd1TvpCX8ZugvH4uyaAtP6HRfZUl qQsFQRaRpaQiAnpcb/VviXG+8XczlPXCbBuTb+F9vPe5DokCR8BLeqYNUcGBhhQjR5G0MI G7YpuTWVkGff3aRnPT3WX4lJKbuET/Ug5pd3KiOVwFLjlFDq6EubzKZKaivtVHjyzqFxTJ 0ZtK41bqPiKertOPXchZK6db3tnH9/jES8s3qUQjrL19WS4fMEvuA5gmkNlWHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lendvai.name header.s=protonmail2 header.b=AL1Eh3at; dmarc=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.80 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lendvai.name header.s=protonmail2 header.b=AL1Eh3at; dmarc=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: 9D86B4670 X-Spam-Score: -1.80 X-Migadu-Scanner: scn1.migadu.com X-TUID: yD/7/+tOy7qW > > - (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. > 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? 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. - attila PGP:=C2=A05D5F 45C7 DFCD 0A39