guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: system: Do not delete all nss-certs packages when they are the sa


From: guix-commits
Subject: 01/02: system: Do not delete all nss-certs packages when they are the same object.
Date: Wed, 15 May 2024 22:57:19 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 35ae95061e1b843e1df069693177519f22f9a16d
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed May 15 22:47:59 2024 -0400

    system: Do not delete all nss-certs packages when they are the same object.
    
    Calling 'delete' on the list of packages would delete *all* occurrences of a
    given object, not just the first one.  This meant that if the user had
    something like:
    
      (packages (cons nss-certs %base-packages))
    
    In their operating system declaration, no nss-certs would end up in the 
final
    list.  To guard against this, guard against this by checking that more than
    one nss-certs package exist even after deduplication.
    
    * gnu/system.scm (operating-system-packages): Guard against deleting all
    nss-certs when a single nss-certs package object is listed multiple times.
    
    Fixes: https://issues.guix.gnu.org/70850
    Change-Id: Id93be9242e026fd2e96a442941df80b94664ef9a
---
 gnu/system.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index cb6e719ca6..c76f4d7c50 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -339,7 +339,13 @@ VERSION is the target version of the boot-parameters 
record."
                    (G_ "multiple 'nss-certs' packages found; 'nss-certs' \
 is now included by default in '%base-packages'; ensure it is not explicitly \
 listed in the operating system 'packages' field~%"))
-          (fold delete packages (drop nss-certs-packages 1)))
+          (let ((nss-certs-packages (delete-duplicates nss-certs-packages 
eq?)))
+            (if (> (length nss-certs-packages) 1)
+                ;; Only mismatched nss-certs packages need to be handled to
+                ;; avoid profile collisions; same objects are later
+                ;; deduplicated in `packages->profile-entry'.
+                (fold delete packages (drop nss-certs-packages 1))
+                packages)))             ;no-op
         packages)))
 
 (define* (operating-system-kernel-arguments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]