[llvm-bugs] [Bug 38837] New: doesn't work std::filesystem::directory_options::follow_directory_symlink

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 5 02:06:48 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38837

            Bug ID: 38837
           Summary: doesn't work
                    std::filesystem::directory_options::follow_directory_s
                    ymlink
           Product: libc++
           Version: 7.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: faithandbrave at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

#include <iostream>
#include <filesystem>
#include <fstream>

namespace fs = std::filesystem;

int main()
{
  fs::create_directory("dir_a");
  std::ofstream{"dir_a/a.txt"};

  fs::create_directory("dir_b");
  std::ofstream{"dir_b/b.txt"};
  fs::create_directory_symlink("dir_a", "dir_b/dir_a");

  for (const fs::directory_entry& x : fs::recursive_directory_iterator(
                                        "dir_b",
                                       
fs::directory_options::follow_directory_symlink)) {
    std::cout << x.path() << std::endl;
  }
}

expected result:
"dir_b/b.txt"
"dir_b/dir_a"
"dir_b/dir_a/a.txt"

actual result:
"dir_b/b.txt"
"dir_b/dir_a"
terminating with uncaught exception of type
std::__1::__fs::filesystem::filesystem_error: filesystem error: in
recursive_directory_iterator::operator++(): attempting recursion into
"dir_b/dir_a": Too many levels of symbolic links

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180905/a8a47c19/attachment-0001.html>


More information about the llvm-bugs mailing list