1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

scandir: Use lstat' instead of stat'.

* module/ice-9/ftw.scm (scandir): Use `lstat', not `stat'.

* test-suite/tests/ftw.test ("scandir")["symlink to directory"]: New
  test.
This commit is contained in:
Ludovic Courtès 2012-11-01 00:47:41 +01:00
parent f3bb42fc9b
commit 139ce19474
2 changed files with 12 additions and 2 deletions

View file

@ -562,7 +562,7 @@ of file names is sorted according to ENTRY<?, which defaults to
result
(visit (basename name*) result)))
(and=> (file-system-fold enter? leaf down up skip error #f name stat)
(and=> (file-system-fold enter? leaf down up skip error #f name lstat)
(lambda (files)
(sort files entry<?))))

View file

@ -320,7 +320,17 @@
(not (scandir "/.does-not-exist.")))
(pass-if "no select"
(null? (scandir %test-dir (lambda (_) #f)))))
(null? (scandir %test-dir (lambda (_) #f))))
;; In Guile up to 2.0.6, this would return ("." ".." "link-to-dir").
(pass-if-equal "symlink to directory"
'("." ".." "link-to-dir" "subdir")
(with-file-tree %top-builddir '(directory "test-scandir-symlink"
(("link-to-dir" -> "subdir")
(directory "subdir"
(("a")))))
(let ((name (string-append %top-builddir "/test-scandir-symlink")))
(scandir name)))))
;;; Local Variables:
;;; eval: (put 'with-file-tree 'scheme-indent-function 2)