Received: (at 50878) by debbugs.gnu.org; 29 Sep 2021 16:03:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 29 12:03:26 2021 Received: from localhost ([127.0.0.1]:49963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mVc3K-0004vY-JJ for submit <at> debbugs.gnu.org; Wed, 29 Sep 2021 12:03:26 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:64839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <attila@HIDDEN>) id 1mVc3F-0004vE-V3 for 50878 <at> debbugs.gnu.org; Wed, 29 Sep 2021 12:03:25 -0400 Date: Wed, 29 Sep 2021 16:03:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail2; t=1632931394; bh=HvgA87kGByUcCLym+9+hwuv/UXyhLP75+WqcyF5tHZo=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=uo6olleD9hJxN4azPzocbKGNsXzQu6XQbYx6AWtwGTc18BT1zQ+NjTBjWSNV1R0GE CtMFBQ/Cz5xlRD64YMIBC3m2taQ2e7UYaHldSwkR22l8MJ0D80EwX3hAoBSuK0vZna CnMVkH/7k/H2bUxEBadFMZlpQJx8nB7sgKoH2lBpIE88q8coQkKBaTUqJm3OcK0sQ9 /Ny09Y3RJjUC1NfQdMRyAYsxd7vxVJhOwwl65vbB/JjnhbAeHKxgCpGAg2JMG2K/8A OgPlHgqPAeK3FpOdwrjyqdA2c1SE1vGk9iTmLOH8ABmjM+1mAs4vfEQbK9Vm9RiVZn h5+18nKI1eoUA== To: Maxime Devos <maximedevos@HIDDEN> From: Attila Lendvai <attila@HIDDEN> Subject: Re: [bug#50878] [PATCH] union: Resolve collisions by stable-sort'ing them. Message-ID: <9gdtvXBJqCfaLCQswTjsN95-pmgfMzqlELlgJEH0o2n_WyWE8LTncnQCIMTEnjFiKO1gKSBMukitcmbQv5FNWRVUc6PLbLBIdQDype7SDLk=@lendvai.name> In-Reply-To: <530e2ad39a865b57f4a0049e862af0d23ac4c592.camel@HIDDEN> References: <20210928214044.437-1-attila@HIDDEN> <530e2ad39a865b57f4a0049e862af0d23ac4c592.camel@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50878 Cc: 50878 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Attila Lendvai <attila@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > SRFI-43 is in Guile since Guile 2.0.10, according to Guile's NEWS. > The bootstrap guile is older: > > $(guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)')/bin/gui= le --version > > guile (GNU Guile) 2.0.9 thank you for the analysis! is it easy and desirable to upgrade it to 2.0.10 or newer? shall i try to do it, or advocate for it if it's not trivial, by e.g. opening an issue? - attila PGP:=C2=A05D5F 45C7 DFCD 0A39
guix-patches@HIDDEN:bug#50878; Package guix-patches.
Full text available.Received: (at 50878) by debbugs.gnu.org; 29 Sep 2021 13:48:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 29 09:48:24 2021 Received: from localhost ([127.0.0.1]:48092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mVZwe-0002hI-9K for submit <at> debbugs.gnu.org; Wed, 29 Sep 2021 09:48:24 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:39744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maximedevos@HIDDEN>) id 1mVZwa-0002h7-Je for 50878 <at> debbugs.gnu.org; Wed, 29 Sep 2021 09:48:22 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by xavier.telenet-ops.be with bizsmtp id zpoJ250050mfAB401poJ6v; Wed, 29 Sep 2021 15:48:18 +0200 Message-ID: <530e2ad39a865b57f4a0049e862af0d23ac4c592.camel@HIDDEN> Subject: Re: [bug#50878] [PATCH] union: Resolve collisions by stable-sort'ing them. From: Maxime Devos <maximedevos@HIDDEN> To: Attila Lendvai <attila@HIDDEN>, 50878 <at> debbugs.gnu.org Date: Wed, 29 Sep 2021 15:48:00 +0200 In-Reply-To: <20210928214044.437-1-attila@HIDDEN> References: <20210928214044.437-1-attila@HIDDEN> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-WosXeC3PWMLCGJ8a82mj" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1632923298; bh=S7QhvUaZ5zUo3LmHKNo0wvMJOk3S9qcEkp2Tj4ZN3jM=; h=Subject:From:To:Date:In-Reply-To:References; b=pBeecuH2V/cuL5fnlmiwQpHnFTDhe3I/EP4GNkqjS1Pbhueewc8tmIJUsN2tvCxK2 F2KY+9IHYMnXYI9ZliliTjRu8YAAKfwh2gIehqR41fRTZAQjN4uJ1mmCkNlbY5ipk+ aRiJX8fMVyygxfzm2et9Sr9IZMjcgToSJac3/4GT0s294BW/ZYScouWgJzmdqN1A+b yWBf/8IXpqfMcv1y/avVla2amD0OYRGSgqFGOz7mkU2P8DbbwZzNE5l5PniRnf7/Mc tfwh+A7xz02LxR88m2NlY3epCnjriyxGLInu5OO4cQ+5+HX0NgqR8U5TK0SBtFksrL 9fdic1F+kr2dg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 50878 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) --=-WosXeC3PWMLCGJ8a82mj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attila Lendvai schreef op di 28-09-2021 om 23:40 [+0200]: > * guix/build/union.scm (resolve-collision/alphanumeric-last): New functio= n. > (warn-about-collision): Renamed to default-collision-resolver. > --- >=20 > this should work, but i cannot test it, because srfi-43 seems not to be > available on the build side: >=20 > unpacking bootstrap Guile to '/home/alendvai/workspace/guix/guix/test-tmp= /store/qky0jf68rr7pnsvmhj0ay42rzh4qk6r9-guile-bootstrap-2.0'... > [...] output without sfri-43.go >=20 > and then unsurprisingly: "no code for module (srfi srfi-43)" SRFI-43 is in Guile since Guile 2.0.10, according to Guile's NEWS. The bootstrap guile is older: $(guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)')/bin/guile= --version guile (GNU Guile) 2.0.9 [...] Greetings, Maxime. --=-WosXeC3PWMLCGJ8a82mj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYVRukRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7poCAQDxE3F4TznHt8S4PHyqKy7V51Zu gQtLUeR/EZB7Z2gb5QEApzobTsrjrUXE+4/c/ottb9IKTu9xLda0X1gSctJNfQ8= =xEFr -----END PGP SIGNATURE----- --=-WosXeC3PWMLCGJ8a82mj--
guix-patches@HIDDEN:bug#50878; Package guix-patches.
Full text available.
Received: (at submit) by debbugs.gnu.org; 28 Sep 2021 21:44:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 28 17:44:26 2021
Received: from localhost ([127.0.0.1]:47217 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1mVKtm-00015P-4U
for submit <at> debbugs.gnu.org; Tue, 28 Sep 2021 17:44:26 -0400
Received: from lists.gnu.org ([209.51.188.17]:32802)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <attila.lendvai@HIDDEN>) id 1mVKtj-00015G-IO
for submit <at> debbugs.gnu.org; Tue, 28 Sep 2021 17:44:24 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43598)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <attila.lendvai@HIDDEN>)
id 1mVKtj-0005F8-Ar
for guix-patches@HIDDEN; Tue, 28 Sep 2021 17:44:23 -0400
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:38762)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <attila.lendvai@HIDDEN>)
id 1mVKth-00035M-Oh
for guix-patches@HIDDEN; Tue, 28 Sep 2021 17:44:23 -0400
Received: by mail-ed1-x529.google.com with SMTP id dj4so561465edb.5
for <guix-patches@HIDDEN>; Tue, 28 Sep 2021 14:44:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=sender:from:to:cc:subject:date:message-id:mime-version
:content-transfer-encoding;
bh=Qr5R52rHMqO4ZCWXfxGqaXGgIsdYxTsy6aODkPEG9fc=;
b=aVSdrgDC29acA5/eux1+btEJ5MyCh3UVHTnnpdc9vqpnV8YNeV0s7C6VOh2sb8fXeu
TLuZb92vb1Yk5akxeXWhyHpcX5dEGc7JKvHKgaF92ikgi8DkJZTEKS8sXBHe30adDGrz
ZWN4O5mygryqP7eNMG3JV/ixxGnaOZsMWvHyGifBnr5HrQ41C+dW028wMbdm+zRk0CYs
+RIE/5MPh5LsrX8CZBkrjZR+YYnN3breIOIUgeOgYBJRzzyAx+R11Y97yKzAxMaxCOQ2
dFOr7JpEEMznmNKmheaLm0PSeZHPwpUnrxILH6vOvD19YDxYI1l7+uUCj0vzhkBaajq+
ZujQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
:mime-version:content-transfer-encoding;
bh=Qr5R52rHMqO4ZCWXfxGqaXGgIsdYxTsy6aODkPEG9fc=;
b=C8baJs8p5WC9A/UB6v+3CV3aWLo1T/P4m11CY0axb/6gikj9Nkx6T5qEH/YbzE0YnL
Q/Y0MhpEoZm9LHkYon+tYfKW1Bm0dzGXYrS6dZ5nOG5xW6muT6LZWAQDtoWEIFZidC42
MoLUZN4ZSggqUxDPOtCknYh4Ynfq3WKTYQev9i1SSekIp+SvtuChqnUnXwG4BTweTG7s
KjGn4F29+uDzrOSmMLaxAAh9YNu76HY4sKTHKyQYRFvTbs4QQYW69Na0mooQfp+OwynT
Zz5Mf5ZVsqfz3OPQ/MThAZrJ5qf2MKOCcQ9MP/fLjXQWyF0RMBg3riFSq4Rwyd5qM+DX
eQCA==
X-Gm-Message-State: AOAM532vC39syKBehrAwVWIdhirSRsAhgccwAw12gop5ewGKDC//2l5P
sO4iK+bMoGrSaJcGfveUzAYu+E86Pzo=
X-Google-Smtp-Source: ABdhPJxDuE4qnt4HAybDm/dde6TmTyfexO+3SdrRzce06iKM8wois9DODJVrrKsci1siVqINrFR8gg==
X-Received: by 2002:a50:d8c2:: with SMTP id y2mr10334092edj.360.1632865459410;
Tue, 28 Sep 2021 14:44:19 -0700 (PDT)
Received: from lelap.lan (catv-213-222-131-28.catv.broadband.hu.
[213.222.131.28])
by smtp.gmail.com with ESMTPSA id c11sm173913edk.68.2021.09.28.14.44.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 28 Sep 2021 14:44:18 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] union: Resolve collisions by stable-sort'ing them.
Date: Tue, 28 Sep 2021 23:40:45 +0200
Message-Id: <20210928214044.437-1-attila@HIDDEN>
X-Mailer: git-send-email 2.33.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::529;
envelope-from=attila.lendvai@HIDDEN; helo=mail-ed1-x529.google.com
X-Spam_score_int: -14
X-Spam_score: -1.5
X-Spam_bar: -
X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: submit
Cc: Attila Lendvai <attila@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)
* guix/build/union.scm (resolve-collision/alphanumeric-last): New function.
(warn-about-collision): Renamed to default-collision-resolver.
---
this should work, but i cannot test it, because srfi-43 seems not to be
available on the build side:
unpacking bootstrap Guile to '/home/alendvai/workspace/guix/guix/test-tmp/store/qky0jf68rr7pnsvmhj0ay42rzh4qk6r9-guile-bootstrap-2.0'...
[...] output without sfri-43.go
and then unsurprisingly: "no code for module (srfi srfi-43)"
is tis only a peculiarity of the test environment?
can you please advise how to proceed?
guix/build/union.scm | 26 ++++++++++++++++++++------
guix/gexp.scm | 2 +-
tests/union.scm | 9 +++++++++
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/guix/build/union.scm b/guix/build/union.scm
index 961ac3298b..747902ec6c 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -23,11 +23,12 @@
#:use-module (ice-9 format)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-43)
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:export (union-build
- warn-about-collision
+ default-collision-resolver
relative-file-name
symlink-relative))
@@ -102,10 +103,23 @@ identical, #f otherwise."
;; applications via 'glib-or-gtk-build-system'.
'("icon-theme.cache" "gschemas.compiled"))
-(define (warn-about-collision files)
- "Handle the collision among FILES by emitting a warning and choosing the
-first one of THEM."
- (let ((file (first files)))
+(define (resolve-collision/alphanumeric-last files)
+ ;; Let's do a stable-sort at least, so that multiple foo-1.2.3/bin/foo
+ ;; variants will predictably resolve to the highest versioned one.
+ (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))))
+
+(define (default-collision-resolver files)
+ (let ((file (resolve-collision/alphanumeric-last files)))
(unless (member (basename file) %harmless-collisions)
(format (current-error-port)
"~%warning: collision encountered:~%~{ ~a~%~}"
@@ -117,7 +131,7 @@ first one of THEM."
#:key (log-port (current-error-port))
(create-all-directories? #f)
(symlink symlink)
- (resolve-collision warn-about-collision))
+ (resolve-collision default-collision-resolver))
"Build in the OUTPUT directory a symlink tree that is the union of all the
INPUTS, using SYMLINK to create symlinks. As a special case, if
CREATE-ALL-DIRECTORIES?, creates the subdirectories in the output directory to
diff --git a/guix/gexp.scm b/guix/gexp.scm
index f3d278b3e6..32e8748443 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1983,7 +1983,7 @@ This yields an 'etc' directory containing these two files."
(define* (directory-union name things
#:key (copy? #f) (quiet? #f)
- (resolve-collision 'warn-about-collision))
+ (resolve-collision 'default-collision-resolver))
"Return a directory that is the union of THINGS, where THINGS is a list of
file-like objects denoting directories. For example:
diff --git a/tests/union.scm b/tests/union.scm
index a8387edf42..cbf8840793 100644
--- a/tests/union.scm
+++ b/tests/union.scm
@@ -204,4 +204,13 @@
("/a/b" "/a/b/c/d" => "c/d")
("/a/b/c" "/a/d/e/f" => "../../d/e/f")))
+(test-assert "resolve-collision/alphanumeric-last sorts alphanumerically"
+ (string=
+ ((@@ (guix build union) resolve-collision/alphanumeric-last)
+ (list "/gnu/store/c0000000000000000000000000000000-idris-0.0.0/bin/idris"
+ "/gnu/store/60000000000000000000000000000000-idris-2.0.0/bin/idris"
+ "/gnu/store/z0000000000000000000000000000000-idris-1.3.5/bin/idris"
+ "/gnu/store/00000000000000000000000000000000-idris-1.3.3/bin/idris"))
+ "/gnu/store/60000000000000000000000000000000-idris-2.0.0/bin/idris"))
+
(test-end)
--
2.33.0
Attila Lendvai <attila@HIDDEN>:guix-patches@HIDDEN.
Full text available.guix-patches@HIDDEN:bug#50878; Package guix-patches.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.