[wic][PATCH 1/2] ksparser: fix crash on an invalid msdos --diskid

Trevor Woerner <[email protected]> Fri, 17 Jul 2026 14:35:06 -0400
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
When a bootloader line sets --ptable msdos with a --diskid that is not a
32-bit integer, the error path builds its message with "... % self.ptable".
self is the KickStart instance, which has no ptable attribute, so the
interpolation raises AttributeError before the intended KickStartError is
raised. Instead of a described error naming the bad value, the user sees an
opaque traceback.

Interpolate the offending value (parsed.diskid) into the message, matching
the gpt branch just below, so a bad msdos --diskid raises a KickStartError
that names it. Fix the "--ptbale" typo in the same message while here.

AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <[email protected]>
---
 src/wic/ksparser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wic/ksparser.py b/src/wic/ksparser.py
index dcf26f788083..a1276af8d3c6 100644
--- a/src/wic/ksparser.py
+++ b/src/wic/ksparser.py
@@ -322,9 +322,9 @@ class KickStart():
                                     try:
                                         self.bootloader.diskid = int(parsed.diskid, 0)
                                     except ValueError:
-                                        err = "with --ptbale msdos only 32bit integers " \
+                                        err = "with --ptable msdos only 32bit integers " \
                                               "are allowed for --diskid. %s could not " \
-                                              "be parsed" % self.ptable
+                                              "be parsed" % parsed.diskid
                                         raise KickStartError(err)
                                 else:
                                     try:
-- 
2.50.0.173.g8b6f19ccfc3a