From 4b5cab0680420f9f86366c6c587f988c7c2e957d Mon Sep 17 00:00:00 2001
From: siiky <github-siiky@net-c.cat>
Date: Sat, 1 Jul 2023 19:17:30 +0100
Subject: [PATCH] Avoid crashing on egg files with non-string `version` field

`chicken-install` would crash when building a path if the `version`
field of an egg file was not a string, such as `2.0`.
---
 chicken-install.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/chicken-install.scm b/chicken-install.scm
index 4a6eb9b1..3af7686c 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -486,12 +486,12 @@
      (else
       ;; <location>/<egg-name>/<version>/<egg-name>.egg
       (if version
-          (values (probe-dir (make-pathname egg-dir version)) version)
+          (values (probe-dir (make-pathname egg-dir (->string version))) version)
           (let ((versions (directory egg-dir)))
             (if (null? versions)
                 (values #f #f)
                 (let ((latest (car (sort versions version>=?))))
-                  (values (make-pathname egg-dir latest) latest)))))))))
+                  (values (make-pathname egg-dir (->string latest)) latest)))))))))

 (define (write-cache-metadata egg-cache-dir egg-version)
   (when egg-version
@@ -576,7 +576,7 @@
                         (loop (cdr srvs)))))))
           ;; The order of probe-dir's here is important.  First try
           ;; the path with version, then the path without version.
-          ((or (probe-dir (make-pathname (list (car locs) name) lversion))
+          ((or (probe-dir (make-pathname (list (car locs) name) (->string lversion)))
                (probe-dir (make-pathname (car locs) name)))
            => (lambda (dir)
                 ;; for locally available eggs, check set of files and
--
2.40.1