collect-sub*directories fails on a tree with a symlink to a parent directory
Hello,
I was trying to use collect-sub*directories
to traverse a Yocto
build tree. The older SBCL I was using crashed, so I started
investigating.
It turns out the Yocto tree contained valid/necessary directory structures like this:
.../dir/
.../dir/subdir -> .
This pattern causes collect-sub*directories
to recurse until a
resource limit is hit. For example, CLISP produces:
[...]
Running test/test-symlink-loop-2.script with clisp-2.49.92-unix-ppc64le
Testing sub-directory linking to its parent directory.
*** - Program stack overflow. RESET
Aborted
The attached patch set introduces a failing test case to demonstrate
the issue, then fixes it. It turns out a similar issue was already
solved for collect-sub*directories-asd-files
(https://bugs.launchpad.net/asdf/+bug/1533766); these patches move the
visited file tracking logic to collect-sub*directories
.
As a prerequisite, I attempted to improve symlink handling in
directory*
and subdirectories
for CLISP.
I tested these patches with: make -f Makefile-lisp-scripting t l=$L
on GNU CLISP 2.49.92 (2018-02-18) and SBCL 2.1.1.debian.
I'm interested to run them through the CI/CD pipeline to see how portable the changes are to other implementations.
0001-Add-a-test-for-directory-symlink-handling.patch 0002-Improve-directory-symlink-handling-on-CLISP.patch 0003-Add-a-collect-sub-directories-symlink-test.patch 0004-Fix-subdirectories-wildcard-on-CLISP.patch 0005-Track-visited-subdirectories-in-collect-sub-director.patch 0006-Simplify-collect-sub-directories-asd-files.patch