GNU bug report logs - #71941
Broken `map-derivation' procedure

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>; dated Thu, 4 Jul 2024 15:06:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 1 Mar 2025 18:08:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 01 13:08:49 2025
Received: from localhost ([127.0.0.1]:43280 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toRGb-0006Bi-Df
	for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:49 -0500
Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46289)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1toRGW-0006AG-NH
 for 71941 <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:46 -0500
Received: by mail-wr1-x434.google.com with SMTP id
 ffacd0b85a97d-390f69f8083so873439f8f.0
 for <71941 <at> debbugs.gnu.org>; Sat, 01 Mar 2025 10:08:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740852518; x=1741457318; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=w9FPBbEhDvC+atKlK0nDdvYJyyiqEU3hB5hphvLXCDs=;
 b=k8gcgRRcvLz1BlG9TTCbMUtHHc9Mm57WGB+rhM4DMByMXhdT7uDVhPNrTVZXG866qR
 5hdMwmhwUxJA6CYAqM9/Ir51bGH7TFCnJKSS0ELlVu+wAqNsGcBCguq32AguDKxIoj/g
 h9NIIthcaW+gp5J/m+rfl1LMHGpc39Iv13hWZ0hHZrRnlS3TOXivQ7TLzWmpVi9w8sBW
 5bmlbZzuMb5aY6X8epLbjjr8FERBl/Mbcm7zczh6RbsZwOgNBBDXSVRj5++Us8g8d6Di
 Rq3zXuFLPrN4CXdU4tS01R9paSyhbv96EsNYSIcYqNVr6FhumICZ/nmtPbBpGr7mg/Jr
 uw7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740852518; x=1741457318;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=w9FPBbEhDvC+atKlK0nDdvYJyyiqEU3hB5hphvLXCDs=;
 b=hlHsOJZUTSFRjFWzi/I3SRrSwSr8ygXJNjqB2nhRXjBMkw8BigVp5cyIdWg8dTGCct
 nf3YfnLJ3/JA67Eav906P/OmJyLsDLNot8uMQ9Y/uRv0m4ds5fmLNDYKPjwjarahD8TI
 mN01SDwAiwTsXq2cDH5TGo3bznuYkygoJ15kyeYqQVNvBLQg9635vtPQjow52ufjkeii
 cMGGQ8PWppC1tTmO/+wxf7rPRu+Kgpi9v3T4INKTt8lqP2FRwVl+XTbaKHjV4S6l+lUS
 5swTGR6n59BFb1i9jIjbY5czRlmuYiJzAMOgTCxsLUhYqYAtYDbnMjhe8NB3mBtqx+Op
 l8wA==
X-Gm-Message-State: AOJu0Yy7gIthzmSSevqd+BSCL55ExJKAYoLqa+PP6YaxUQaBk2sjUW7p
 Ts2iCdu5n0kLT4zD82ZZ2MKbs51rhthw7BwevQeJkSt/nnXWEMZEF1GUOw==
X-Gm-Gg: ASbGnctKmoKqcWb9lZXs8yi3l+fTDwSJ/FsRr60VlR4mS3MxySB7KSx1s/z9pwxR1Zo
 YHByOw3Cl7v1tsUOxD6orh8j8qZwL/fLtSRb2SWpMNS2IYn8o5sMDcm72CFdWH2q1qcm3RhnYvu
 xtanrDrC2vqLHP5J73DMlW8j9lUf1DQJyTsoOhSnphrlf8QDnFxhLnyoXvn1CvRZm6ai32F0lvS
 yk679kRYcnkBrLROKlvzTBjiRPCC+RTSNwYzFn2jrai14ParNEKmnd5wBUdsJUxd7Ph/NZLngNd
 LduIJhOL8Ew6G2Zvwfd5fR6kdle3q64xGIG/Y3sUkEH9XVsBzYqnSkIjig==
X-Google-Smtp-Source: AGHT+IFNgPkUsJIoysoiHGuJ4nmjlV0gWfwDpM3FQW4Sk6iq5zW4wdFLnDNOs/62hKOmijpFOH0GYA==
X-Received: by 2002:a05:6000:1868:b0:390:de58:d7fe with SMTP id
 ffacd0b85a97d-390eca40e2bmr7212701f8f.51.1740852518199; 
 Sat, 01 Mar 2025 10:08:38 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-390e47b7c43sm8821139f8f.49.2025.03.01.10.08.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 01 Mar 2025 10:08:37 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v4 3/3] tests: Add unit test for 'map-derivation' that tests
 import modules as inputs
Date: Sat,  1 Mar 2025 19:06:10 +0100
Message-ID: <c6dfb889c586387960d040d474d8c0c838fdfad6.1740852370.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <7090bd5fec7bfd51bad65aa6eebd7aea7c9a7b7f.1740852370.git.sergio.pastorperez@HIDDEN>
References: <7090bd5fec7bfd51bad65aa6eebd7aea7c9a7b7f.1740852370.git.sergio.pastorperez@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

* tests/derivations.scm ("map-derivation, modules"): New test.

Change-Id: I4cc18a643a9b64caeea0ae16456bdbdb56ea8c4e
---
 tests/derivations.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/derivations.scm b/tests/derivations.scm
index 72ea9aa9cc..ffe921b284 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012-2024 Ludovic Courtès <ludo@HIDDEN>
+;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@
 
 (define-module (test-derivations)
   #:use-module (guix derivations)
+  #:use-module (guix gexp)
   #:use-module (guix store)
   #:use-module (guix utils)
   #:use-module ((gcrypt hash) #:prefix gcrypt:)
@@ -1483,6 +1485,29 @@ (define %coreutils
     (and (build-derivations %store (list (pk 'remapped* drv2)))
          (call-with-input-file out get-string-all))))
 
+(test-assert "map-derivation, modules"
+  (let* ((bash-drv (package-derivation %store (@ (gnu packages bash) bash)))
+         (bash-input (car (derivation-inputs bash-drv)))
+         (bash-input-drv (derivation-input-derivation bash-input))
+         (drv-with-modules (run-with-store %store
+                             (gexp->derivation "derivation-with-modules"
+                                               (with-imported-modules '((guix build utils))
+                                                 #~(begin
+                                                     (use-modules (guix build utils))
+                                                     (mkdir-p (string-append #$output
+                                                                             "/bin")))))))
+         (bash-mapped-1 (map-derivation %store bash-drv
+                                        `((,bash-input-drv . ,drv-with-modules))))
+         (bash-mapped-2 (map-derivation %store bash-mapped-1
+                                        `((,drv-with-modules . ,bash-input-drv))))
+         (is-input? (lambda (in drv)
+                      (not (null? (filter (lambda (input)
+                                            (eq? in (derivation-input-derivation input)))
+                                          (derivation-inputs drv)))))))
+    (and
+     (not (is-input? bash-input-drv bash-mapped-1))
+     (is-input? bash-input-drv bash-mapped-2))))
+
 (test-end)
 
 ;; Local Variables:
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, sergio.pastorperez@HIDDEN, ludo@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 1 Mar 2025 18:08:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 01 13:08:47 2025
Received: from localhost ([127.0.0.1]:43278 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toRGX-0006B8-Eb
	for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:47 -0500
Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:43416)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1toRGU-00069w-7t
 for 71941 <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:42 -0500
Received: by mail-wr1-x434.google.com with SMTP id
 ffacd0b85a97d-390dd35c78dso2209108f8f.1
 for <71941 <at> debbugs.gnu.org>; Sat, 01 Mar 2025 10:08:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740852516; x=1741457316; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=hxuF3c3lZwO5rc+J/f3VzS3kOkH7274n54UIBCAMm1Q=;
 b=drKjfxQfk8xCMvab06/ucXIVTArD2qAlXWXTOkaUJzhZoThQTB41V2ZIKJj/f99QhX
 GLeYRpKlbMML/X94BeHGfGiGTrAOcs14QSRPlw5qgKLpPYUhJz65DuYrXglUoNn/tYmv
 L52wUhqbmtnUxnE+Jayg609MfpDzXYP1XMX09vYC/9R6CkXL+W4YLarMeGV3oRXYRPL5
 4qrOy/O/wQZVWCLTn7CqUHMJZRwpm3SlElKFEms+H67BwoCCsScjW7MWSzxWm4K5wo/+
 ue9It2TqLThQpDcp80QjjNVQKtPM3kTu+zPCYoxKf+X9WojkAgZSBdvwa98tsNnvVAG4
 tkVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740852516; x=1741457316;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=hxuF3c3lZwO5rc+J/f3VzS3kOkH7274n54UIBCAMm1Q=;
 b=QW4UDtEUSyZeFNd3B4AfpiqI0Y+g8jGqq14pzwGMYQhfix0KV646rQx3mzxol6TDWz
 YC8eS354DQdBMKqwvHb8lZS5VpsCtSL3SzSVRBRi8CeQlhiKEttWkcFZFV62fvC51jA0
 yjKGoHSDLNPl4RFIdBtEDDyI+oetcWxX6GqyXowccQCn9p5DYzVIjN+5LbRrPsEJA+Lj
 ze/vV16k5nSq+kHInN/CHvoA7XTp0INE5FZcDEanp+iLjJrQtDjfb8mlFiwqi6K7nYnQ
 jEA+Loo/x4kI5XHj384kCIFkCZ9AIaYW3M4yVhK9pUi5ndqQOLv66boNji3tEceLvPLQ
 n2GQ==
X-Gm-Message-State: AOJu0YxfzSa05j8hSk98aKwTiG9QDybq3ch7hZeYxGr1KPdrzfAmxhTl
 ggWMKgUR9VqXDdiPd3ZQRIjeICvdf6MwIX/qOJIr8ahUlorI7Cr71wBctA==
X-Gm-Gg: ASbGncvGunrbiGaa3LW/03JYxILWn65SmicQ/v5PotprrPc9toDr2y4aeEqf3sNCInJ
 B4K2N3BVl94kbM0PWPlWeM4yBUnrLQAc3XMzBn/KUKCpn+RIVfI8thYALNKsqgJ8PodUkboUYAS
 GcFZvV8tlgFULc7xH+Vy0+jigygbqMXu9VWe8824TVWW7sdsHFLsxmaZiZWwTcqt1SFksPk3h/1
 HFVLG5pONGOJYknIxTnLqqQUF2un/w95OXlx36FFu43hs/VPm9yrUn0Fex9PqrNcjdRQyZpXMyM
 cQ49ECIqkda32Sk/ImBU49lCfdnZs2miLW2+DpcXI+NuuKQtkl0LDWKsdQ==
X-Google-Smtp-Source: AGHT+IEIU8oSGHZPkhl+r+U6MMsrC+/vptTJ8facD4zHeqd6XLa1JzARs5qBZOfA4Bpnzv6ok7LxcQ==
X-Received: by 2002:a05:6000:1fa4:b0:38d:c73d:e52c with SMTP id
 ffacd0b85a97d-390ec147c67mr6952472f8f.14.1740852515596; 
 Sat, 01 Mar 2025 10:08:35 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-390e485db77sm8822874f8f.86.2025.03.01.10.08.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 01 Mar 2025 10:08:34 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v4 2/3] guix: fix: Slow 'map-derivation' procedure
Date: Sat,  1 Mar 2025 19:06:09 +0100
Message-ID: <193c3a8ea0ce9ef0b8ecba5232129b950fba6bb8.1740852370.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <7090bd5fec7bfd51bad65aa6eebd7aea7c9a7b7f.1740852370.git.sergio.pastorperez@HIDDEN>
References: <7090bd5fec7bfd51bad65aa6eebd7aea7c9a7b7f.1740852370.git.sergio.pastorperez@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

Implement caching to speed up computation through memoization.

Change-Id: I186e2a62f6655e3b0738dd6e0f628faccd8b855e
---
 guix/derivations.scm | 103 ++++++++++++++++++++++---------------------
 1 file changed, 53 insertions(+), 50 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index d84d1a391c..9b44febdb8 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1060,56 +1060,59 @@ (define* (map-derivation store drv mapping
              (#f
               (derivation-input (loop drv) sub-drvs)))))))
 
-    (let loop ((drv drv))
-      (let* ((inputs       (map (cut rewritten-input <> loop)
-                                (derivation-inputs drv)))
-             (initial      (append-map derivation-input-output-paths
-                                       (derivation-inputs drv)))
-             (replacements (append-map input->output-paths inputs))
-
-             ;; Sources typically refer to the output directories of the
-             ;; original inputs, INITIAL.  Rewrite them by substituting
-             ;; REPLACEMENTS.
-             (sources      (map (lambda (source)
-                                  (match (vhash-assoc source mapping)
-                                    ((_ . replacement)
-                                     replacement)
-                                    (#f
-                                     (if (file-is-directory? source)
-                                         source
-                                         (substitute-file source
-                                                          initial replacements)))))
-                                (derivation-sources drv)))
-
-             ;; Now augment the lists of initials and replacements.
-             (initial      (append (derivation-sources drv) initial))
-             (replacements (append sources replacements))
-             (name         (store-path-package-name
-                            (string-drop-right (derivation-file-name drv)
-                                               4))))
-        (derivation store name
-                    (substitute (derivation-builder drv)
-                                initial replacements)
-                    (map (cut substitute <> initial replacements)
-                         (derivation-builder-arguments drv))
-                    #:system system
-                    #:env-vars (map (match-lambda
-                                     ((var . value)
-                                      `(,var
-                                        . ,(substitute value initial
-                                                       replacements))))
-                                    (derivation-builder-environment-vars drv))
-                    #:inputs (filter derivation-input? inputs)
-                    #:sources (append sources (filter string? inputs))
-                    #:outputs (derivation-output-names drv)
-                    #:hash (match (derivation-outputs drv)
-                             ((($ <derivation-output> _ algo hash))
-                              hash)
-                             (_ #f))
-                    #:hash-algo (match (derivation-outputs drv)
-                                  ((($ <derivation-output> _ algo hash))
-                                   algo)
-                                  (_ #f)))))))
+    (define loop
+      (mlambdaq (drv)
+        (let* ((inputs       (map (cut rewritten-input <> loop)
+                                  (derivation-inputs drv)))
+               (initial      (append-map derivation-input-output-paths
+                                         (derivation-inputs drv)))
+               (replacements (append-map input->output-paths inputs))
+
+               ;; Sources typically refer to the output directories of the
+               ;; original inputs, INITIAL.  Rewrite them by substituting
+               ;; REPLACEMENTS.
+               (sources      (map (lambda (source)
+                                    (match (vhash-assoc source mapping)
+                                      ((_ . replacement)
+                                       replacement)
+                                      (#f
+                                       (if (file-is-directory? source)
+                                           source
+                                           (substitute-file source
+                                                            initial replacements)))))
+                                  (derivation-sources drv)))
+
+               ;; Now augment the lists of initials and replacements.
+               (initial      (append (derivation-sources drv) initial))
+               (replacements (append sources replacements))
+               (name         (store-path-package-name
+                              (string-drop-right (derivation-file-name drv)
+                                                 4))))
+          (derivation store name
+                      (substitute (derivation-builder drv)
+                                  initial replacements)
+                      (map (cut substitute <> initial replacements)
+                           (derivation-builder-arguments drv))
+                      #:system system
+                      #:env-vars (map (match-lambda
+                                        ((var . value)
+                                         `(,var
+                                           . ,(substitute value initial
+                                                          replacements))))
+                                      (derivation-builder-environment-vars drv))
+                      #:inputs (filter derivation-input? inputs)
+                      #:sources (append sources (filter string? inputs))
+                      #:outputs (derivation-output-names drv)
+                      #:hash (match (derivation-outputs drv)
+                               ((($ <derivation-output> _ algo hash))
+                                hash)
+                               (_ #f))
+                      #:hash-algo (match (derivation-outputs drv)
+                                    ((($ <derivation-output> _ algo hash))
+                                     algo)
+                                    (_ #f))))))
+
+    (loop drv)))
 
 
 ;;;
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, sergio.pastorperez@HIDDEN, ludo@HIDDEN, guix@HIDDEN, dev@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 1 Mar 2025 18:08:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 01 13:08:42 2025
Received: from localhost ([127.0.0.1]:43273 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toRGT-0006Ab-Pt
	for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:42 -0500
Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:53420)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1toRGR-00069a-7z
 for 71941 <at> debbugs.gnu.org; Sat, 01 Mar 2025 13:08:40 -0500
Received: by mail-wm1-x333.google.com with SMTP id
 5b1f17b1804b1-4398c8c8b2cso33482755e9.2
 for <71941 <at> debbugs.gnu.org>; Sat, 01 Mar 2025 10:08:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740852512; x=1741457312; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=iNEmM3NlY6dtMi8m6rS5AmSb6rqtj4sBG74k/ZU7V9Q=;
 b=JDuEIm5UroGP6OIr98r8fagBRNOcejeYDOk0Gh/U6CUU/b0L5XhDViZzGC7eP6magB
 qD+A2nYHg9keFRMc9KnjHaJ/Zgqxn+FY9LpY5fV/suReYZzfKulRnSBXZECFMQLr5igM
 79TXBL4JJpVcPmpyvuwT/QNhfpf9yKcndDoexL3UmW8ThGQYpFwb7ZsWaqBMHA1Vs8t1
 tPCqdlUm4nQ37Uenq8n2Bw13NvROZJEvmGQTDB3ynf2PAdrpVs4K/mCLOMDbJShsjozI
 FYOh3gqJLRtmVoUGPGvNZW6ZmE3XkZNp0RH9geRp/UeGecy71ct7XwlUJfhae5MpLv26
 qgxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740852512; x=1741457312;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=iNEmM3NlY6dtMi8m6rS5AmSb6rqtj4sBG74k/ZU7V9Q=;
 b=ry34vOCs73Sdu1fQjLaQ58DCOhD/otw2DBYyGzQlYn7C5iIIBL9KJPb/PWyTFJ6Y3X
 mEUNRRcWYvq9+o/gfsSD8Lvks8qmasDVWSJZwLHnYyVL3clpZrNFUOg4mVHD9TDBXvvY
 U+D3ICvRFp8uJ9VBEh7HfpMNde2N/aB2oH4ZXhPWuWHQxIjKLrsLB7NS//N/+IQ6KxoU
 tPpAxkY6BKWHor6IpmTbDFGxWw2hGg2hP2ZI2vuLJ/hk2Kk6EX5tTP3upGKxJfwU+knb
 xgCphsqgyZDGEbQvEjbUavzgPyblLe5x0xMs7j2iptHXaSy1JlTFL5bPDajypZePf547
 /w6g==
X-Gm-Message-State: AOJu0Yw0lYlKUFX1n5oN+W7VsrTaOYJdN05kkn5QhE7TxbU/CsRpXyKc
 LKIgBrdb1g9Iyz+gnzjuWgGsrNgT7IyIst2U5wvgLQTBBCUOh5bj1C+6pw==
X-Gm-Gg: ASbGncuPX582/28C+DIilRhkHw4sgJTA1utkjja4lR2ijcg2/Xa4+25mCKRNwdLz03z
 b8s4tyk0NxehEB0/KY/k9nFtPWjXenEfxUpLeaCO3v5I/Ptsx97+cNH9dOwv0ym5sIIoePprEq2
 PEtz0iS/DvXPUPbqJ7EiMvFPHnXMHTzVujlRFs6OyvaZ87A0nNHdG1830V5P4tvK3v4SKLRDuGp
 M42FPJ+5pDPO49SWdNBY9C9e4GyfG+NKc2lsWaR/B+L4tUml5wUSbdCrcTOTZRs56dgBqzArwDe
 0FuGCRD26yjgrfZ02xOYnE3GuVEyP9Sxq2McBJzhPfYXd8LwqsS2AhiXLw==
X-Google-Smtp-Source: AGHT+IFd/SXFZT+yemOo1ClBmAt2EIB+FwuiwapgABhdQB6kSLHTvIsOqOth5mH2q5iATorHAa95dg==
X-Received: by 2002:a05:600c:1381:b0:439:9e13:2df4 with SMTP id
 5b1f17b1804b1-43ba674c8fbmr74989685e9.21.1740852512023; 
 Sat, 01 Mar 2025 10:08:32 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43b73703caesm97868995e9.12.2025.03.01.10.08.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 01 Mar 2025 10:08:31 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v4 1/3] guix: fix: 'map-derivation' not handling directories
Date: Sat,  1 Mar 2025 19:06:08 +0100
Message-ID: <7090bd5fec7bfd51bad65aa6eebd7aea7c9a7b7f.1740852370.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

The 'map-derivation' procedure was trying to process directories as files.
When a derivation had a 'module import' directory as input, it threw an
exception since it tried to open it as a file.

Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6
---
 guix/derivations.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index ffa69e924c..d84d1a391c 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012-2021, 2023-2024 Ludovic Courtès <ludo@HIDDEN>
 ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@HIDDEN>
+;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1074,8 +1075,10 @@ (define* (map-derivation store drv mapping
                                     ((_ . replacement)
                                      replacement)
                                     (#f
-                                     (substitute-file source
-                                                      initial replacements))))
+                                     (if (file-is-directory? source)
+                                         source
+                                         (substitute-file source
+                                                          initial replacements)))))
                                 (derivation-sources drv)))
 
              ;; Now augment the lists of initials and replacements.

base-commit: 256bee7d0b72df2d471e1db071500e7635462ad7
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, sergio.pastorperez@HIDDEN, ludo@HIDDEN, guix@HIDDEN, dev@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 25 Feb 2025 17:28:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 12:28:07 2025
Received: from localhost ([127.0.0.1]:48276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmyj0-0005gS-FE
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 12:28:06 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:34038)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tmyiy-0005fm-1T
 for 71941 <at> debbugs.gnu.org; Tue, 25 Feb 2025 12:28:04 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tmyir-0005bS-4k; Tue, 25 Feb 2025 12:27:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=Ah+1xT+yzrcq2wzDX3C9ytuhL10Fph6W8W3HIPSngkI=; b=Lruwc5AJSCW4U041/KNI
 UJ/Zuq44aMdWQS5R7IY9b/4WV7BhCrzI/yN0L3IlqVSzROzuaIeEm7uhrk1lQhJvE7QduqB6bNYfs
 OYK+KAFBe68sdWC3/yVP9hB1xEma5rc1K/X3/AL3n6dwCZJC0n7XnZ8iptOt4/CehLyaY473nPASu
 Gls2RGNKjEdVg0zM5MYGXcduLPfWMV8MTOT+D+R1CdkT9MMWSI9joyJ7i8uUz9pKyADo0wkHqlq2u
 LvXc/D7CdwzS4WaEEjE3O0q94eLUs6XbQX7zVinPjoiuU13sNbvoNF77Vw7QDpKNsZRA+ARKnivWC
 fydCNzKL1nqGBA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Sergio Pastor =?utf-8?Q?P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
Subject: Re: bug#71941: Broken `map-derivation' procedure
In-Reply-To: <6f67d2c9b2e14a6c1fd77689d959ddf5ca0a256d.1740331748.git.sergio.pastorperez@HIDDEN>
 ("Sergio Pastor =?utf-8?Q?P=C3=A9rez=22's?= message of "Sun, 23 Feb 2025
 18:29:08 +0100")
References: <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
 <6f67d2c9b2e14a6c1fd77689d959ddf5ca0a256d.1740331748.git.sergio.pastorperez@HIDDEN>
Date: Tue, 25 Feb 2025 18:27:53 +0100
Message-ID: <87msealysm.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71941
Cc: Josselin Poiret <dev@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 Tobias Geerinckx-Rice <me@HIDDEN>, 71941 <at> debbugs.gnu.org,
 Christopher Baines <guix@HIDDEN>,
 Sergio Pastor =?utf-8?Q?P=C3=A9rez?= <sergio.pastorperez@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: -3.3 (---)

Sergio Pastor P=C3=A9rez <sergio.pastorperez@HIDDEN> skribis:

> Implement caching to speed up computation.
>
> Change-Id: I186e2a62f6655e3b0738dd6e0f628faccd8b855e

Nice!

> +      (let ((cached-drv (hash-ref computed-drvs drv)))
> +        (if cached-drv
> +            cached-drv
> +            (let* ((inputs       (map (cut rewritten-input <> loop)

Two things:

  1. Preferably use =E2=80=98hashq-set!=E2=80=99 and =E2=80=98hashq-ref=E2=
=80=99 for the cache, to
     compare derivations according to =E2=80=98eq?=E2=80=99;

  2. Instead of rolling your own, perhaps you can use =E2=80=98mlambdaq=E2=
=80=99, which
     also has the advantage of maintaining statistics; you can see them
     by setting GUIX_PROFILING=3Dmemoization.

For #2, essentially you would write:

  (define loop
    (mlambdaq (drv)
      contents of the loop=E2=80=A6))

  (loop drv)

I *think* that would do the job.

We you able to test this on meaningful cases?

Thanks for your work, and apologies for the delay!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 25 Feb 2025 17:23:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 12:23:35 2025
Received: from localhost ([127.0.0.1]:48258 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmyec-0005S8-OQ
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 12:23:35 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:37648)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tmyeb-0005Rt-0E
 for 71941 <at> debbugs.gnu.org; Tue, 25 Feb 2025 12:23:33 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tmyeT-00055Z-Tz; Tue, 25 Feb 2025 12:23:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=qI1LfjD8zhF+UsAKevjW8X/iRlLLzhFnAbzraizoW6A=; b=IZoOGizj363Dk5miN75d
 n0EJgAUjC0gNT3gMPNmNcZM4ZplKEJXi2HR0RR50rdQDSM97RjouGI/v1f+77gxCcbdXLiSNk94lc
 5SgcB+KX5TVjJEGSBFftC2ZjUgoj3KB7OWtBTJSW1mTL+fQpJameZxz6QLXathI1gXXaKxVIEmb0m
 mQYadhgaOBrJYt3xvI9/vF0L8SMbEqyPRtGW+ppsqElhixHMV3uSOXV5S2euTW5ONqPTC0p03x1jo
 xMZBOEAGWVtURzKsE/hPR0O+lDOck2SCFIsYqkeRfMgMVnQQlJjvDCCcU7VU2RK+1WsKoh/AWArBt
 EtoB2S6M46dS2A==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Sergio Pastor =?utf-8?Q?P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
Subject: Re: bug#71941: Broken `map-derivation' procedure
In-Reply-To: <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
 ("Sergio Pastor =?utf-8?Q?P=C3=A9rez=22's?= message of "Sun, 23 Feb 2025
 18:29:07 +0100")
References: <PAXP251MB03489F8E853184BD49C9D310F3DE2@HIDDEN>
 <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
Date: Tue, 25 Feb 2025 18:23:12 +0100
Message-ID: <87v7sylz0f.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71941
Cc: Josselin Poiret <dev@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 Tobias Geerinckx-Rice <me@HIDDEN>, 71941 <at> debbugs.gnu.org,
 Christopher Baines <guix@HIDDEN>,
 Sergio Pastor =?utf-8?Q?P=C3=A9rez?= <sergio.pastorperez@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: -3.3 (---)

Hi Sergio,

Sergio Pastor P=C3=A9rez <sergio.pastorperez@HIDDEN> skribis:

> The `map-derivation` procedure was trying to process directories as files.
> When a derivation had a 'module import' directory as input, it threw an
> exception since it tried to open it as a file.
>
> Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6
> ---
>  guix/derivations.scm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/guix/derivations.scm b/guix/derivations.scm
> index bef98cd26a..9c019a35bb 100644
> --- a/guix/derivations.scm
> +++ b/guix/derivations.scm
> @@ -1074,8 +1074,10 @@ (define* (map-derivation store drv mapping
>                                      ((_ . replacement)
>                                       replacement)
>                                      (#f
> -                                     (substitute-file source
> -                                                      initial replacemen=
ts))))
> +                                     (if (file-is-directory? source)
> +                                         source
> +                                         (substitute-file source
> +                                                          initial replac=
ements)))))

Could you add a unit test for this specific case?

Bonus points if you come up with a commit log that follows our
conventions.  :-)  (I can do it on your behalf if you=E2=80=99re not sure.)

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 23 Feb 2025 21:18:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 23 16:18:12 2025
Received: from localhost ([127.0.0.1]:36983 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmJMa-0007fD-1n
	for submit <at> debbugs.gnu.org; Sun, 23 Feb 2025 16:18:12 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:60457)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1tmFoA-0004sQ-Ji
 for 71941 <at> debbugs.gnu.org; Sun, 23 Feb 2025 12:30:27 -0500
Received: by mail-wm1-x32f.google.com with SMTP id
 5b1f17b1804b1-4398e3dfc66so32412465e9.0
 for <71941 <at> debbugs.gnu.org>; Sun, 23 Feb 2025 09:30:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740331820; x=1740936620; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=bxKGy+k6t31ngI98Wf7MjMIOqXRKR8ULf55xxuwAkIM=;
 b=eRf6ZD5YKHPcgVCOIt7wUMJoXGQhkGxInhzRs/h4iuAzzm8zoT8fKUOl6jqqHHyxaO
 VLnq/HSgqxMPg16n/vGGClmjiHh3HnLQ0SxeWu3JKLplBrGV26i/JSB7Yk7mSzU6s6SH
 zT4qJobPb4OGRVp9Rp6jBYUd05/8et9THE8KgRwdLdrpdQ84+fn6YmAIyXTKtNpgv5yO
 4g2X9U8zBtXR5fSP/roKGjQ/BpVpaP1UT0ipW6h5mQR/JV6A0G97XaL2t6QIPazCgerl
 IDeYQOIA/C62YojIc3zy8HpdiTbvQU6yz42uHTbx8lIN728Zb4Cnmh0Z0ALF5cCK4337
 Of7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740331820; x=1740936620;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=bxKGy+k6t31ngI98Wf7MjMIOqXRKR8ULf55xxuwAkIM=;
 b=JX5Ykf6XqgI9FOle0glvuOiQ0TfmDYsaD861vVoY1UDcnjiCePQFb6ulb/zdxCoLTK
 agtVubFomwt4ghbKO3/4WWmBj+s1IqSWzKIsFefYaWGz0zXLdHv/l7tRn2RM0CBsmPPe
 tLsAai9BgnXCZdW4E3htwKj7t57RemOexPF94u2YLECMIlMFVroJZNkyIszfJwSCjcK0
 pIgzw/7lPg/QR+sqAlrerY+HtwHJ6WPyT+lDKlmO9nz5XL7cGKRCXxl5ck1TxlIz57Y6
 MIfM3q+acfPoCTtcJEwwy1GraTWh0wKKnQdQdjMyImQU3elyFGKekXcvsyfc+xV9xG0y
 nFSg==
X-Gm-Message-State: AOJu0Yxk0bYu4+tP0u3+1tPXPfrCLUbHajIiWeRKTZrzHXH7np/uOnK6
 Cz6ZGd5BDfwoMer6lIOv6Uvov2icOUJXQQRtDrkIvHMG3zD5pFEL57Hu4Q==
X-Gm-Gg: ASbGncvTj6rQEE3HBlum6XxXwte2CKjxKcLL7dLtRDfEaAqniNqFrJ5xIT1JlJGr8NU
 RUJKqvc3QbXmzEMeKbS6uL+5CNGIZ4aEqQH/7fPypYXl4NETYa1lQ4nT4uif45jzsXEZkUNfFI7
 lf4XBjEhNHNhTAubLoC4ipcOTt7ruju2DzFN2mfvWprS4dAh0HKmp1Z2zWdRJHArQEd6SDYBELw
 CAiTyT/HIeggtK+oVCBB3FNHaQ2rAMtW86hXJDUYtkuKk1/V6PHusNRV6SCANFwwUVGqdD7YtGW
 F0/TCDkktMSQVJ9srVnfvRHGI34LdfwIfJlSBXs=
X-Google-Smtp-Source: AGHT+IGYmbIWn7tSmBYQFEUg6tqTXNh6hhlRB4kZbOAWz/CfI8o5im1suse6XabgyyBA2A/3lWiv+A==
X-Received: by 2002:a05:600c:4e8d:b0:439:643a:c8d5 with SMTP id
 5b1f17b1804b1-439ae189b90mr96143055e9.0.1740331819778; 
 Sun, 23 Feb 2025 09:30:19 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-439b02ce4e9sm84166945e9.4.2025.02.23.09.30.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 23 Feb 2025 09:30:19 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v3 2/2] guix: fix: slow map-derivation procedure
Date: Sun, 23 Feb 2025 18:29:08 +0100
Message-ID: <6f67d2c9b2e14a6c1fd77689d959ddf5ca0a256d.1740331748.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
References: <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
X-Mailman-Approved-At: Sun, 23 Feb 2025 16:18:09 -0500
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

Implement caching to speed up computation.

Change-Id: I186e2a62f6655e3b0738dd6e0f628faccd8b855e
---
 guix/derivations.scm | 109 +++++++++++++++++++++++--------------------
 1 file changed, 59 insertions(+), 50 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index 9c019a35bb..8ec36b0fe3 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012-2021, 2023-2024 Ludovic Courtès <ludo@HIDDEN>
 ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@HIDDEN>
+;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1044,7 +1045,8 @@ (define* (map-derivation store drv mapping
                            ((file . replacement)
                             (vhash-cons file replacement result))))
                        vlist-null
-                       mapping)))
+                       mapping))
+        (computed-drvs (make-hash-table 100)))
     (define rewritten-input
       ;; Rewrite the given input according to MAPPING, and return an input
       ;; in the format used in 'derivation' calls.
@@ -1060,55 +1062,62 @@ (define* (map-derivation store drv mapping
               (derivation-input (loop drv) sub-drvs)))))))
 
     (let loop ((drv drv))
-      (let* ((inputs       (map (cut rewritten-input <> loop)
-                                (derivation-inputs drv)))
-             (initial      (append-map derivation-input-output-paths
-                                       (derivation-inputs drv)))
-             (replacements (append-map input->output-paths inputs))
-
-             ;; Sources typically refer to the output directories of the
-             ;; original inputs, INITIAL.  Rewrite them by substituting
-             ;; REPLACEMENTS.
-             (sources      (map (lambda (source)
-                                  (match (vhash-assoc source mapping)
-                                    ((_ . replacement)
-                                     replacement)
-                                    (#f
-                                     (if (file-is-directory? source)
-                                         source
-                                         (substitute-file source
-                                                          initial replacements)))))
-                                (derivation-sources drv)))
-
-             ;; Now augment the lists of initials and replacements.
-             (initial      (append (derivation-sources drv) initial))
-             (replacements (append sources replacements))
-             (name         (store-path-package-name
-                            (string-drop-right (derivation-file-name drv)
-                                               4))))
-        (derivation store name
-                    (substitute (derivation-builder drv)
-                                initial replacements)
-                    (map (cut substitute <> initial replacements)
-                         (derivation-builder-arguments drv))
-                    #:system system
-                    #:env-vars (map (match-lambda
-                                     ((var . value)
-                                      `(,var
-                                        . ,(substitute value initial
-                                                       replacements))))
-                                    (derivation-builder-environment-vars drv))
-                    #:inputs (filter derivation-input? inputs)
-                    #:sources (append sources (filter string? inputs))
-                    #:outputs (derivation-output-names drv)
-                    #:hash (match (derivation-outputs drv)
-                             ((($ <derivation-output> _ algo hash))
-                              hash)
-                             (_ #f))
-                    #:hash-algo (match (derivation-outputs drv)
-                                  ((($ <derivation-output> _ algo hash))
-                                   algo)
-                                  (_ #f)))))))
+      (let ((cached-drv (hash-ref computed-drvs drv)))
+        (if cached-drv
+            cached-drv
+            (let* ((inputs       (map (cut rewritten-input <> loop)
+                                      (derivation-inputs drv)))
+                   (initial      (append-map derivation-input-output-paths
+                                             (derivation-inputs drv)))
+                   (replacements (append-map input->output-paths inputs))
+
+                   ;; Sources typically refer to the output directories of the
+                   ;; original inputs, INITIAL.  Rewrite them by substituting
+                   ;; REPLACEMENTS.
+                   (sources      (map (lambda (source)
+                                        (match (vhash-assoc source mapping)
+                                          ((_ . replacement)
+                                           replacement)
+                                          (#f
+                                           (if (file-is-directory? source)
+                                               source
+                                               (substitute-file source
+                                                                initial replacements)))))
+                                      (derivation-sources drv)))
+
+                   ;; Now augment the lists of initials and replacements.
+                   (initial      (append (derivation-sources drv) initial))
+                   (replacements (append sources replacements))
+                   (name         (store-path-package-name
+                                  (string-drop-right (derivation-file-name drv)
+                                                     4))))
+
+              (hash-set!
+               computed-drvs
+               drv
+               (derivation store name
+                           (substitute (derivation-builder drv)
+                                       initial replacements)
+                           (map (cut substitute <> initial replacements)
+                                (derivation-builder-arguments drv))
+                           #:system system
+                           #:env-vars (map (match-lambda
+                                             ((var . value)
+                                              `(,var
+                                                . ,(substitute value initial
+                                                               replacements))))
+                                           (derivation-builder-environment-vars drv))
+                           #:inputs (filter derivation-input? inputs)
+                           #:sources (append sources (filter string? inputs))
+                           #:outputs (derivation-output-names drv)
+                           #:hash (match (derivation-outputs drv)
+                                    ((($ <derivation-output> _ algo hash))
+                                     hash)
+                                    (_ #f))
+                           #:hash-algo (match (derivation-outputs drv)
+                                         ((($ <derivation-output> _ algo hash))
+                                          algo)
+                                         (_ #f))))))))))
 
 
 ;;;
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, sergio.pastorperez@HIDDEN, guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 23 Feb 2025 21:18:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 23 16:18:12 2025
Received: from localhost ([127.0.0.1]:36981 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmJMZ-0007f9-FT
	for submit <at> debbugs.gnu.org; Sun, 23 Feb 2025 16:18:11 -0500
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:53672)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1tmFo7-0004sM-TZ
 for 71941 <at> debbugs.gnu.org; Sun, 23 Feb 2025 12:30:24 -0500
Received: by mail-wm1-x332.google.com with SMTP id
 5b1f17b1804b1-439a4fc2d65so34356335e9.3
 for <71941 <at> debbugs.gnu.org>; Sun, 23 Feb 2025 09:30:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740331817; x=1740936617; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=l0wgA80VfOdtMvuE8FSRbR1o9yNmrG9pTnfvknqQw7g=;
 b=IweQV6RHLjh7NTMgEzEvDP24XPIKxz8R20rwOS8fU5EM2WWJQFSJH6JHUF9B0+iRXQ
 8V2dhpTxS65DO/VHx5m+QXCMIyU1hNzaD6s45wbu/LWjg+LlJYfkZCh7DP3S9+Lv5QyO
 jYp8MMb2Wvx5Ijix34uPRFq9A75pptuGGXRGGrT3I17SHgCArNvbel2q6R4dJhOJNZIJ
 FWR+fzy+S/UuMar22iLPSGt6CKqWUuu01JrMZmHXDCmVl83M0fjdho+omaSe++bFdjXD
 BiNWQQUQhVDNzTDR3J6m+elvy+L1xRjX6+7pXZueF2McHBvdhRCtxTsBov1pzUUCHAHq
 dxvA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740331817; x=1740936617;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=l0wgA80VfOdtMvuE8FSRbR1o9yNmrG9pTnfvknqQw7g=;
 b=Shf/qyV/CcX4vXXfD0BKCKU++6W291HsR1tOxCCynFT1psBL7m613I9oUdBSWRkn36
 uHti7CXv+v8xVDruzsCPmplVC4F41SSoiEjuNq8FoJ6Q+tIBOgurqnJ8MXeRxhVapxhk
 OjWSHH96kjppWZtY2rW3QFcZrB1Rq4SLKXINxmwHtyXRgvfxQzB3JhnG6j7D4h/gpAIU
 0RnnA/DgOWWFEZPLezDIX+BVgm7dQYxUhnehedhYP6GPvAvRrZUCv+ogq7Ja4wFhPCUY
 evnMuqfqLsjpQDq1jveQLqG1kG8vflVZVhSQRN/CZ3LcT9zff/LNsVuqBlxCNm60SN1q
 W/mA==
X-Gm-Message-State: AOJu0YyCLaMKCmIopPNEFKFhJF9jc9/2OhdXHfeHy0Wmghv9xNbfFbzq
 uByxR7x7luzbU5dDJdWP2lYlMYVq/VG7LAKlvFMnydxVFOKM2lPAyeH7dQ==
X-Gm-Gg: ASbGncu9qoMiqZUCu3rlcOlItU7gAweFEq+S32rIkxaMw6mP9Y2uSPUMyQmBGSJtZva
 hfWSXSbtHZIM+kO+fGuysDgWoHhenK9hQKraruVYjeKU0u3m+EDBZdze6ShqzO8JIk+0Qaa3KRR
 keF1RjfWmNCadj9RcgjY9kimK9kpqpTCyRwKz31DeNs3RtsjjbRd1g2+2LEJsjrc7IFYwQjp8dE
 RcyN+wdgxt6unbJuEjFpkFqtZWuyvtFTmZStaDDHOpce61qxZQ1qq9lOhM9pzm+cvJVUDFrTu2d
 2+u+IU+JZhTBhNaCPrk1Bmwv27vkhpJIHAcJN7o=
X-Google-Smtp-Source: AGHT+IHyPRzwrop/4MJDeXzUrn6JHXGrBgOCWoeJDkA9A4POV9vYJJWaq1ML7iq3hGI1fkumWK9zkg==
X-Received: by 2002:a05:600c:45ca:b0:439:9a40:aa0b with SMTP id
 5b1f17b1804b1-439ae21e36emr81462195e9.25.1740331817124; 
 Sun, 23 Feb 2025 09:30:17 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-439b02d5147sm82449855e9.10.2025.02.23.09.30.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 23 Feb 2025 09:30:15 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v3 1/2] guix: fix: map-derivation not handling directories
Date: Sun, 23 Feb 2025 18:29:07 +0100
Message-ID: <c803f54d538ce37f043422f86fe8938316a73b15.1740331748.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
X-Mailman-Approved-At: Sun, 23 Feb 2025 16:18:09 -0500
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

The `map-derivation` procedure was trying to process directories as files.
When a derivation had a 'module import' directory as input, it threw an
exception since it tried to open it as a file.

Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6
---
 guix/derivations.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd26a..9c019a35bb 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1074,8 +1074,10 @@ (define* (map-derivation store drv mapping
                                     ((_ . replacement)
                                      replacement)
                                     (#f
-                                     (substitute-file source
-                                                      initial replacements))))
+                                     (if (file-is-directory? source)
+                                         source
+                                         (substitute-file source
+                                                          initial replacements)))))
                                 (derivation-sources drv)))
 
              ;; Now augment the lists of initials and replacements.

base-commit: 00787cd61611d74d3e54b160e94176905d36ef39
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, sergio.pastorperez@HIDDEN, guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 5 Feb 2025 14:46:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 05 09:46:16 2025
Received: from localhost ([127.0.0.1]:49265 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfgfO-00068A-F6
	for submit <at> debbugs.gnu.org; Wed, 05 Feb 2025 09:46:16 -0500
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:61731)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1tfeYt-0007bk-3u
 for 71941 <at> debbugs.gnu.org; Wed, 05 Feb 2025 07:31:23 -0500
Received: by mail-wm1-x332.google.com with SMTP id
 5b1f17b1804b1-4368a293339so76657725e9.3
 for <71941 <at> debbugs.gnu.org>; Wed, 05 Feb 2025 04:31:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738758676; x=1739363476; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=vnck0S5q82AJuydNhH32oqm9w0uaN6PG+VX4JvinVR4=;
 b=DbzaGzwLN/V8Y1Q/jgxAbajn8C5WIXlKSL6e/XbXWKnESrV1SwTBhkYxhwS6uu9MsM
 n63VSlEC3sNuImTWv6WEBZD40nZGKsSx6Cf46cHlW3PAvVu2nz8i/UhOit8HzIJNKR4W
 G6QVGZW8abVOI15xDIcpMuXWZRpYYG8HoFw7HDfTI6ySbM8VJWlthES9jFonb5fvg7tM
 WZNkhRzQ1WbahGfo0FDkjxMCtXZqKFzseG5a3kYBLjpWGIc65QNinOx4IBoQX6g6dnzu
 Rb19nlVXWk+80NdXmehVP+/5Um04Tdo7BzNGziar0S2AOZOqo1xYfpTp08Cljlq/HSeq
 5rmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738758676; x=1739363476;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=vnck0S5q82AJuydNhH32oqm9w0uaN6PG+VX4JvinVR4=;
 b=BIXwmyszz0mHFveMwzYk1rOoTJ2lstWNhJdJLELpu5sdGywZZUKb6229mOatU6HI8T
 a3c3YTE5FAxclc2HtTJcsktmYNwKIA70uaztYpVKSWNCFE4OSYq7fmCokpTbj9iNdahC
 XjQo1KErS3HvBg4Ll0xopV5aIHqFl77v8Cyc1ArLsAPsGP3P8sytBTnumu11NQh7vSbM
 bVVIQnp3wD4DScjUzY2Xcze6c/zDU3v6bIU9oBbcisbnnN6CWCedGA5fOtk4iDxP4Knv
 UDGvu3QNahVOJRpAmzmpRTwCPfSfJQGFLCpmJ6Shh3yNl7FAFtJDKcowFM1UDb/OuKw9
 wBVA==
X-Gm-Message-State: AOJu0Yy47GezNb9/8eNWJiX7W+dE46MClxES2Rg0nPJPxJEtXrxNI5fS
 W2+TFYeA+NjHzFUz15etMkyq0Ki5YG5GRMU3WTFfL1OmAgBpDwhz6e7WktND
X-Gm-Gg: ASbGncuoKuZKKs8st3JKSfDMCQM/fXhbTYT/abQyY+BbVdMvv0WECP6LwedTOZkXDFz
 VNrlOIzmxKUlUIfF/aASHTfQLRVnAoTf6WwpWuhuBjnIEdbQjpXKFIdCmSp8+kGms3eewhAVJ2R
 MOhXQ0gFw477Ag00YRXa2ke4RXBYv8LFPQG9wFC+3IqFTS0BIRwZumFxqdK+ADXQqJWXPMHJtfS
 +YKeTVxbFav3sHzO5GLptjR/ICW79eddhbmKEVJHwvjbI96e8MonLo/UCFR+Q8a3jZdUy8EcWyx
 RIQprKcvM1SpUF06gCEZm7u07hli
X-Google-Smtp-Source: AGHT+IHosPfjBzMv/Cpj0l9fVFB7YiT6elvWe/G7UeL60/imrCvWq1qb/FhjQ5ixRCFctMNtzsMAqg==
X-Received: by 2002:a05:6000:186b:b0:38c:3fd1:6164 with SMTP id
 ffacd0b85a97d-38db48d5cdemr1859558f8f.42.1738758674625; 
 Wed, 05 Feb 2025 04:31:14 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38c5c1cf571sm18377775f8f.82.2025.02.05.04.31.13
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 05 Feb 2025 04:31:14 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] guix: fix: slow `map-derivation' procedure
Date: Wed,  5 Feb 2025 13:29:34 +0100
Message-ID: <00a6dd1e400f182156e8fa5a1de062944aa6a37e.1738758574.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <bd6d0cd65d321f03aad528391cc782564a405130.1738758574.git.sergio.pastorperez@HIDDEN>
References: <bd6d0cd65d321f03aad528391cc782564a405130.1738758574.git.sergio.pastorperez@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
X-Mailman-Approved-At: Wed, 05 Feb 2025 09:46:11 -0500
Cc: ludo@HIDDEN,
 =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

Implement caching to speed up computation.

Change-Id: I186e2a62f6655e3b0738dd6e0f628faccd8b855e
---
 guix/derivations.scm | 108 +++++++++++++++++++++++--------------------
 1 file changed, 58 insertions(+), 50 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index 9c019a35bb..aa7f55ee92 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1044,7 +1044,8 @@ (define* (map-derivation store drv mapping
                            ((file . replacement)
                             (vhash-cons file replacement result))))
                        vlist-null
-                       mapping)))
+                       mapping))
+        (computed-drvs (make-hash-table 100)))
     (define rewritten-input
       ;; Rewrite the given input according to MAPPING, and return an input
       ;; in the format used in 'derivation' calls.
@@ -1060,55 +1061,62 @@ (define* (map-derivation store drv mapping
               (derivation-input (loop drv) sub-drvs)))))))
 
     (let loop ((drv drv))
-      (let* ((inputs       (map (cut rewritten-input <> loop)
-                                (derivation-inputs drv)))
-             (initial      (append-map derivation-input-output-paths
-                                       (derivation-inputs drv)))
-             (replacements (append-map input->output-paths inputs))
-
-             ;; Sources typically refer to the output directories of the
-             ;; original inputs, INITIAL.  Rewrite them by substituting
-             ;; REPLACEMENTS.
-             (sources      (map (lambda (source)
-                                  (match (vhash-assoc source mapping)
-                                    ((_ . replacement)
-                                     replacement)
-                                    (#f
-                                     (if (file-is-directory? source)
-                                         source
-                                         (substitute-file source
-                                                          initial replacements)))))
-                                (derivation-sources drv)))
-
-             ;; Now augment the lists of initials and replacements.
-             (initial      (append (derivation-sources drv) initial))
-             (replacements (append sources replacements))
-             (name         (store-path-package-name
-                            (string-drop-right (derivation-file-name drv)
-                                               4))))
-        (derivation store name
-                    (substitute (derivation-builder drv)
-                                initial replacements)
-                    (map (cut substitute <> initial replacements)
-                         (derivation-builder-arguments drv))
-                    #:system system
-                    #:env-vars (map (match-lambda
-                                     ((var . value)
-                                      `(,var
-                                        . ,(substitute value initial
-                                                       replacements))))
-                                    (derivation-builder-environment-vars drv))
-                    #:inputs (filter derivation-input? inputs)
-                    #:sources (append sources (filter string? inputs))
-                    #:outputs (derivation-output-names drv)
-                    #:hash (match (derivation-outputs drv)
-                             ((($ <derivation-output> _ algo hash))
-                              hash)
-                             (_ #f))
-                    #:hash-algo (match (derivation-outputs drv)
-                                  ((($ <derivation-output> _ algo hash))
-                                   algo)
-                                  (_ #f)))))))
+      (let ((cached-drv (hash-ref computed-drvs drv)))
+        (if cached-drv
+            cached-drv
+            (let* ((inputs       (map (cut rewritten-input <> loop)
+                                      (derivation-inputs drv)))
+                   (initial      (append-map derivation-input-output-paths
+                                             (derivation-inputs drv)))
+                   (replacements (append-map input->output-paths inputs))
+
+                   ;; Sources typically refer to the output directories of the
+                   ;; original inputs, INITIAL.  Rewrite them by substituting
+                   ;; REPLACEMENTS.
+                   (sources      (map (lambda (source)
+                                        (match (vhash-assoc source mapping)
+                                          ((_ . replacement)
+                                           replacement)
+                                          (#f
+                                           (if (file-is-directory? source)
+                                               source
+                                               (substitute-file source
+                                                                initial replacements)))))
+                                      (derivation-sources drv)))
+
+                   ;; Now augment the lists of initials and replacements.
+                   (initial      (append (derivation-sources drv) initial))
+                   (replacements (append sources replacements))
+                   (name         (store-path-package-name
+                                  (string-drop-right (derivation-file-name drv)
+                                                     4))))
+
+              (hash-set!
+               computed-drvs
+               drv
+               (derivation store name
+                           (substitute (derivation-builder drv)
+                                       initial replacements)
+                           (map (cut substitute <> initial replacements)
+                                (derivation-builder-arguments drv))
+                           #:system system
+                           #:env-vars (map (match-lambda
+                                             ((var . value)
+                                              `(,var
+                                                . ,(substitute value initial
+                                                               replacements))))
+                                           (derivation-builder-environment-vars drv))
+                           #:inputs (filter derivation-input? inputs)
+                           #:sources (append sources (filter string? inputs))
+                           #:outputs (derivation-output-names drv)
+                           #:hash (match (derivation-outputs drv)
+                                    ((($ <derivation-output> _ algo hash))
+                                     hash)
+                                    (_ #f))
+                           #:hash-algo (match (derivation-outputs drv)
+                                         ((($ <derivation-output> _ algo hash))
+                                          algo)
+                                         (_ #f))))))))))
 
 
 ;;;
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 5 Feb 2025 14:46:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 05 09:46:14 2025
Received: from localhost ([127.0.0.1]:49263 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfgfN-000680-Nh
	for submit <at> debbugs.gnu.org; Wed, 05 Feb 2025 09:46:14 -0500
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:49634)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1tfeYl-0007P9-Vg
 for 71941 <at> debbugs.gnu.org; Wed, 05 Feb 2025 07:31:17 -0500
Received: by mail-wm1-x334.google.com with SMTP id
 5b1f17b1804b1-4361e89b6daso45980415e9.3
 for <71941 <at> debbugs.gnu.org>; Wed, 05 Feb 2025 04:31:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738758669; x=1739363469; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=AM4leZxYkRFATt9qT5izvbXKBOqZ6ZPxg/GHfa0LvXA=;
 b=G9wLYl0+CEN1GrLAK+5BDiQ/Ikve3G0OwYaHCSX7fLUSxe617IHN1R+nthVaP2xfah
 ADUiefcLfYP0xFveWsHlJ+guc/ALuRGhfTmC9PigfXGK5bHcQMw5dJROgPC5YF0QFXjh
 XcNknhnDP9mVW3lVRujTzYgkMsjxLz2opmVq0gBDS0vbjTgIr9YoRYzYTs8l0cIufCvN
 zhpqGzU3jvk4EFjh0ZbJI0EL4dWWRUssdbRnGPbIqYSYWRibG7b6mPVGVYUT4/vqmwYi
 iYyx7AVgAvk4CfvSAwOtjY3TnO+H4W5bfwuQjFVBZYa4RPJ/RIzepTcw3PusrMOkMZTY
 aBUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738758669; x=1739363469;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=AM4leZxYkRFATt9qT5izvbXKBOqZ6ZPxg/GHfa0LvXA=;
 b=Er3o33ppkDWl+J16qPFsL2jjeRT3yPKNPvn2eQ7fx+7z73Wrhd1L88gmYj6sRidCAb
 aAbHQZWn7/Z9ICFLXW2JIAALinEi8E2TMPQRrqzZb72oVQF1BmZDXFqk7hI3YMN/JLoi
 IUlg6fRVlhc3zJcom4kEyc+Qqz3Dt4L3/z7D+l9CWPXcaIhmhfcgDx1LMlEKotRLQZ7Y
 9EEQ1lPYTja5BTjUaLQUWB16QbZa/gDFoWXp7CYGzDl4ZOg8MSbWmuErZwrmGnra5Osr
 Q1x/v3PMouMVlRvEWxpAD4WsQDDlDnlp+FuHFLONRHA8W5d3Z3zys+tmp/gVaceNO0JD
 D9lA==
X-Gm-Message-State: AOJu0YwvblxlDtJYNozORzWxvIXZNznzyW2EqlJXe9drlSptOby7Nena
 JFmdzBLse07HEnt/fqsixaN31WuUxop6diuhwF0cBHdztH7i2GuMZp+He+i9
X-Gm-Gg: ASbGncvwY3dkb0+qUPMf1mOPB0sw5TIpo2Kp9/r0+O71ZuJVbJ0yO67DgAuTTSPprEh
 l8i8cTDMXYLAwzrI+FMHsxjnnlpFYAJOtxUUvP6SAFWAGqmE4vMyPdQrsqV+H+XJiCxTh/ygvar
 mO5//5XPDCKgpeG9hfbJIZpzPDhHjlAryb8FGd2CCfPN8SGxoFeXSEEeHSuMjYG0l2FbPJXO0xe
 Hhqyee8PLyWPCbBCobWM7LnimfiLxn6Y38SxDv4pblSSiFd6k6rDOV+wSUkxpDl8t2XnSm2beXT
 Ob4onD7gZud2C6bjwOVNXLckaq+u
X-Google-Smtp-Source: AGHT+IFlUynQrJJW0E4+IO29Zz3my241w56+4rIM/9zRuPd/gNhQlSaJxZbAmMmCKXNLpmHKug+y6g==
X-Received: by 2002:a05:600c:1c14:b0:436:51bb:7a43 with SMTP id
 5b1f17b1804b1-4390d4306f9mr20575425e9.5.1738758669115; 
 Wed, 05 Feb 2025 04:31:09 -0800 (PST)
Received: from localhost ([2a0c:5a85:d30b:5b00:e0fa:f916:8548:a2b8])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-4390daa0cbcsm19553385e9.40.2025.02.05.04.31.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 05 Feb 2025 04:31:08 -0800 (PST)
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] guix: fix map-derivation not handling directories
Date: Wed,  5 Feb 2025 13:29:33 +0100
Message-ID: <bd6d0cd65d321f03aad528391cc782564a405130.1738758574.git.sergio.pastorperez@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71941
X-Mailman-Approved-At: Wed, 05 Feb 2025 09:46:11 -0500
Cc: ludo@HIDDEN,
 =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

The `map-derivation` procedure was trying to process directories as files.
When a derivation had a 'module import' directory as input, it threw an
exception since it tried to open it as a file.

Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6
---
 guix/derivations.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd26a..9c019a35bb 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1074,8 +1074,10 @@ (define* (map-derivation store drv mapping
                                     ((_ . replacement)
                                      replacement)
                                     (#f
-                                     (substitute-file source
-                                                      initial replacements))))
+                                     (if (file-is-directory? source)
+                                         source
+                                         (substitute-file source
+                                                          initial replacements)))))
                                 (derivation-sources drv)))
 
              ;; Now augment the lists of initials and replacements.

base-commit: d0dbba3053123ee623d8a5889f1a0946859a205e
-- 
2.48.1





Information forwarded to sergio.pastorperez@HIDDEN, guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at 71941 <at> debbugs.gnu.org:


Received: (at 71941) by debbugs.gnu.org; 1 Sep 2024 16:16:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 01 12:16:49 2024
Received: from localhost ([127.0.0.1]:37900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sknFx-0005JJ-1z
	for submit <at> debbugs.gnu.org; Sun, 01 Sep 2024 12:16:49 -0400
Received: from mail-am0eur02olkn2051.outbound.protection.outlook.com
 ([40.92.49.51]:25184 helo=EUR02-AM0-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sergio.pastorperez@HIDDEN>) id 1sknFu-0005J4-LS
 for 71941 <at> debbugs.gnu.org; Sun, 01 Sep 2024 12:16:47 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=WDIYdWV1OtO45RNzMA4CJ/IVbHzx0w0NnpJHgJ5gQKuyE4DH5MvsIYVuZRlrGSn8kkd8uAglvof7movq69miDZVlRzucU0VHnldETUcQFdsx4jCXiz/RFiq0R+trxbgFjfAfujVLiwCVOuhPKRaa0O1X+UHWsRqMq3bjqlBpQacfaxxLTpZAnocOhxTgZN/IOLzQBXyY9odcR/TdVzg3Sz5HFpCerDcEi56ewz42z1TPwVJ4UulX27mLgrKP4polMB+AneAD7bAPiTZHgYTaqLZPRNC86E732Ly21hs5J6ymgeQzSIXkrsk/FnbCMz+zHXaBUqf0dayPutyNuPaKcA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=V0SYrh/qTmFhWJV1FEPcPHEuqZgozxq3d9lo+zDeM/s=;
 b=TfcXgayAI5VDyPc8dBx+gN6c6dSCUjW7ak6CArJ19ba+xq0xqtUwbMCelrW1a7n4w4KL0ImoLwcQlfRH8gs+uEIJaKoGxZ/y02D1yfKpx5vnGRPmDCT5F5mGPvKIyy/NT+j7SJzV+yUD4MYX9Pb5m+Q0I8XWAy2IEniYIGFH63ZIsp7FRHL7EGWz0X9Y+bD0YRvO6vaeD1OHLcXNAzrWS94lFucf2Sc8exZEWlcQB5GtTzMF08U7puIKFEZ+mh2154w1IIuXE5sih8JLenANkn8roGvXwL1qBA2TkSVfZZTYH+1Tk3TrZ98GLzgTh3l30JW8iVz5aF/VCVipdtUnog==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=OUTLOOK.ES;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=V0SYrh/qTmFhWJV1FEPcPHEuqZgozxq3d9lo+zDeM/s=;
 b=WCA+u6SYYUSkZCg1UCfJgsG5byQrGbXCQfv8B0xwZtGBguLR3UXP4bbCwkc0/M2ADJ2qIDx+isMnITEHC7CLTqt2cHRYdeWAxVh59OqQ/rv3LB/P4s5jBMPRAQnoW5Xko0zPSY/emT1299kdIEFPeQygdr/pficurEfArV1qLSakQiNcwEXGugDjvILL99VAeAbrP+a/itJMlEU5VP78GY4Nbx+M74QY6bfbe/SQgB1mE37WR8KN4Dib3I1sjJSPjTKLeXLE7RW6Vm2H1n5789QAMUYOQdVup04WZEeBqXLYA7FB8iZ9iMUV3baDJVVsA6JhGanIM6k5tLGPKCqOfw==
Received: from PAXP251MB0348.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:20b::10)
 by AS8P251MB0017.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:344::14)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23; Sun, 1 Sep
 2024 16:15:39 +0000
Received: from PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 ([fe80::1f4f:1f6b:1817:f03f]) by PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 ([fe80::1f4f:1f6b:1817:f03f%7]) with mapi id 15.20.7918.019; Sun, 1 Sep 2024
 16:15:39 +0000
From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: 71941 <at> debbugs.gnu.org
Subject: [PATCH] guix: fix map-derivation not handling directories
Date: Sun,  1 Sep 2024 18:15:05 +0200
Message-ID: <PAXP251MB0348632A500D4E1B1A078B75F3912@HIDDEN>
X-Mailer: git-send-email 2.45.2
X-Debbugs-Cc: Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-TMN: [biiLYjWv16eoPHWSqw+Cj3oRtqhG+VIA]
X-ClientProxiedBy: MA2P292CA0001.ESPP292.PROD.OUTLOOK.COM
 (2603:10a6:250:1::17) To PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 (2603:10a6:102:20b::10)
X-Microsoft-Original-Message-ID: <b54d762854d1b07e386d8c530a22680308cc8c41.1725207305.git.sergio.pastorperez@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXP251MB0348:EE_|AS8P251MB0017:EE_
X-MS-Office365-Filtering-Correlation-Id: a6f74ecf-0915-4d62-f357-08dccaa15187
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|5072599009|461199028|15080799006|19110799003|8060799006|1602099012|3412199025|4302099013|440099028|1710799026;
X-Microsoft-Antispam-Message-Info: H/n95uhNbNYkDvoGw41XmKiK1PPT92to8HzPm4RHpFJYskBCCLyFOPzadSat2vnJ/6/cQG5wxfv199XkYJZDb5OaIUFbh1IcygTAP4RuU/kzpMbg+xz38ybWoJ/hPDkuVOoLtmFvh4i5KM+GauJEgGxGi/XwWcpMwdL9uStUkzGBeID2utFVSzKXX2/BpEZy6ULSLjO/NQLmiaEudGr4e2ucnByKG3mzyjVp3iDQBBAViRpPfgvZiVDMo9Z940zKBemLGUTJSp2/qYQx2NUm2GL5fIt8YPKLasJzNH32Xppad2x5IZ9QyaUbe7FpHviTzu+X51d47hrb8GokiPUCNoVvXEK/nzbg5QYwxHCQNQ+Cjn6IkXDMh0lrVGQ0rA/dfXP13ap3i4dHRW/NhX7jZych62vm4c9MNy4VnS7gYdmI/JbHWW0wRxjBCzZCFGUgSCDMx17Ao0xMWmmRTbvp/HOI+wwF9T7MryihfOK9k89pEfokm32QICATHMQ7La+L3ba05R4da4LjxuItDFUOh2mvZpws3bUgXTrQDTam1hQjaLtL4jaFy8p2KYik2q3dXyyXmo3wDOsRg/+W3N0j0XZlOm7BxlfSSERFqoO3oIiP0qcfmJ71fYZDD+lrdD7VqTIlAvQTNlBSVi76V/J6m17S6DUeUwwfIsq/AVIGlq7r2fUnEEJOIZP8oL7Dhn3MVLO2hu8ZoA/OeyOuvF3vd02btGBhMhTFrYtfYWmxyubND/Nk28j4XfGZjM0Th9PDjnwaS4OtGADcFKyFZZQESbOb/7Hk7ewUM8PeuOd5SsNQGiTCLDUtkBJOcFDyCYpV6WKQtoK/fCbqQ79SIi3yKKof/GCmYVlOlc5EoAjYgFRfDlJlMdi3GohIy3Nk4MP6KhgsmxuXyNGQoFcYB8bnsQ==
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?s73v1wE6xIfj17wM6H6KPVXG1Abo3wFrf28tbDVhU1m4b8+oIrnfedgupAL0?=
 =?us-ascii?Q?dx58962Fvv1ogoY/w7OD/fMjzjcnChHYrvEJy3aH5ylITGzntf6SlvQmx6r6?=
 =?us-ascii?Q?ptzpps/neUhpe327jvPZFAsjgToZr9rTyC7o7N10zmhN0xoc+dMkE5+wR4jN?=
 =?us-ascii?Q?mmmQO5oB1q391X/qWdMtzTG13BIEkaLAq+rZ17m1WGhY/VWrtlBYyRifJ9ak?=
 =?us-ascii?Q?Z9FtCxIy12EZNZc/542jxx9E0PdSqxFflqPEKglxaM1YP//MKnp0DRAVnbxP?=
 =?us-ascii?Q?QYkEMoYQcYub9SGRWFkejXoIpioOz0JDHhrWi1s375dmzGyRZSDVYkQnfRVM?=
 =?us-ascii?Q?DKfFiK50Hj96oHNIqs+zUsigHu9Bgibi2dnR7I1hph9l3CACWg2+Mha8OI1d?=
 =?us-ascii?Q?TCx/vXFH8Zty1koehKr2ZJ1uiXNpz/73DA4xiuJ8jhXkrxRVWh/7W+bnY1E/?=
 =?us-ascii?Q?TkV6wlpb0I0xaQNo1sbdfPyJqqnS/fPvj5In8w/XpdvV9bKi9TRg3OmqKpEr?=
 =?us-ascii?Q?fxHg7VdGJUdj4dxixZw13MUZChuTbmt79jd3gNyy3ZGSt6ZHx0zLWlNU6Xm3?=
 =?us-ascii?Q?uZYnxF+z1LGLOXwNbllTSDSpI38OymH2N0dUfdd5eBvxKZBmR3WY81tTzuTt?=
 =?us-ascii?Q?HsEY2EMCsjhodhrKQOZEs+xSn3/9nqj7bpWHhT9iaiJLuBMWoNLzh0d62pYI?=
 =?us-ascii?Q?bexl8BBN2CrOE1B7gx0X1wNCntLG2S15ms63vqqsDfIgVk6qgUYJlO2VNXIt?=
 =?us-ascii?Q?5GJQVgBRM4uWsG2+qEl1gu6zfiB6Jn/ifjByGZNwyxJ3qZJMxtMAJN0tuWTl?=
 =?us-ascii?Q?inSDqwHd7X9QhZ1F+8atZUiWYnHkd4Ut0DCQ6PuOYuRFTVkrTjjEZh99grKS?=
 =?us-ascii?Q?Tyg5Up7I0vxTg6LfoUvdOUZEgFRSsoTC/yRsKKr5SxqPpuUQlRH4D92wc6Xa?=
 =?us-ascii?Q?m1QxorJjysLRn5gicXALs3qNlvvG9FDGt5wpQUdC/RXfBDF9f1hI14BkDJ6+?=
 =?us-ascii?Q?UZJnuVTiROlLzUXuBVg1lLWXZxLNRtYZTpPvw2GHmKPQBU25rHn2aFDsTBLP?=
 =?us-ascii?Q?xIIwO7ly+giZCVOpBaYOpXGsZtFgNn+iJclAYf2P+VP+mpV7l1pR7EOPl84B?=
 =?us-ascii?Q?ABgL+uR/uoogfeSWk07ccRYFzHyVlGz8uQoaVx6fTswAwVLu+iEdNyvXUWla?=
 =?us-ascii?Q?OHzDFgXXhfB3fWHt/OYJJVJwp62n+6YkdR2q/IIXkg/49nPU/5u7kHGk/j9g?=
 =?us-ascii?Q?PqOhyBvr8HabXc+7BPWp?=
X-OriginatorOrg: sct-15-20-7741-18-msonline-outlook-53ebb.templateTenant
X-MS-Exchange-CrossTenant-Network-Message-Id: a6f74ecf-0915-4d62-f357-08dccaa15187
X-MS-Exchange-CrossTenant-AuthSource: PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2024 16:15:38.8953 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P251MB0017
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71941
Cc: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= <sergio.pastorperez@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.0 (-)

The `map-derivation` procedure was trying to process directories as files.
When a derivation had a 'module import' directory as input, it threw an
exception since it tried to open it as a file.

Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6
---
Hi, as far as I know 'module import' directories don't contain derivation
references, so it should not be needed to apply `substitute-file` on the files of
those directories. This fix just returns the 'module import' directories
untouched. Thoughts?

Note that `map-derivation` is very slow. I could only test it with tiny
derivations, such as the ones provided in the '(gnu packages commencement)'
module.

You can test it with:
--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (use-modules (guix store)
                                  (guix packages)
                                  (guix derivations)
                                  (gnu packages games)
                                  (gnu packages bootstrap))
scheme@(guix-user)> (with-store store
                      (let ((bootar-drv (package-derivation store (@@ (gnu packages commencement) bootar)))
                            (guile-bootstrap-drv (package-derivation store %bootstrap-guile))
                            (cowsay-drv (package-derivation store cowsay)))
                        (map-derivation store
                                        bootar-drv
                                        `((,guile-bootstrap-drv . ,cowsay-drv)))))
$1 = #<derivation /gnu/store/qwn18yxc1ccdxq1mgg863lfxsfwng3wk-bootar-1b.drv => /gnu/store/852xy3bhck2sd1hq1rmzai0px7fplxfq-bootar-1b 7fcfc3f05b90>
scheme@(guix-user)> (derivation-inputs $1)
$2 = (#<<derivation-input> drv: #<derivation /gnu/store/5rx5dn2xnkjs3q0rzpm66q79ndwrafp7-module-import-compiled.drv => /gnu/store/472plnlfm8yrb3axwy16fydq01idbkv1-module-import-compiled 7fcfc3f05d70> sub-derivations: ("out")> #<<derivation-input> drv: #<derivation /gnu/store/fhqh9f3lmf8wd9mh0bzavpkjnmsb0bg0-cowsay-3.7.0.drv => /gnu/store/vwa9vh21l68ivnwxj18s2gxd1v71w43r-cowsay-3.7.0 7fcfb73a50f0> sub-derivations: ("out")> #<<derivation-input> drv: #<derivation /gnu/store/k6852ja7cvdvbbdxh24ph711gm74m3qq-bootar-1b.ses.drv => /gnu/store/xmw3h03svpw6rwfg03f0m608zkm24qx8-bootar-1b.ses 7fcfc3f05f00> sub-derivations: ("out")>)
--8<---------------cut here---------------end--------------->8---

As you can see, with this fix, the new derivation has the `cowsay` package a an
input.

I would like to encourage people to discuss ways to improve the performance of
this procedure. It would be very useful for system wide package rewriting as
discussed in this thread[1].

[1]: https://lists.gnu.org/archive/html/guix-devel/2024-06/msg00275.html

Regards,
Sergio.


 guix/derivations.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index a91c1ae984..c16e1c2be3 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1062,8 +1062,10 @@ (define* (map-derivation store drv mapping
                                     ((_ . replacement)
                                      replacement)
                                     (#f
-                                     (substitute-file source
-                                                      initial replacements))))
+                                     (if (file-is-directory? source)
+                                         source
+                                         (substitute-file source
+                                                          initial replacements)))))
                                 (derivation-sources drv)))
 
              ;; Now augment the lists of initials and replacements.

base-commit: e1c92c98f7afff13fb7060199ba0dd4d9c5c2c53
-- 
2.45.2





Information forwarded to sergio.pastorperez@HIDDEN, guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Jul 2024 15:05:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 04 11:05:20 2024
Received: from localhost ([127.0.0.1]:42702 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sPO1Q-00048A-1X
	for submit <at> debbugs.gnu.org; Thu, 04 Jul 2024 11:05:20 -0400
Received: from lists.gnu.org ([209.51.188.17]:56888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sergio.pastorperez@HIDDEN>) id 1sPO1N-000483-UX
 for submit <at> debbugs.gnu.org; Thu, 04 Jul 2024 11:05:18 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1sPO1L-0002xs-3h
 for bug-guix@HIDDEN; Thu, 04 Jul 2024 11:05:15 -0400
Received: from mail-db5eur02olkn20801.outbound.protection.outlook.com
 ([2a01:111:f403:2e08::801]
 helo=EUR02-DB5-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sergio.pastorperez@HIDDEN>)
 id 1sPO18-0004e2-UU
 for bug-guix@HIDDEN; Thu, 04 Jul 2024 11:05:14 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=OOZmGvZioi54LvvweWUeYidFecir6v+b3ijSkAdjmuTyHhTgbedhkmmoxkIIClAoa2cm9E2NXUFP+lkFt4lbNZGTdfrjChIgLKioIHP4zkofidKJEiXmhkRaQRWxgobHLUZWg5pXjd94ewQ8cYEbGrXvg7Po3Lftt3ugEyM5f6hGmrsudPYwrlp+wOPLoJnFV5QRSBWUOtS9jGwvl5qPABE6+SxTssQVNfuNZp3VNB+wCKrfPVlMw2Mh6LHK+QH8tzlB9i/BvRKvIufmaqUp5r24PPobW0tUiWu3dPIX00k9HrklsqSJ5yBMbmxm/W39rNvsi1Y5cSsGVoxDNYoNYw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=yMZSYIFhLp6+520fb90YeA9bNOSqz3doFTvoR74lbEU=;
 b=fCuO6NQy9f0IWLBJTS+Q1m1Nr9qRthwjjz1pDhF+j0TR+GQnDteIEO0aINqfrImRQJ0T9ZU+dybFVdxrSf4fodUAnKMaDgdvDBsUw2Ul9xFWjKhaKfc50cIOZXy//Y2+ebqUIospF5bT+0LNLBD5RiRDfA8650P8sWjUqaP3Fsyhu3gqV91pDifpcKGGwF+AAoohhqQZ6ntOimOOyvm+AFNXkyh3ptZwTO/9VaO1dKY1Qe9y60522Gb8CnasdQEMzUZICBt/97qDF9E2lX48kMVqCzMxL1IVmXQ386dTn8L9RBylGWKWy+k49SmAUt2uJNvG/tVDzhbdOqk1HBlA0Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=OUTLOOK.ES;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=yMZSYIFhLp6+520fb90YeA9bNOSqz3doFTvoR74lbEU=;
 b=VguSAXHrALixoykcCEVEzAlg1sH1XRjTqyBGNwZNKrx9zEdQlJFlD70slQ6pHXT1cEdq3XWEL/7XkOEPbZ0scdVmXIxts1yAueFmQHy7MvUZmjk0amFXUgv3T16TEg407OKFuhjKkvDuuKXRAOs0OJZ8cUS9p+QEMCWNWmgtc60cp7zXjmJkFd70q9EUdDIoGqUQeoGik2wzyO0gbysjt5v3eJm3V0mSlKzKxsA4F4uxmNjDbpbI3tqr8+0zImfAFsvpdaYk6hW2omzYRpC5gxWxErRBrblnakkQa46JbLp7RaOapL82JT4ronlwNX04QHiB5OH847ig8OZGV5YoiA==
Received: from PAXP251MB0348.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:20b::10)
 by AS1P251MB0583.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:48e::21)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.25; Thu, 4 Jul
 2024 14:59:58 +0000
Received: from PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 ([fe80::1f4f:1f6b:1817:f03f]) by PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 ([fe80::1f4f:1f6b:1817:f03f%5]) with mapi id 15.20.7741.017; Thu, 4 Jul 2024
 14:59:57 +0000
From: =?utf-8?Q?Sergio_Pastor_P=C3=A9rez?= <sergio.pastorperez@HIDDEN>
To: bug-guix@HIDDEN
Subject: Broken `map-derivation' procedure
Date: Thu, 04 Jul 2024 16:59:55 +0200
Message-ID: <PAXP251MB03489F8E853184BD49C9D310F3DE2@HIDDEN>
Content-Type: text/plain
X-TMN: [5Ml35NG1SADJKq5oB/xu3KMJZpkrkFIH]
X-ClientProxiedBy: MA3P292CA0006.ESPP292.PROD.OUTLOOK.COM
 (2603:10a6:250:2c::14) To PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
 (2603:10a6:102:20b::10)
X-Microsoft-Original-Message-ID: <84tth5i4no.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXP251MB0348:EE_|AS1P251MB0583:EE_
X-MS-Office365-Filtering-Correlation-Id: 37c422bd-929c-4d7e-1a10-08dc9c39f804
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|8060799006|461199028|440099028|3412199025; 
X-Microsoft-Antispam-Message-Info: V9fhZ6qVq76CeVlbdw/6XjNIqdM985jD5N8XyO4do1Rq3ZavvVTuVVEZFw6VnS9ucBiGIIn6ptvCDDp77N/jy2t0dyL1HabxEB2PtIT11BdMm4mfs5TJ4PuTPuL0nfLnIBxM0p3i3cG59V5I9Osr6iukdPZ5uCdIpRaCAn/dX8LcY/JHxfB4ZAu85Rno6MTKSKnura2nm5+ieFtwtgUmQcsV1WCOfHKQJm0AiWs+d3ZaUUgMh+QGG5bMcvN204P2CJ71IvbY8+90JyeYbLdcuIN7k5hYzqRiSxChH8l6SCvqNbYJ688QO8kObJRyRrLpURPoNqu6BhNBP5IykAXwlN4Qz/If1OJth0pNvIUr2GWLanDvTLErundemwXESZTDwL4+BZrCyQFQCUrAvFiXu+yp8Z4qlYJmjHjNNNtxf1+qiP9VwK1yZqPJcU/z8aFVZAG4oidhODV2k3VVTNQV49G2POrsNuhlLvMWbFMTiW+cH/ZAijTY6BBUQc3tzYR3g9Z9XPn97VhczKTOXPDUOVp02MF8HKQuyMAU7+oDBo5+tR4pszWt9Nhj+vStUKT979k6ZPrL+j5A38MbLZoxpi3V2hR2/R6Ld4PT/RtxthIEhDNBM+8cUX4JPcFH4EvP
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cFH/du7eHVnEWqN3dsMoCUw7qLS7+vKR/8nd8lUDbcZnh3ySfpExlYhgf7ps?=
 =?us-ascii?Q?/zto8F6+yOqCQtSAlO3CrlfWIhnbIBra7SnvUgCgzaCa5cqGylqR/cFUGP4D?=
 =?us-ascii?Q?C4ScNSc5Y78G025Iprp4kM0pMBRwbwrXbHWx8wW9J+Lq4OvtXEi8HY58MxwU?=
 =?us-ascii?Q?UM1Z7gpjeGiZdWEps2hhats15FQxYdHHA4paJNZg+WVPdILnr44wh5UpTORo?=
 =?us-ascii?Q?Z7gJ96GjU1nbmSYdKo/IE0kQWEG8dk5hRfIFjf9kn/73bYsCtT1z0Jd2PBWa?=
 =?us-ascii?Q?C8rT5ufS/7hxvVuMiVl9/fc68FjLg4q8RlGrY0mWdETR6aGTOG2GfZfYHUnC?=
 =?us-ascii?Q?4Oa+7/BthJfX00DYMSv+4qScSwm3PLH8Y0+PEJh3wPiObF88QkF1fn+PhoEB?=
 =?us-ascii?Q?IkJKYg8wa348D3vcqgRWvGKn+e2+f+DfucDA9nlaDkoABy81qMRqa4dRxp+Z?=
 =?us-ascii?Q?mNcK0O9MS+UfvdX7TXFxgbvfmRVma9fCVJ3LAGx5tZjNBkFGov5cGLACM9Ur?=
 =?us-ascii?Q?S1tmPt31IkX4jXA20jIeRL3jjxE/oFpwDVLDyuzMVHWUS063Kb4qBIRwgUJ3?=
 =?us-ascii?Q?tLVN2VFi92/JiH6XNEVARw0RvMUxRN6FCf3LVw0uyDGryB4OwOCegz3F/9lv?=
 =?us-ascii?Q?Ww2URU/Nbrtr7V3a/O6sM4yumRO3huQHfbtdozWaWtvL7rka0Ki0wiZktqen?=
 =?us-ascii?Q?QothWtHmvRPDXwDdM/NGUruzxrb0PsnX440MiMr50azieldlBT4mSe47H7+K?=
 =?us-ascii?Q?CpeXIC+mCUTBn3kKbAIufp45i5XPqm8nxh5OKtxTq2dg181mXPzLzCC07QMj?=
 =?us-ascii?Q?knud5I0hdpcF1aYN166mjxqwwJbP7wF5qOy3HpX2ALw+t22yVzN8RoGqhjyX?=
 =?us-ascii?Q?4Gt8xplJK/tYKt6/tsqb3rx9PzzXCPbqIf7ium+6yQQDfBDR/bVV19Pvzl31?=
 =?us-ascii?Q?98bBFJQwsxgYgOR82rKhUbVaHJ5jCFddZJA/JpWWeHEPlFP/bnU5/c923m+E?=
 =?us-ascii?Q?8QffO15pe5ZZuEeeT6X7LTG/XsA7/7abnpOdJpnGGG8GGD6Wg65mXAfrHQPc?=
 =?us-ascii?Q?MDL36gT1hdoAtcJCxU7vn4GHDFSRkM8Y5zO+PnkyphXYj4ecQmb1+NgvIULE?=
 =?us-ascii?Q?Jj0ktJWi1uIg8jLZVrxmUG9lRDcCRHOG1c/fdtMu4N/Ui+gPmqgEY0pxzRFT?=
 =?us-ascii?Q?vAsfsmDd91YqCi/3s4IzOX7Imt8uBZa/lwv3o41JPCi1Sue0U8Rfwqt9ELOM?=
 =?us-ascii?Q?uTtGeL1omb4W5tvIvcPu?=
X-OriginatorOrg: sct-15-20-7741-18-msonline-outlook-53ebb.templateTenant
X-MS-Exchange-CrossTenant-Network-Message-Id: 37c422bd-929c-4d7e-1a10-08dc9c39f804
X-MS-Exchange-CrossTenant-AuthSource: PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2024 14:59:57.1905 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1P251MB0583
Received-SPF: pass client-ip=2a01:111:f403:2e08::801;
 envelope-from=sergio.pastorperez@HIDDEN;
 helo=EUR02-DB5-obe.outbound.protection.outlook.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
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: -2.3 (--)

Hello.

The procedure `map-derivation` from `(guix derivations)` seems broken.

Evaluating this yields an error, it probably shouldn't:
--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (use-modules (guix)
                                 (guix derivations)
                                 (gnu packages)
                                 (gnu packages perl)
                                 (gnu packages games))
scheme@(guix-user)> (with-store store
                      (let ((cowsay-drv (package-derivation store cowsay))
                            (perl-drv (package-derivation store perl))
                            (perl-5.6-drv (package-derivation store perl-5.6)))
                        (map-derivation store
                                        cowsay-drv
                                        `((,perl-drv . ,perl-5.6-drv)))))
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure fport_read: Is a directory

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix-user) [1]> 
--8<---------------cut here---------------end--------------->8---

If you inspect the `cowsay` derivation, you will see that the mapping
should be possible since it contains the `perl` derivation.

Does anyone have an idea on what could be the issue or how to investigate
further?

Thanks,
Sergio.




Acknowledgement sent to Sergio Pastor Pérez <sergio.pastorperez@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#71941; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 1 Mar 2025 18:15:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.