[wic][PATCH 2/5] ksparser: fix crash on out-of-range overhead factor
Trevor Woerner <[email protected]> Wed, 15 Jul 2026 18:32:23 -0400
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <[email protected]> |
overheadtype() rejects a factor below 1.0, but the error path read
raise ArgumentTypeError("Overhead factor should be > 1.0" % arg)
The message string carries no %-placeholder, so the `% arg`
interpolation itself raised TypeError ("not all arguments converted
during string formatting") before the ArgumentTypeError could be
constructed. Every out-of-range value (0.0, 0.5, -1.0, -inf) crashed
with an opaque TypeError instead of the intended argument error.
Add the missing placeholder so the offending value is reported and the
correct ArgumentTypeError is raised.
AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <[email protected]>
---
src/wic/ksparser.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wic/ksparser.py b/src/wic/ksparser.py
index 24c7015b336d..a73ae56cd196 100644
--- a/src/wic/ksparser.py
+++ b/src/wic/ksparser.py
@@ -99,7 +99,7 @@ def overheadtype(arg):
raise ArgumentTypeError("Invalid value: %r" % arg)
if result < 1.0:
- raise ArgumentTypeError("Overhead factor should be > 1.0" % arg)
+ raise ArgumentTypeError("Overhead factor should be > 1.0, not %r" % arg)
return result
--
2.50.0.173.g8b6f19ccfc3a