aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/path.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-19 00:26:06 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-23 07:05:50 -0500
commit018e2571aad8c68c80207f84b6b20695f20e5c40 (patch)
tree786df005464ec975d2781c0f47822700487684e8 /src/libstore/path.cc
parent685395332d75713bc7aca0c6408fc1b9d2c14bc5 (diff)
Test store paths, with property tests
The property test in fact found a bug: we were excluding numbers!
Diffstat (limited to 'src/libstore/path.cc')
-rw-r--r--src/libstore/path.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/path.cc b/src/libstore/path.cc
index 392db225e..46be54281 100644
--- a/src/libstore/path.cc
+++ b/src/libstore/path.cc
@@ -8,8 +8,10 @@ static void checkName(std::string_view path, std::string_view name)
{
if (name.empty())
throw BadStorePath("store path '%s' has an empty name", path);
- if (name.size() > 211)
- throw BadStorePath("store path '%s' has a name longer than 211 characters", path);
+ if (name.size() > StorePath::MaxPathLen)
+ throw BadStorePath("store path '%s' has a name longer than '%d characters",
+ StorePath::MaxPathLen, path);
+ // See nameRegexStr for the definition
for (auto c : name)
if (!((c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z')