guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-79-gfa8110


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-79-gfa8110f
Date: Mon, 19 Dec 2011 08:18:47 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=fa8110f2412c260d69db10739357ea593eb9eefe

The branch, stable-2.0 has been updated
       via  fa8110f2412c260d69db10739357ea593eb9eefe (commit)
       via  de92987002224276dafc0875873b30149e964828 (commit)
      from  3cc21d7995313782f6def1789ca0150e95c8363f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fa8110f2412c260d69db10739357ea593eb9eefe
Author: Ludovic Courtès <address@hidden>
Date:   Mon Dec 19 09:18:42 2011 +0100

    ftw: Fix typos/thinkos in `file-system-fold' and `scandir'.
    
    * module/ice-9/ftw.scm (file-system-fold): Fix reference to STAT instead
      of ST.
      (scandir)[enter?]: Change the argument name to `dir', to avoid
      confusion.
      [skip]: Return RESULT, not #f.

commit de92987002224276dafc0875873b30149e964828
Author: Ludovic Courtès <address@hidden>
Date:   Mon Dec 19 09:11:43 2011 +0100

    ftw: Clarify the behavior of `scandir' for flat files and unreadable dirs.
    
    * module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a
      pair.
      [down]: Ignore RESULT.
      Start with #f instead of the empty list.
    
    * test-suite/tests/ftw.test ("scandir")["flat file"]: New test.
    
    * doc/ref/misc-modules.texi (File Tree Walk): Update `scandir'
      documentation accordingly.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/misc-modules.texi |    3 ++-
 module/ice-9/ftw.scm      |   19 ++++++++++---------
 test-suite/tests/ftw.test |    5 ++++-
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/doc/ref/misc-modules.texi b/doc/ref/misc-modules.texi
index 42b74fc..5322034 100644
--- a/doc/ref/misc-modules.texi
+++ b/doc/ref/misc-modules.texi
@@ -1254,7 +1254,8 @@ Return the list of the names of files contained in 
directory @var{name}
 that match predicate @var{select?} (by default, all files).  The
 returned list of file names is sorted according to @var{entry<?}, which
 defaults to @code{string-locale<?} such that file names are sorted in
-the locale's alphabetical order (@pxref{Text Collation}).
+the locale's alphabetical order (@pxref{Text Collation}).  Return
address@hidden when @var{name} is unreadable or is not a directory.
 
 This procedure is modeled after the C library function of the same name
 (@pxref{Scanning Directory Content,,, libc, GNU C Library Reference
diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index c335e97..eed3eeb 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -457,7 +457,7 @@ The optional STAT parameter defaults to `lstat'."
                         (else
                          (let* ((child (string-append full-name "/" entry))
                                 (st    (false-if-exception (stat child))))
-                           (if (and stat (eq? (stat:type st) 'directory))
+                           (if (and st (eq? (stat:type st) 'directory))
                                (liip (readdir dir)
                                      result
                                      (alist-cons entry st subdirs))
@@ -512,26 +512,27 @@ children.  The optional STAT parameter defaults to 
`lstat'."
   "Return the list of the names of files contained in directory NAME
 that match predicate SELECT? (by default, all files.)  The returned list
 of file names is sorted according to ENTRY<?, which defaults to
-`string-locale<?'."
-  (define (enter? name stat result)
-    (and stat (string=? name name)))
+`string-locale<?'.  Return #f when NAME is unreadable or is not a directory."
+  (define (enter? dir stat result)
+    (and stat (string=? dir name)))
 
   (define (leaf name stat result)
     (if (select? name)
-        (cons (basename name) result)
+        (and (pair? result)                      ; must have a "." entry
+             (cons (basename name) result))
         result))
 
   (define (down name stat result)
-    (cons "." result))
+    (list "."))
 
   (define (up name stat result)
     (cons ".." result))
 
   (define (skip name stat result)
-    ;; NAME itself is not readable.
-    #f)
+    ;; All the sub-directories are skipped.
+    result)
 
-  (and=> (file-system-fold enter? leaf down up skip '() name stat)
+  (and=> (file-system-fold enter? leaf down up skip #f name stat)
          (lambda (files)
            (sort files entry<?))))
 
diff --git a/test-suite/tests/ftw.test b/test-suite/tests/ftw.test
index 3db3302..41c731a 100644
--- a/test-suite/tests/ftw.test
+++ b/test-suite/tests/ftw.test
@@ -173,4 +173,7 @@
     (let ((select? (cut string-suffix? ".test" <>)))
       (match (scandir (string-append %test-dir "/tests") select?)
         (("." ".." "00-initial-env.test" (? select?) ...)
-         #t)))))
+         #t))))
+
+  (pass-if "flat file"
+    (not (scandir (string-append %test-dir "/Makefile.am")))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]