Skip to content

Commit

Permalink
Resolve dep dirs (.d) relative to the path of file containing setting
Browse files Browse the repository at this point in the history
If a file A is @included from a service description file B, and A has a
"waits-for.d" setting (for example) with a non-absolute directory name,
resolve the name relative to A rather than to B.

Also fix a bug in dinitcheck that made it fail to find the dependency
directory.
  • Loading branch information
davmac314 committed Dec 12, 2024
1 parent 0e2c03e commit 68575bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dinitcheck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ service_record *load_service(service_set_t &services, const std::string &name,

auto process_dep_dir_n = [&](std::list<prelim_dep> &deplist, const std::string &waitsford,
dependency_type dep_type) -> void {
const string &service_filename = input_stack.current_file_name();
process_dep_dir(name.c_str(), service_filename, deplist, waitsford, dep_type);
};

Expand Down
3 changes: 2 additions & 1 deletion src/load-service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ service_record * dirload_service_set::load_reload_service(const char *fullname,
}

file_input_stack input_stack;
input_stack.push(service_filename, std::move(service_file));
input_stack.push(std::move(service_filename), std::move(service_file));

try {
environment srv_env;
Expand All @@ -516,6 +516,7 @@ service_record * dirload_service_set::load_reload_service(const char *fullname,

auto process_dep_dir_n = [&](std::list<prelim_dep> &deplist,
const std::string &waitsford, dependency_type dep_type) -> void {
const string &service_filename = input_stack.current_file_name();
process_dep_dir(*this, name.c_str(), service_filename, deplist, waitsford,
dep_type, reload_svc);
};
Expand Down

0 comments on commit 68575bc

Please sign in to comment.