diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-06-20 20:34:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-06-20 20:40:04 +0300 |
commit | e3cf44824b93c250ca8b5ee98b6149437ae2c68a (patch) | |
tree | 811c5f117aa1d0249bd184075cf6c1e19322c968 /libbuild2/install | |
parent | 336ec5f508abf449369dbdc769b68d63301d9353 (diff) |
Fix crashing of $install.resolve() on absolute paths (GH issue #393)
Diffstat (limited to 'libbuild2/install')
-rw-r--r-- | libbuild2/install/rule.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx index 873b2e9..1aa21d0 100644 --- a/libbuild2/install/rule.cxx +++ b/libbuild2/install/rule.cxx @@ -871,16 +871,16 @@ namespace build2 r->sudo = cast_null<string> (s["config.install.sudo"]); if (r->cmd == nullptr) - r->cmd = &cast<path> (s["config.install.cmd"]); + r->cmd = cast_null<path> (s["config.install.cmd"]); if (r->options == nullptr) r->options = cast_null<strings> (s["config.install.options"]); if (r->mode == nullptr) - r->mode = &cast<string> (s["config.install.mode"]); + r->mode = cast_null<string> (s["config.install.mode"]); if (r->dir_mode == nullptr) - r->dir_mode = &cast<string> (s["config.install.dir_mode"]); + r->dir_mode = cast_null<string> (s["config.install.dir_mode"]); return rs; } @@ -1064,6 +1064,10 @@ namespace build2 if (base.sudo != nullptr) args.push_back (base.sudo->c_str ()); + // Wouldn't be here otherwise. + // + assert (base.cmd != nullptr && base.dir_mode != nullptr); + args.push_back (base.cmd->string ().c_str ()); args.push_back ("-d"); @@ -1129,6 +1133,10 @@ namespace build2 if (base.sudo != nullptr) args.push_back (base.sudo->c_str ()); + // Wouldn't be here otherwise. + // + assert (base.cmd != nullptr && base.mode != nullptr); + args.push_back (base.cmd->string ().c_str ()); if (base.options != nullptr) |