From af0e24adf8fbdef76dba06b0d028caa183e77f1b Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 28 Nov 2024 11:29:05 +0100 Subject: [PATCH] package/finit: backport fix to prevent restaring template siblings Signed-off-by: Joachim Wiberg --- ...rdeps-dirty-if-main-service-is-nohup.patch | 2 +- ...ibutes-and-clear-screen-when-startin.patch | 2 +- .../finit/0003-plugins-refactor-rtc.so.patch | 2 +- ...18-support-systems-with-a-broken-RTC.patch | 2 +- ...tc-date-DATE-introduced-in-Finit-v4..patch | 2 +- ...reduce-log-level-LOG_ERR-LOG_WARNING.patch | 2 +- ...ntended-restart-of-template-siblings.patch | 57 +++++++++++++++++++ 7 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 package/finit/0007-Fix-unintended-restart-of-template-siblings.patch diff --git a/package/finit/0001-Only-mark-rdeps-dirty-if-main-service-is-nohup.patch b/package/finit/0001-Only-mark-rdeps-dirty-if-main-service-is-nohup.patch index f53430df..13e58c4c 100644 --- a/package/finit/0001-Only-mark-rdeps-dirty-if-main-service-is-nohup.patch +++ b/package/finit/0001-Only-mark-rdeps-dirty-if-main-service-is-nohup.patch @@ -1,7 +1,7 @@ From 46ffa81f5c88ce95db011369d8bfb802313e4217 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 17 Oct 2024 14:23:24 +0200 -Subject: [PATCH 1/6] Only mark rdeps dirty if main service is nohup +Subject: [PATCH 1/7] Only mark rdeps dirty if main service is nohup Organization: Addiva Elektronik This patch changes a behavior that's been default since Finit 4.0, diff --git a/package/finit/0002-Reset-color-attributes-and-clear-screen-when-startin.patch b/package/finit/0002-Reset-color-attributes-and-clear-screen-when-startin.patch index d20ea0e7..3deb81f2 100644 --- a/package/finit/0002-Reset-color-attributes-and-clear-screen-when-startin.patch +++ b/package/finit/0002-Reset-color-attributes-and-clear-screen-when-startin.patch @@ -1,7 +1,7 @@ From 119e66a7e9c95283918639b51dd03a3d666955f8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 28 Oct 2024 10:58:04 +0100 -Subject: [PATCH 2/6] Reset color attributes and clear screen when starting up +Subject: [PATCH 2/7] Reset color attributes and clear screen when starting up Organization: Addiva Elektronik Some boot loaders, like GRUB, leave background color artifacts from diff --git a/package/finit/0003-plugins-refactor-rtc.so.patch b/package/finit/0003-plugins-refactor-rtc.so.patch index cd47adc6..6d9cdfb2 100644 --- a/package/finit/0003-plugins-refactor-rtc.so.patch +++ b/package/finit/0003-plugins-refactor-rtc.so.patch @@ -1,7 +1,7 @@ From 0c0e880f3fdd38f7bbde618408378dc0a19ff005 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 3 Nov 2024 09:39:46 +0100 -Subject: [PATCH 3/6] plugins: refactor rtc.so +Subject: [PATCH 3/7] plugins: refactor rtc.so Organization: Addiva Elektronik Factor out time_set() and time_get() for readability and reuse. diff --git a/package/finit/0004-Fix-418-support-systems-with-a-broken-RTC.patch b/package/finit/0004-Fix-418-support-systems-with-a-broken-RTC.patch index bea15500..ff03acbb 100644 --- a/package/finit/0004-Fix-418-support-systems-with-a-broken-RTC.patch +++ b/package/finit/0004-Fix-418-support-systems-with-a-broken-RTC.patch @@ -1,7 +1,7 @@ From bc8118d515839dc598f437aa01f07a771646968d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 3 Nov 2024 09:47:16 +0100 -Subject: [PATCH 4/6] Fix #418: support systems with a broken RTC +Subject: [PATCH 4/7] Fix #418: support systems with a broken RTC Organization: Addiva Elektronik This patch introduces a new configure option --with-rtc-file=FILE. When diff --git a/package/finit/0005-Fix-buggy-with-rtc-date-DATE-introduced-in-Finit-v4..patch b/package/finit/0005-Fix-buggy-with-rtc-date-DATE-introduced-in-Finit-v4..patch index b2c2d86b..7da579d5 100644 --- a/package/finit/0005-Fix-buggy-with-rtc-date-DATE-introduced-in-Finit-v4..patch +++ b/package/finit/0005-Fix-buggy-with-rtc-date-DATE-introduced-in-Finit-v4..patch @@ -1,7 +1,7 @@ From 6be16f2f6d093ef495d0fe4313f7b05b4ba3e08f Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 3 Nov 2024 10:38:38 +0100 -Subject: [PATCH 5/6] Fix buggy --with-rtc-date=DATE, introduced in Finit v4.4 +Subject: [PATCH 5/7] Fix buggy --with-rtc-date=DATE, introduced in Finit v4.4 Organization: Addiva Elektronik In 42ef3d3c, for v4.4-rc1, support for setting a custom RTC restore date diff --git a/package/finit/0006-plugins-reduce-log-level-LOG_ERR-LOG_WARNING.patch b/package/finit/0006-plugins-reduce-log-level-LOG_ERR-LOG_WARNING.patch index c76b9e16..e8dca597 100644 --- a/package/finit/0006-plugins-reduce-log-level-LOG_ERR-LOG_WARNING.patch +++ b/package/finit/0006-plugins-reduce-log-level-LOG_ERR-LOG_WARNING.patch @@ -1,7 +1,7 @@ From 49c0557cedd8d3c1a2f74d27fa7db83dd529914a Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 3 Nov 2024 20:49:04 +0100 -Subject: [PATCH 6/6] plugins: reduce log level LOG_ERR -> LOG_WARNING +Subject: [PATCH 6/7] plugins: reduce log level LOG_ERR -> LOG_WARNING Organization: Addiva Elektronik These plugins signal success and failure directly to the console, the diff --git a/package/finit/0007-Fix-unintended-restart-of-template-siblings.patch b/package/finit/0007-Fix-unintended-restart-of-template-siblings.patch new file mode 100644 index 00000000..96233b37 --- /dev/null +++ b/package/finit/0007-Fix-unintended-restart-of-template-siblings.patch @@ -0,0 +1,57 @@ +From 465bc17ca4b131f8c1ef27ff8279f4ea13745a78 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Thu, 28 Nov 2024 11:06:57 +0100 +Subject: [PATCH 7/7] Fix unintended restart of template siblings +Organization: Addiva Elektronik + +Consider the case where container@.conf is an available template. When +creating a container@foo.conf it will share the same base .conf as an +existing container@bar.conf, but we do not expect to restart bar just +because foo is instantiated. + +Up until this change, all template siblings were considered "dirty" if a +new one was created or updated. Skipping realpath() for all files that +have a '@' works around the problem. + +Signed-off-by: Joachim Wiberg +--- + src/conf.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index 1cfcd87..531923c 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -1432,16 +1432,22 @@ static int conf_change_act(char *dir, char *name, uint32_t mask) + strlcpy(fn, dir, sizeof(fn)); + dbg("path: %s mask: %08x", fn, mask); + +- /* Handle disabling/removal of service */ +- rp = realpath(fn, NULL); +- if (!rp) { +- if (errno != ENOENT) +- goto fail; ++ if (strchr(name, '@')) { ++ /* Skip realpath for templates */ + rp = strdup(fn); +- if (!rp) +- goto fail; ++ } else { ++ /* Handle disabling/removal of service */ ++ rp = realpath(fn, NULL); ++ if (!rp) { ++ if (errno != ENOENT) ++ goto fail; ++ rp = strdup(fn); ++ } + } + ++ if (!rp) ++ goto fail; ++ + node = conf_find(rp); + if (node) { + dbg("event already registered for %s ...", name); +-- +2.43.0 +