From c91ba17a7750eb281556814d666a08ce0908ed9c Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Sat, 12 Jul 2014 16:15:43 -0400
Subject: [PATCH] Fix bug in UIOP/PACKAGE:PACKAGE-DEFINITION-FORM: don't use
 destructive SORT without COPY-LIST on shared data structures. Bug found by
 drmeister.

---
 uiop/configuration.lisp | 2 +-
 uiop/package.lisp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/uiop/configuration.lisp b/uiop/configuration.lisp
index 5e1b8788..07e90e62 100644
--- a/uiop/configuration.lisp
+++ b/uiop/configuration.lisp
@@ -148,7 +148,7 @@ this function tries to locate the Windows FOLDER for one of
     "Map the VALIDATOR across the .conf files in DIRECTORY, the TAG will
 be applied to the results to yield a configuration form.  Current
 values of TAG include :source-registry and :output-translations."
-    (let ((files (sort (ignore-errors
+    (let ((files (sort (ignore-errors ;; SORT w/o COPY-LIST is OK: DIRECTORY returns a fresh list
                         (remove-if
                          'hidden-pathname-p
                          (directory* (make-pathname :name *wild* :type "conf" :defaults directory))))
diff --git a/uiop/package.lisp b/uiop/package.lisp
index 77ff4101..1d928a32 100644
--- a/uiop/package.lisp
+++ b/uiop/package.lisp
@@ -317,7 +317,7 @@ or when loading the package is optional."
                        (imported)
                        (t (push name intern)))))))
         (labels ((sort-names (names)
-                   (sort names #'string<))
+                   (sort (copy-list names) #'string<))
                  (table-keys (table)
                    (loop :for k :being :the :hash-keys :of table :collect k))
                  (when-relevant (key value)
-- 
GitLab