From 2b8cf44fd9207c5e46b8fc1a000645bd3bc89baf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Tue, 14 May 2013 13:37:21 +0200
Subject: [PATCH] Fix "guix --help" on Guile 2.0.5.

Reported at <http://linuxfr.org/news/sortie-de-gnu-guix-0-2>.

* guix/ui.scm (command-files): Filter the result of `scandir' to make
  sure only `.scm' files are present.
---
 guix/ui.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index addc3ac334e..ca0d4249ec2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -397,8 +397,14 @@ (define directory
            (compose (cut string-append <> "/guix/scripts")
                     dirname)))
 
+  (define dot-scm?
+    (cut string-suffix? ".scm" <>))
+
+  ;; In Guile 2.0.5 `scandir' would return "." and ".." regardless even though
+  ;; they don't match `dot-scm?'.  Work around it by doing additional
+  ;; filtering.
   (if directory
-      (scandir directory (cut string-suffix? ".scm" <>))
+      (filter dot-scm? (scandir directory dot-scm?))
       '()))
 
 (define (commands)
-- 
GitLab