Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Max Kellermann <max+openembedded@blarg.de>
To: openembedded-core@lists.openembedded.org
Cc: Max Kellermann <max.kellermann@gmail.com>
Subject: [PATCH] kernel-yocto.bbclass: fix "referenced before assignment" error
Date: Mon, 24 Sep 2018 10:05:55 +0200	[thread overview]
Message-ID: <20180924080555.2407-1-max+openembedded@blarg.de> (raw)

From: Max Kellermann <max.kellermann@gmail.com>

If "scc --configs" fails, do_kernel_configcheck() crashes like this:

      0338:    try:
      0339:        configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
      0340:    except subprocess.CalledProcessError:
  *** 0341:        bb.fatal( "Cannot gather config fragments for audit: %s" % configs)
      0342:
      0343:    try:
      0344:        subprocess.check_call(['kconf_check', '--report', '-o',
      0345:                '%s/%s/cfg' % (s, kmeta), d.getVar('B') + '/.config', s, configs], cwd=s, env=env)
 Exception: UnboundLocalError: local variable 'configs' referenced before assignment

This crash bug was introduced by commit
21de5cc43cfedc703e5bc0515507a6dae36afb74

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
---
 meta/classes/kernel-yocto.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 2ecd060093..496c8a7f68 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -337,8 +337,8 @@ python do_kernel_configcheck() {
 
     try:
         configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
-    except subprocess.CalledProcessError:
-        bb.fatal( "Cannot gather config fragments for audit: %s" % configs)
+    except subprocess.CalledProcessError as e:
+        bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") )
 
     try:
         subprocess.check_call(['kconf_check', '--report', '-o',
-- 
2.19.0



                 reply	other threads:[~2018-09-24  8:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180924080555.2407-1-max+openembedded@blarg.de \
    --to=max+openembedded@blarg.de \
    --cc=max.kellermann@gmail.com \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox