[PATCH] suricatta/wfx: Fix rebooting via tools/swupdate-progress.c

19 views
Skip to first unread message

Storm, Christian

unread,
Jul 15, 2025, 4:59:13 AMJul 15
to swup...@googlegroups.com
The changes leading to commit 077ef4f broke rebooting via
tools/swupdate-progress.c. Hence, adapt the C Lua bridge
lua_notify_progress() and update its invocation in
suricatta/server_wfx.lua as well as updating / fixing
Lua annotations.

Signed-off-by: Christian Storm <christi...@siemens.com>
---
corelib/lua_interface.c | 17 +++++++++--------
doc/source/suricatta.rst | 8 ++++----
handlers/swupdate.lua | 5 +++--
suricatta/server_wfx.lua | 6 ++++--
suricatta/suricatta.lua | 5 +++--
5 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 8d57aaa9..1ff3e5e4 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -1232,17 +1232,18 @@ static int l_stat(lua_State *L)
* @brief Dispatch a message to the progress interface.
*
* @param [Lua] Message to dispatch to progress interface.
+ * @param [Lua] progress_cause_t number (optional), default: CAUSE_NONE
* @return [Lua] nil.
*/
int lua_notify_progress(lua_State *L) {
- /*
- * NOTE: level is INFOLEVEL for the sake of specifying a level.
- * It is unused in core/notifier.c :: progress_notifier() as the
- * progress emitter doesn't know about log levels.
- */
- notify(PROGRESS, RECOVERY_NO_ERROR, INFOLEVEL, luaL_checkstring(L, -1));
- lua_pop(L, 1);
- return 0;
+ lua_Number cause = CAUSE_NONE;
+ if (lua_isnumber(L, -1) == 1) {
+ cause = lua_tonumber(L, -1);
+ lua_pop(L, 1);
+ }
+ notify(PROGRESS, (progress_cause_t)cause, INFOLEVEL, luaL_checkstring(L, -1));
+ lua_pop(L, 1);
+ return 0;
}

/**
diff --git a/doc/source/suricatta.rst b/doc/source/suricatta.rst
index 474d02cc..a4081a63 100644
--- a/doc/source/suricatta.rst
+++ b/doc/source/suricatta.rst
@@ -557,10 +557,10 @@ The ``suricatta.status`` table exposes the ``server_op_res_t`` enum values defin
The ``suricatta.notify`` table provides the usual logging functions to the Lua
suricatta module matching their uppercase-named pendants available in the C realm.

-One notable exception is ``suricatta.notify.progress(message)`` which dispatches the
-message to the progress interface (see :doc:`progress`). Custom progress client
-implementations listening and acting on custom progress messages can be realized
-using this function.
+One notable exception is ``suricatta.notify.progress(message, cause)`` which
+dispatches the message to the progress interface (see :doc:`progress`). Custom
+progress client implementations listening and acting on custom progress messages
+can be realized using this function.

All notify functions return ``nil``.

diff --git a/handlers/swupdate.lua b/handlers/swupdate.lua
index aa8a31d0..d32f83b9 100644
--- a/handlers/swupdate.lua
+++ b/handlers/swupdate.lua
@@ -63,8 +63,9 @@ swupdate.warn = function(format, ...) end
swupdate.debug = function(format, ...) end

--- Lua equivalent of `notify(PROGRESS, ..., msg)`.
---- @param msg string Message to send to progress interface
-swupdate.progress = function(msg) end
+--- @param msg string Message to send to progress interface
+--- @param cause number | nil `progress_cause_t` value as defined in `include/progress_ipc.h`
+swupdate.progress = function(msg, cause) end

--- Lua equivalent of `notify(status, error, INFOLEVEL, msg)`.
--- @param status swupdate.RECOVERY_STATUS Current status, one of `swupdate.RECOVERY_STATUS`'s values
diff --git a/suricatta/server_wfx.lua b/suricatta/server_wfx.lua
index 0978ed50..d0b01bad 100644
--- a/suricatta/server_wfx.lua
+++ b/suricatta/server_wfx.lua
@@ -1471,8 +1471,10 @@ M.job.workflow.dispatch:set(
suricatta.notify.warn("Cannot initialize progress reporting channel, won't send progress.")
end

- suricatta.notify.progress(M.utils.string.escape([[{"%s": { "reboot-mode" : "no-reboot"}}]])
- :format(suricatta.ipc.progress_cause.CAUSE_REBOOT_MODE))
+ suricatta.notify.progress(
+ M.utils.string.escape([[{ "reboot-mode" : "no-reboot"}]]),
+ suricatta.ipc.progress_cause.CAUSE_REBOOT_MODE
+ )

suricatta.notify.debug(
"%s Version '%s' (Type: %s).",
diff --git a/suricatta/suricatta.lua b/suricatta/suricatta.lua
index 24d6eb8f..b8707a25 100644
--- a/suricatta/suricatta.lua
+++ b/suricatta/suricatta.lua
@@ -47,6 +47,7 @@ suricatta.status = {
--
-- Translates to `notify(string.format(message, ...))`,
-- @see `corelib/lua_interface.c`
+-- except for `suricatta.notify.progress()`.
--
--- @class suricatta.notify
suricatta.notify = {
@@ -60,8 +61,8 @@ suricatta.notify = {
info = function(message, ...) end,
--- @type fun(message: string, ...: any)
warn = function(message, ...) end,
- --- @type fun(message: string, ...: any)
- progress = function(message, ...) end,
+ --- @type fun(message: string, cause:suricatta.ipc.progress_cause?)
+ progress = function(message, cause) end,
}


--
2.50.1

Cal

unread,
Sep 25, 2025, 6:46:53 PM (6 days ago) Sep 25
to swupdate
Is there any reason we can't merge this in? I applied the patch and with a simple happy-path test it appears to have fixed the problem.

Storm, Christian

unread,
Sep 26, 2025, 2:48:26 AM (5 days ago) Sep 26
to swupdate
Hi,

> Is there any reason we can't merge this in? I applied the patch and with a simple happy-path test it appears to have fixed the problem.

Thanks for testing! It's already in as I see it (https://github.com/sbabic/swupdate/commit/6281f3783a303904981523ed8388b468d58eb5a0) though not in a release-tagged version (yet)...

Kind regards,
Christian
> --
> You received this message because you are subscribed to the Google Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/swupdate/60d10ae3-bbae-4bbf-89b2-15c55caa2fedn%40googlegroups.com.



--
Dr. Christian Storm
Siemens AG, FT RPD CED
Friedrich-Ludwig-Bauer-Str. 3, 85748 Garching, Germany

Stefano Babic

unread,
Sep 26, 2025, 7:34:22 AM (5 days ago) Sep 26
to Cal, swupdate
Hi Cal,

On 9/26/25 00:46, 'Cal' via swupdate wrote:
> Is there any reason we can't merge this in? I applied the patch and with

as Christian has already stated, patch was merged a log time ago. What
have you expected ?

Best regards,
Stefano Babic
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> swupdate/60d10ae3-bbae-4bbf-89b2-15c55caa2fedn%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/60d10ae3-
> bbae-4bbf-89b2-15c55caa2fedn%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

Cal

unread,
Sep 26, 2025, 10:57:55 AM (5 days ago) Sep 26
to swupdate
Stefano and Christian,

Oh, great to hear that it's in!


> What have you expected ?
I had been relying on thread responses here to tell whether it had been merged in. And I was using a release version, which didn't have the patch, so that's another reason I missed the memo. It would be nice if PRs and merges could automatically update these patch threads. Or, if there's another way to correlate these patch requests with the final result (merge or otherwise) that would be great.

Thanks!

Stefano Babic

unread,
Sep 26, 2025, 11:04:22 AM (5 days ago) Sep 26
to Cal, swupdate
Hi Cal,

On 9/26/25 16:57, 'Cal' via swupdate wrote:
> Stefano and Christian,
>
> Oh, great to hear that it's in!
>
> > What have you expected ?
> I had been relying on thread responses here to tell whether it had been
> merged in. And I was using a release version, which didn't have the
> patch, so that's another reason I missed the memo. It would be nice if
> PRs and merges could automatically update these patch threads.

Please read the documentation of the project, and specially how to
contribute.

https://sbabic.github.io/swupdate/contributing.html

"do not use github Pull Request. github facilities are not used for this
project. The review is done in a single place : the Mailing List. PR
from github are ignored."

Best regards,
Stefano Babic
> <https://groups.google.com/d/msgid/>
> > swupdate/60d10ae3-bbae-4bbf-89b2-15c55caa2fedn%40googlegroups.com
> <http://40googlegroups.com>
> > <https://groups.google.com/d/msgid/swupdate/60d10ae3- <https://
> groups.google.com/d/msgid/swupdate/60d10ae3->
> > bbae-4bbf-89b2-15c55caa2fedn%40googlegroups.com
> <http://40googlegroups.com>?
> > utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> swupdate/eea76cec-2625-47eb-b94e-2964ee8ea897n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/eea76cec-2625-47eb-
> b94e-2964ee8ea897n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Cal

unread,
Sep 26, 2025, 1:37:29 PM (5 days ago) Sep 26
to swupdate
I see, thanks for the clarification.

I had understood that patches were submitted elsewhere, but I didn't realize that the approval status of patches is only located within patchwork and not submitted to the e-mail thread. I was viewing this from the Google Group and missed it. For any patches I see being discussed in email threads, I'll just need to search for them in patchwork to find out if they were approved.

Thanks!
Reply all
Reply to author
Forward
0 new messages