From 629dc072c7c81693e55cafaa90e63ff1128b0efe Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Fri, 21 Jul 2023 11:26:52 +0200 Subject: bugfix: stage symlinks as symlinks when creating an action directory Before this patch, when creating an action directory, symlinks were staged as regular files. --- src/buildtool/execution_api/local/local_action.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/buildtool/execution_api/local/local_action.cpp') diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index d42dcdd6..d3ad7fd9 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -185,6 +185,18 @@ auto LocalAction::StageFile(std::filesystem::path const& target_path, return false; } + if (info.type == ObjectType::Symlink) { + auto to = + FileSystemManager::ReadContentAtPath(*blob_path, ObjectType::File); + if (not to) { + logger_.Emit(LogLevel::Error, + "could not read content of symlink {}", + (*blob_path).string()); + return false; + } + return FileSystemManager::CreateSymlink(*to, target_path); + } + return FileSystemManager::CreateDirectory(target_path.parent_path()) and FileSystemManager::CreateFileHardlink(*blob_path, target_path); } -- cgit v1.2.3