Hi all,

I reported a chicken-install bug on IRC but figured it would be best to send an email in case people have missed it there.

The bug is that chicken-install fails to install/update an egg because of an error thrown by `make-pathname`.

I first encountered it trying to upgrade all my installed eggs. In particular, it failed trying to install sql-null. The root cause seems to be the `version` field of the egg file, which is a number instead of a string. Not sure it could make a difference, but I'm using the all-eggs repo.

In this paste[0] you'll find the error, possibly problematic egg files (i.e., files with a non-string `version` field), and two possible patches (one of which I send attached). Two of the egg files result in an "unterminated list" error (math:0.2.2 & message-digest-utils:4.2.2), but they're not the latest version so not problematic anymore.

The reason for the two patches is that I found 3 possible "bad uses" of `make-pathname`, but one of them alone fixes the original problem. Maybe chicken-install can fail in other scenarios, I just couldn't understand in which...


[0]: https://paste.call-cc.org/paste?id=8ad4220ef964af3976d87c142a248e60d2f52229


siiky
From 612d1394bf2ba9c97e993148ac44cf44d28d1aa8 Mon Sep 17 00:00:00 2001
From: siiky <github-si...@net-c.cat>
Date: Sat, 1 Jul 2023 19:50:12 +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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chicken-install.scm b/chicken-install.scm
index 4a6eb9b1..628d64f1 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -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

Reply via email to