[llvm] [Support] Use std::filesystem::remove_all() in remove_directories() (PR #119146)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 01:06:05 PST 2024


mstorsjo wrote:

I did some empirical testing with this patch in mingw environments; with libc++ it seems fine, all tests in `check-llvm` pass successfully like they did before.

However with libstdc++ (tested with the latest version in msys2, based on GCC 14), calling `remove_all()` simply hangs (a run on github actions timed out after 6 hours); we run into this in `unittests\Support\SupportTests.exe` e.g. in `FileSystemTest.CreateDir`.

I tried running it in a debugger, and it does seem to do ... something, with backtraces like this:
```
#0  0x00007ffa40b2ba94 in ntdll!RtlReAllocateHeap () from C:\Windows\SYSTEM32\ntdll.dll
#1  0x00007ffa40b4807c in ntdll!RtlGetFullPathName_UEx () from C:\Windows\SYSTEM32\ntdll.dll
#2  0x00007ffa3d0d61c7 in KERNELBASE!GetFullPathNameW () from C:\Windows\System32\KernelBase.dll
#3  0x00007ffa3db61e5d in ucrtbase!_wfullpath () from C:\Windows\System32\ucrtbase.dll
#4  0x00007ffa3dbe0527 in ucrtbase!_wsplitpath () from C:\Windows\System32\ucrtbase.dll
#5  0x00007ffa3dbe08a8 in ucrtbase!_wsplitpath () from C:\Windows\System32\ucrtbase.dll
#6  0x00007ffa3dbdf96e in ucrtbase!_wsplitpath () from C:\Windows\System32\ucrtbase.dll
#7  0x00007ffa3dbdf66d in ucrtbase!_wsplitpath () from C:\Windows\System32\ucrtbase.dll
#8  0x00007ff754fd6d36 in std::filesystem::symlink_status(std::filesystem::__cxx11::path const&, std::error_code&) ()
#9  0x00007ff754fdbf41 in std::filesystem::remove(std::filesystem::__cxx11::path const&, std::error_code&) ()
#10 0x00007ff754fde08c in std::filesystem::__cxx11::recursive_directory_iterator::__erase(std::error_code*) ()
#11 0x00007ff754fd5681 in std::filesystem::remove_all(std::filesystem::__cxx11::path const&, std::error_code&) ()
#12 0x00007ff754d887a8 in llvm::sys::fs::remove_directories(llvm::Twine const&, bool) ()
#13 0x00007ff754aba3d7 in (anonymous namespace)::FileSystemTest_CreateDir_Test::TestBody() ()
#14 0x00007ff754e65f98 in testing::Test::Run() ()
#15 0x00007ff754e6a455 in testing::TestInfo::Run() ()
#16 0x00007ff754f0785b in testing::TestSuite::Run() [clone .part.0] ()
#17 0x00007ff754e8d65a in testing::internal::UnitTestImpl::RunAllTests() ()
#18 0x00007ff754e6b26f in testing::UnitTest::Run() ()
#19 0x00007ff7550ea640 in main ()
```

https://github.com/llvm/llvm-project/pull/119146


More information about the llvm-commits mailing list