From 68575bc1a2e12c48e370beb0c69a393c46327df5 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Thu, 12 Dec 2024 19:52:55 +1000 Subject: [PATCH] Resolve dep dirs (.d) relative to the path of file containing setting 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. --- src/dinitcheck.cc | 1 + src/load-service.cc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dinitcheck.cc b/src/dinitcheck.cc index 252f43d0..ae5967a7 100644 --- a/src/dinitcheck.cc +++ b/src/dinitcheck.cc @@ -677,6 +677,7 @@ service_record *load_service(service_set_t &services, const std::string &name, auto process_dep_dir_n = [&](std::list &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); }; diff --git a/src/load-service.cc b/src/load-service.cc index 7d156cef..4b27fa97 100644 --- a/src/load-service.cc +++ b/src/load-service.cc @@ -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; @@ -516,6 +516,7 @@ service_record * dirload_service_set::load_reload_service(const char *fullname, auto process_dep_dir_n = [&](std::list &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); };