All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Subject: [wic][PATCH 1/2] ksparser: fix crash on an invalid msdos --diskid
Date: Fri, 17 Jul 2026 14:35:06 -0400	[thread overview]
Message-ID: <20260717183507.3539287-2-twoerner@gmail.com> (raw)
In-Reply-To: <20260717183507.3539287-1-twoerner@gmail.com>

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 <twoerner@gmail.com>
---
 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



  reply	other threads:[~2026-07-17 18:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 18:35 [wic][PATCH 0/2] tests/unit/test_ksparser_parse: parse the .wks file, fix a diskid crash Trevor Woerner
2026-07-17 18:35 ` Trevor Woerner [this message]
2026-07-17 18:35 ` [wic][PATCH 2/2] tests/unit/test_ksparser_parse: cover the .wks KickStart parser Trevor Woerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260717183507.3539287-2-twoerner@gmail.com \
    --to=twoerner@gmail.com \
    --cc=yocto-patches@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.