From d6e9703edbd28508882fab3ce698617d036abfdd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Apr 2024 14:39:31 +0200 Subject: Diagnose empty paths in config.config.{load,save} GitHub issue #372. --- libbuild2/config/operation.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libbuild2/config/operation.cxx') diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx index 5983e4b..150bf1a 100644 --- a/libbuild2/config/operation.cxx +++ b/libbuild2/config/operation.cxx @@ -759,6 +759,11 @@ namespace build2 lookup l (rs[*c_s]); if (l && (l.belongs (rs) || l.belongs (ctx.global_scope))) { + const path& f (cast (l)); + + if (f.empty ()) + fail << "empty path in " << *c_s; + // While writing the complete configuration seems like a natural // default, there might be a desire to take inheritance into // account (if, say, we are exporting at multiple levels). One can @@ -766,8 +771,7 @@ namespace build2 // still want to support this mode somehow in the future (it seems // like an override of config.config.persist should do the trick). // - save_config ( - rs, cast (l), false /* inherit */, mod, projects); + save_config (rs, f, false /* inherit */, mod, projects); } } } -- cgit v1.1