diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-08-28 10:39:39 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-08-29 09:09:26 +0200 |
commit | 41f17389623b68cff40b4648b35b585bc7e68e8a (patch) | |
tree | 206b5a69426bf25c0f4213ab0967f764a8cb5983 /src | |
parent | 9a23629ff179c16309c7cfdb898926be03e8b105 (diff) | |
download | justbuild-41f17389623b68cff40b4648b35b585bc7e68e8a.tar.gz |
FileSystemManager: Implicit copy should not follow symlinks
The default options of std::filesystem::copy include following
symlinks, resulting in file repositories creating wrong trees if
containing unresolved symlinks, or failing unexpectedly early if
symlink cycles existed.
This is fixed by ensuring the copy_symlinks option is always used.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/file_system/file_system_manager.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index 6cf8f256..514fadd2 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -418,11 +418,11 @@ class FileSystemManager { dst.string()); return false; } - std::filesystem::copy(src, - dst, - recursively - ? std::filesystem::copy_options::recursive - : std::filesystem::copy_options::none); + auto const opts = + std::filesystem::copy_options::copy_symlinks | + (recursively ? std::filesystem::copy_options::recursive + : std::filesystem::copy_options::none); + std::filesystem::copy(src, dst, opts); return true; } catch (std::exception const& e) { Logger::Log(LogLevel::Error, |