[PATCH] suricatta/wfx: Fix device version string number formatting

4 views
Skip to first unread message

Storm, Christian

unread,
Apr 29, 2025, 5:04:18 AM4/29/25
to swup...@googlegroups.com
Depending on the version number table entries being of type integer or
number, some Lua versions (e.g., Lua 5.3) add a trailing '.0' to type
number values converted to string, resulting in the device version
string becoming, e.g., "SWUpdate 2024.0.12.0".

Fix this by being explicit in the conversion and add proper padding.

Signed-off-by: Christian Storm <christi...@siemens.com>
---
suricatta/server_wfx.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/suricatta/server_wfx.lua b/suricatta/server_wfx.lua
index df0791fb..768ab1a5 100644
--- a/suricatta/server_wfx.lua
+++ b/suricatta/server_wfx.lua
@@ -1804,7 +1804,7 @@ M.job.workflow.dispatch:set(
--- @field version string Device client version information, sent to server in HTTP Header
--- @field reset function(device) Reset `device` Table
M.device = {
- version = ("SWUpdate %s.%s"):format(table.unpack(suricatta.getversion() or { 2023, 5 })),
+ version = ("SWUpdate %04u.%02u"):format(table.unpack(suricatta.getversion() or { 2025, 5 })),
reset = function(self)
self.id = nil
self.pstate = nil
--
2.49.0

Stefano Babic

unread,
Apr 29, 2025, 5:24:46 AM4/29/25
to Storm, Christian, swup...@googlegroups.com
Hi Christian,
Applied to -master, thanks !

Best regards,
Stefano
Reply all
Reply to author
Forward
0 new messages