aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-06 13:36:53 +0200
committerGitHub Enterprise <[email protected]>2024-08-06 13:36:53 +0200
commit05d6eeb171f5d11b70e06765d625e1b4eeaa082a (patch)
tree132c9d4bb6f6575b6840f7648f627ebc85c392fe
parenthardening read of corrupt oplog (#98) (diff)
downloadzen-05d6eeb171f5d11b70e06765d625e1b4eeaa082a.tar.xz
zen-05d6eeb171f5d11b70e06765d625e1b4eeaa082a.zip
changelog (#99)
Skip and report invalid configurations for workspaces instead of crashing
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenstore/workspaces.cpp23
2 files changed, 21 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a1c6ba32..97757d62b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
##
- Bugfix: Absolute paths and paths going outside the root path for workspace shares are now blocked
- Bugfix: Fix ASSERT that would trigger in GC under certain conditions if source block was empty
+- Bugfix: Skip and report invalid configurations for workspaces instead of crashing
- Improvement: `zen workspace-share create` now resolves relative root paths to absolute paths
- Improvement: Add better output/logging when failing to initialize shared mutex
- Improvement: Add hardening to gracefully handle malformed oplogs in project store
diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp
index 01f1cc55f..4cf423d03 100644
--- a/src/zenstore/workspaces.cpp
+++ b/src/zenstore/workspaces.cpp
@@ -725,13 +725,30 @@ Workspaces::ReadState(const std::filesystem::path& WorkspaceStatePath,
{
for (const Workspaces::WorkspaceInfo& Workspace : Workspaces)
{
- if (AddWorkspace(Workspace.Config))
+ try
{
- for (const Workspaces::WorkspaceShareConfiguration& Share : Workspace.Shares)
+ if (AddWorkspace(Workspace.Config))
{
- (void)AddWorkspaceShare(Workspace.Config.Id, Share, PathToIdCB);
+ for (const Workspaces::WorkspaceShareConfiguration& Share : Workspace.Shares)
+ {
+ try
+ {
+ (void)AddWorkspaceShare(Workspace.Config.Id, Share, PathToIdCB);
+ }
+ catch (const std::exception& Ex)
+ {
+ ZEN_WARN("Failed adding workspace share '{}' for workspace '{}'. Reason: '{}'",
+ Workspace.Config.Id,
+ Share.Id,
+ Ex.what());
+ }
+ }
}
}
+ catch (const std::exception& Ex)
+ {
+ ZEN_WARN("Failed adding workspace '{}'. Reason: '{}'", Workspace.Config.Id, Ex.what());
+ }
}
}
}