In pull request #7304, we added a "quick fix" to support removing very deep directories with rm -r. The corresponding test case in GNU coreutils is in tests/rm/deep-2.sh. It would be better to have a more robust solution.
The issue is that calling path.metadata() on a path that is too long returns an InvalidFilename error. Instead what we should do is use a relative path name and keep setting the working directory as we recurse. It must be possible because std::fs::remove_dir_all(path) seems to work on the very long path.
Originally posted by @jfinkels in #7304 (comment)
In pull request #7304, we added a "quick fix" to support removing very deep directories with
rm -r. The corresponding test case in GNU coreutils is intests/rm/deep-2.sh. It would be better to have a more robust solution.The issue is that calling
path.metadata()on a path that is too long returns anInvalidFilenameerror. Instead what we should do is use a relative path name and keep setting the working directory as we recurse. It must be possible becausestd::fs::remove_dir_all(path)seems to work on the very long path.Originally posted by @jfinkels in #7304 (comment)