aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2026-04-27 04:49:19 -0600
committerGitHub Enterprise <[email protected]>2026-04-27 12:49:19 +0200
commit705c8b8d80965584c88f63d4449cbfdfa36138ea (patch)
tree819000130104f1d01a0e3605e5f84c4316f52b41
parenthydration with pack (#1016) (diff)
downloadarchived-zen-705c8b8d80965584c88f63d4449cbfdfa36138ea.tar.xz
archived-zen-705c8b8d80965584c88f63d4449cbfdfa36138ea.zip
Zs/user path case comparison (#1015)
- Improvement: `zen builds` `--exclude-folders` and `--exclude-extensions` values now match paths case-insensitively and tolerate surrounding whitespace between separators
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zen/cmds/builds_cmd.cpp31
-rw-r--r--src/zencore/include/zencore/string.h18
-rw-r--r--src/zenremotestore/builds/buildinspect.cpp5
-rw-r--r--src/zenremotestore/builds/buildupdatefolder.cpp3
-rw-r--r--src/zenremotestore/builds/builduploadfolder.cpp5
-rw-r--r--src/zenutil/filesystemutils.cpp3
7 files changed, 46 insertions, 20 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3288f8bba..935e05c97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@
- Improvement: S3 hydration retries transient HTTP failures (timeouts, 429 throttling, 5xx server errors, connection errors) up to 3 times via the HTTP client retry layer
- Improvement: S3 hydration multipart chunk size is persisted in `state.cbo` per module so hydrate replays the partitioning used at dehydrate; default raised to 64 MiB (was 32 MiB)
- Improvement: Hub hydration `Obliterate` retries backend delete once before falling back to local cleanup
+- Improvement: `zen builds` `--exclude-folders` and `--exclude-extensions` values now match paths case-insensitively and tolerate surrounding whitespace between separators
- Bugfix: `zen builds download` no longer crashes intermittently when scavenging sequences or copying local chunks
## 5.8.7
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp
index 84d8424aa..775c3d283 100644
--- a/src/zen/cmds/builds_cmd.cpp
+++ b/src/zen/cmds/builds_cmd.cpp
@@ -1025,19 +1025,22 @@ void
BuildsSubCmdBase::ParseExcludeFolderAndExtension(std::vector<std::string>& OutExcludeFolders,
std::vector<std::string>& OutExcludeExtensions)
{
- auto SplitAndAppendExclusion = [](const std::string_view Input, std::vector<std::string>& Output) {
- ForEachStrTok(Input, ";,", [&Output](std::string_view Exclusion) {
- if (!Exclusion.empty())
- {
- std::string CleanExclusion(ToLower(Exclusion));
- if (CleanExclusion.length() > 2 && CleanExclusion.front() == '"' && CleanExclusion.back() == '"')
- {
- CleanExclusion = CleanExclusion.substr(1, CleanExclusion.length() - 2);
- }
- Output.emplace_back(std::move(CleanExclusion));
- }
- return true;
- });
+ constexpr AsciiSet Whitespace(" ");
+ auto SplitAndAppendExclusion = [&Whitespace](const std::string_view Input, std::vector<std::string>& Output) {
+ ForEachStrTok(Input, ";,", [&Output, &Whitespace](std::string_view Exclusion) {
+ Exclusion = AsciiSet::TrimPrefixWith(Exclusion, Whitespace);
+ Exclusion = AsciiSet::TrimSuffixWith(Exclusion, Whitespace);
+ if (!Exclusion.empty())
+ {
+ std::string CleanExclusion(ToLower(Exclusion));
+ if (CleanExclusion.length() > 2 && CleanExclusion.front() == '"' && CleanExclusion.back() == '"')
+ {
+ CleanExclusion = CleanExclusion.substr(1, CleanExclusion.length() - 2);
+ }
+ Output.emplace_back(std::move(CleanExclusion));
+ }
+ return true;
+ });
};
SplitAndAppendExclusion(m_Config.ExcludeFolders, OutExcludeFolders);
@@ -2546,7 +2549,7 @@ BuildsTestSubCmd::Run(const ZenCliOptions& /*GlobalOptions*/)
std::string RelativePath = std::filesystem::relative(AbsolutePath, Path).generic_string();
for (const std::string& ExcludeFolder : ExcludeFolders)
{
- if (RelativePath.starts_with(ExcludeFolder))
+ if (StrCaseStartsWith(RelativePath, ExcludeFolder))
{
if (RelativePath.length() == ExcludeFolder.length())
{
diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h
index 7ca2afc69..fded960f3 100644
--- a/src/zencore/include/zencore/string.h
+++ b/src/zencore/include/zencore/string.h
@@ -1039,6 +1039,24 @@ StrCaseCompare(std::string_view Lhs, std::string_view Rhs)
return Result;
}
+inline bool
+StrCaseEquals(std::string_view Lhs, std::string_view Rhs)
+{
+ return StrCaseCompare(Lhs, Rhs) == 0;
+}
+
+inline bool
+StrCaseStartsWith(std::string_view Str, std::string_view Prefix)
+{
+ return Str.size() >= Prefix.size() && StrCaseCompare(Str.data(), Prefix.data(), Prefix.size()) == 0;
+}
+
+inline bool
+StrCaseEndsWith(std::string_view Str, std::string_view Suffix)
+{
+ return Str.size() >= Suffix.size() && StrCaseCompare(Str.data() + (Str.size() - Suffix.size()), Suffix.data(), Suffix.size()) == 0;
+}
+
/**
* @brief
* Helper function to implement case sensitive spaceship operator for strings.
diff --git a/src/zenremotestore/builds/buildinspect.cpp b/src/zenremotestore/builds/buildinspect.cpp
index 1af9e20af..86f2cfd75 100644
--- a/src/zenremotestore/builds/buildinspect.cpp
+++ b/src/zenremotestore/builds/buildinspect.cpp
@@ -5,6 +5,7 @@
#include <zencore/compactbinarybuilder.h>
#include <zencore/fmtutils.h>
#include <zencore/scopeguard.h>
+#include <zencore/string.h>
#include <zencore/timer.h>
#include <zencore/trace.h>
#include <zenremotestore/builds/buildcontent.h>
@@ -298,7 +299,7 @@ DiffFolders(ProgressBase& Progress,
auto IsAcceptedFolder = [ExcludeFolders](const std::string_view& RelativePath) -> bool {
for (const std::string& ExcludeFolder : ExcludeFolders)
{
- if (RelativePath.starts_with(ExcludeFolder))
+ if (StrCaseStartsWith(RelativePath, ExcludeFolder))
{
if (RelativePath.length() == ExcludeFolder.length())
{
@@ -316,7 +317,7 @@ DiffFolders(ProgressBase& Progress,
auto IsAcceptedFile = [ExcludeExtensions](const std::string_view& RelativePath, uint64_t, uint32_t) -> bool {
for (const std::string& ExcludeExtension : ExcludeExtensions)
{
- if (RelativePath.ends_with(ExcludeExtension))
+ if (StrCaseEndsWith(RelativePath, ExcludeExtension))
{
return false;
}
diff --git a/src/zenremotestore/builds/buildupdatefolder.cpp b/src/zenremotestore/builds/buildupdatefolder.cpp
index 443ab957e..ebef12900 100644
--- a/src/zenremotestore/builds/buildupdatefolder.cpp
+++ b/src/zenremotestore/builds/buildupdatefolder.cpp
@@ -6,6 +6,7 @@
#include <zencore/fmtutils.h>
#include <zencore/parallelwork.h>
#include <zencore/scopeguard.h>
+#include <zencore/string.h>
#include <zencore/trace.h>
#include <zenremotestore/builds/buildcontent.h>
#include <zenremotestore/builds/buildmanifest.h>
@@ -4195,7 +4196,7 @@ VerifyFolder(ProgressBase& Progress,
auto IsAcceptedFolder = [ExcludeFolders = ExcludeFolders](const std::string_view& RelativePath) -> bool {
for (const std::string& ExcludeFolder : ExcludeFolders)
{
- if (RelativePath.starts_with(ExcludeFolder))
+ if (StrCaseStartsWith(RelativePath, ExcludeFolder))
{
if (RelativePath.length() == ExcludeFolder.length())
{
diff --git a/src/zenremotestore/builds/builduploadfolder.cpp b/src/zenremotestore/builds/builduploadfolder.cpp
index b536ae464..433d24619 100644
--- a/src/zenremotestore/builds/builduploadfolder.cpp
+++ b/src/zenremotestore/builds/builduploadfolder.cpp
@@ -7,6 +7,7 @@
#include <zencore/fmtutils.h>
#include <zencore/parallelwork.h>
#include <zencore/scopeguard.h>
+#include <zencore/string.h>
#include <zencore/trace.h>
#include <zenremotestore/builds/buildcontent.h>
#include <zenremotestore/builds/buildmanifest.h>
@@ -446,7 +447,7 @@ BuildsOperationUploadFolder::IsAcceptedFolder(const std::string_view& RelativePa
{
for (const std::string& ExcludeFolder : m_Options.ExcludeFolders)
{
- if (RelativePath.starts_with(ExcludeFolder))
+ if (StrCaseStartsWith(RelativePath, ExcludeFolder))
{
if (RelativePath.length() == ExcludeFolder.length())
{
@@ -470,7 +471,7 @@ BuildsOperationUploadFolder::IsAcceptedFile(const std::string_view& RelativePath
}
for (const std::string& ExcludeExtension : m_Options.ExcludeExtensions)
{
- if (RelativePath.ends_with(ExcludeExtension))
+ if (StrCaseEndsWith(RelativePath, ExcludeExtension))
{
return false;
}
diff --git a/src/zenutil/filesystemutils.cpp b/src/zenutil/filesystemutils.cpp
index f8f7bfb18..3d02a8a45 100644
--- a/src/zenutil/filesystemutils.cpp
+++ b/src/zenutil/filesystemutils.cpp
@@ -6,6 +6,7 @@
#include <zencore/fmtutils.h>
#include <zencore/parallelwork.h>
#include <zencore/scopeguard.h>
+#include <zencore/string.h>
#include <zencore/timer.h>
#include <zencore/trace.h>
@@ -424,7 +425,7 @@ CleanDirectory(
const std::string DirectoryString = DirectoryName.string();
for (const std::string_view ExcludeDirectory : ExcludeDirectories)
{
- if (DirectoryString == ExcludeDirectory)
+ if (StrCaseEquals(DirectoryString, ExcludeDirectory))
{
return false;
}