From 960c6ce96d746cf19829ad26e092ec5dad2a5c62 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 3 Jul 2017 23:35:56 +0200 Subject: discovery: Recurse into directories pointed to by a symlink. Reported by Christopher Baines and Alex Kost at . * guix/discovery.scm (scheme-files): When ENTRY is a symlink that doesn't end in '.scm', call 'stat' and recurse if it points to a directory. * tests/discovery.scm ("scheme-modules recurses in symlinks to directories"): New test. --- guix/discovery.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'guix/discovery.scm') diff --git a/guix/discovery.scm b/guix/discovery.scm index 292df2bd9c..2741725b9d 100644 --- a/guix/discovery.scm +++ b/guix/discovery.scm @@ -60,11 +60,21 @@ (define (entry-type name properties) (case (entry-type absolute properties) ((directory) (append (scheme-files absolute) result)) - ((regular symlink) - ;; XXX: We don't recurse if we find a symlink. + ((regular) (if (string-suffix? ".scm" name) (cons absolute result) result)) + ((symlink) + (cond ((string-suffix? ".scm" name) + (cons absolute result)) + ((stat absolute #f) + => + (match-lambda + (#f result) + ((= stat:type 'directory) + (append (scheme-files absolute) + result)) + (_ result))))) (else result)))))) '() -- cgit v1.2.3