Hi folks,
Here's a bugfix for an error I encountered running "chicken-status -cached":
Error: (map) bad argument type - not a list:
"/home/evhan/.chicken-install/cache"
Details in the commit message.
Evan
>From 4538cb5fc3f961009a1d325fa181432af51b8b21 Mon Sep 17 00:00:00 2001
From: Evan Hanson
Date: Mon, 27 Aug 2018 18:13:34 +1200
Subject: [PATCH] Fix error in "chicken-status -cached" due to `map' with
string argument
In 7a7d0be0 we added a clause to `list-egg-info' that maps over its
`dir' argument, but that may be reached when `dir' is a string (causing
an error). This procedure only actually needs to handle two cases,
installed egg-info files and egg or VERSION files in the cache, so we
simplify the procedure to fix this bug and remove some redundant logic.
---
chicken-status.scm | 20 ++--
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/chicken-status.scm b/chicken-status.scm
index e145e32a..93e0a161 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -110,19 +110,11 @@
(define (list-egg-info egg dir ext)
(let ((version
- (cond ((let ((info (read-info egg dir ext)))
- (and info (get-egg-property info 'version
- ((and (string? dir)
- (file-exists? (make-pathname (list dir egg) +version-file+)))
- => (lambda (fname)
- (with-input-from-file fname read)))
- ((chicken.load#find-file +version-file+
- (map (lambda (d)
- (make-pathname d egg))
- dir))
- => (lambda (fname)
- (with-input-from-file fname read)))
- (else "unknown"
+ (or (let ((info (read-info egg dir ext)))
+ (and info (get-egg-property info 'version)))
+ (let ((file (chicken.load#find-file +version-file+ dir)))
+ (and file (with-input-from-file file read)))
+ "unknown")))
(print (format-string (string-append egg " ")
list-width #f #\.)
(format-string (string-append " version: "
@@ -133,7 +125,7 @@
(when (directory-exists? cache-directory)
(for-each
(lambda (egg)
- (list-egg-info egg cache-directory +egg-extension+))
+ (list-egg-info egg (make-pathname cache-directory egg) +egg-extension+))
(sort (filter-egg-names (directory cache-directory) pats mtch) string___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers