This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c1108f44342: FileSystem::EnumerateDirectory should skip 
entries w/o Status, not halt (authored by jasonmolenda).

Changed prior to commit:
  https://reviews.llvm.org/D153822?vs=534792&id=534800#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153822/new/

https://reviews.llvm.org/D153822

Files:
  lldb/source/Host/common/FileSystem.cpp
  lldb/unittests/Host/FileSystemTest.cpp


Index: lldb/unittests/Host/FileSystemTest.cpp
===================================================================
--- lldb/unittests/Host/FileSystemTest.cpp
+++ lldb/unittests/Host/FileSystemTest.cpp
@@ -51,6 +51,11 @@
         FilesAndDirs.find(Path.str());
     if (I == FilesAndDirs.end())
       return make_error_code(llvm::errc::no_such_file_or_directory);
+    // Simulate a broken symlink, where it points to a file/dir that
+    // does not exist.
+    if (I->second.isSymlink() &&
+        I->second.getPermissions() == sys::fs::perms::no_perms)
+      return std::error_code(ENOENT, std::generic_category());
     return I->second;
   }
   ErrorOr<std::unique_ptr<vfs::File>>
@@ -152,6 +157,13 @@
                   sys::fs::file_type::symlink_file, sys::fs::all_all);
     addEntry(Path, S);
   }
+
+  void addBrokenSymlink(StringRef Path) {
+    vfs::Status S(Path, UniqueID(FSID, FileID++),
+                  std::chrono::system_clock::now(), 0, 0, 0,
+                  sys::fs::file_type::symlink_file, sys::fs::no_perms);
+    addEntry(Path, S);
+  }
 };
 } // namespace
 
@@ -178,6 +190,7 @@
   D->addRegularFile("/foo");
   D->addDirectory("/bar");
   D->addSymlink("/baz");
+  D->addBrokenSymlink("/lux");
   D->addRegularFile("/qux", ~sys::fs::perms::all_read);
   D->setCurrentWorkingDirectory("/");
   return D;
Index: lldb/source/Host/common/FileSystem.cpp
===================================================================
--- lldb/source/Host/common/FileSystem.cpp
+++ lldb/source/Host/common/FileSystem.cpp
@@ -192,7 +192,7 @@
     const auto &Item = *Iter;
     ErrorOr<vfs::Status> Status = m_fs->status(Item.path());
     if (!Status)
-      break;
+      continue;
     if (!find_files && Status->isRegularFile())
       continue;
     if (!find_directories && Status->isDirectory())


Index: lldb/unittests/Host/FileSystemTest.cpp
===================================================================
--- lldb/unittests/Host/FileSystemTest.cpp
+++ lldb/unittests/Host/FileSystemTest.cpp
@@ -51,6 +51,11 @@
         FilesAndDirs.find(Path.str());
     if (I == FilesAndDirs.end())
       return make_error_code(llvm::errc::no_such_file_or_directory);
+    // Simulate a broken symlink, where it points to a file/dir that
+    // does not exist.
+    if (I->second.isSymlink() &&
+        I->second.getPermissions() == sys::fs::perms::no_perms)
+      return std::error_code(ENOENT, std::generic_category());
     return I->second;
   }
   ErrorOr<std::unique_ptr<vfs::File>>
@@ -152,6 +157,13 @@
                   sys::fs::file_type::symlink_file, sys::fs::all_all);
     addEntry(Path, S);
   }
+
+  void addBrokenSymlink(StringRef Path) {
+    vfs::Status S(Path, UniqueID(FSID, FileID++),
+                  std::chrono::system_clock::now(), 0, 0, 0,
+                  sys::fs::file_type::symlink_file, sys::fs::no_perms);
+    addEntry(Path, S);
+  }
 };
 } // namespace
 
@@ -178,6 +190,7 @@
   D->addRegularFile("/foo");
   D->addDirectory("/bar");
   D->addSymlink("/baz");
+  D->addBrokenSymlink("/lux");
   D->addRegularFile("/qux", ~sys::fs::perms::all_read);
   D->setCurrentWorkingDirectory("/");
   return D;
Index: lldb/source/Host/common/FileSystem.cpp
===================================================================
--- lldb/source/Host/common/FileSystem.cpp
+++ lldb/source/Host/common/FileSystem.cpp
@@ -192,7 +192,7 @@
     const auto &Item = *Iter;
     ErrorOr<vfs::Status> Status = m_fs->status(Item.path());
     if (!Status)
-      break;
+      continue;
     if (!find_files && Status->isRegularFile())
       continue;
     if (!find_directories && Status->isDirectory())
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to