From patchwork Mon Sep 19 09:13:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 12958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0518DC6FA82 for ; Mon, 19 Sep 2022 09:14:17 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web09.17856.1663578848030398255 for ; Mon, 19 Sep 2022 02:14:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kV43w7Eb; spf=pass (domain: gmail.com, ip: 209.85.128.53, mailfrom: quaresma.jose@gmail.com) Received: by mail-wm1-f53.google.com with SMTP id ay36so10860120wmb.0 for ; Mon, 19 Sep 2022 02:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=DC2aF5Oi1ZSfaTkXltstj5/WPIZ/qpwagVJIPBOyQvo=; b=kV43w7EbxZ8CGa9TkNwZI4ujn/uLUPcDAlv/CLV57EM8SGOMgEwcif5EEZWsFJAaJW MdaQYVPt8H3gbzOuMhHZf9Df13kQ32seNwBUCmS4vkDcy6p1W3hG8cPiwmXLTc28w3yb zN7tX/cbvbJcmEggMUBdlU+/kCR0MAmS8l2dIoPt8rV+BON7AB9BWfqRl4olAWdOaJb3 6/xjt4qWZK5tZHJQ36aIly1cUyq1arwBvBKzwaByZrMHUx8HU+M9E0ubseJS5OKgqU6h Bu64SXrUBy/cLh6GtiJ9Vo9gkLLXnhmlVhqvaLIPCd7X/QXaknaMeOu9Ub1c1e5oUtJ4 tMbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=DC2aF5Oi1ZSfaTkXltstj5/WPIZ/qpwagVJIPBOyQvo=; b=S3hB4zrEwii6ObNHU1fWsaa5RHfplj9rFLKQotGdTK1Xq6MAMe6WAr3DUZrmYkjHQM mEx9oKRyoU3QWhseR4dPsFVaw6z56GURHKh7CQfjbMWMzG92WXL4Sj71z/pwVZvlAnTY HGYXZxTcA0heD+O9UPFyftkptTwYNJfcwUQUF+n5+Zyk43DmlK1/8C9VShBrjnCxzOFQ jmg0JQkrxj/W4VXetMRloWaKrWk87Gaj1ldcmjt4L9KCoNBhS30KPjIXerum+S13Mk0u paVrjDAKbmo9f3NpEaW1FUJ4WNZeS+QymrYVvfzWKearB69NdnxBj7laYfWNsCZx/mvc QoNQ== X-Gm-Message-State: ACrzQf3jlkKPMZzD7ubKzk+bHRJlnTV4Mu8WH2RTGo7JYjPgvAQe1DvM /jbRyL/1v//V0RsPqStVKXGxkhqeN20= X-Google-Smtp-Source: AMsMyM4B3KpAYKwO2lKMKLUJLIWEnFTeg6yC1CYG8lxRlYYqlM24cr6t7b4vRHIzYbe05lHdTxxuqQ== X-Received: by 2002:a7b:cd14:0:b0:3b4:8680:79a7 with SMTP id f20-20020a7bcd14000000b003b4868079a7mr11851554wmj.28.1663578845688; Mon, 19 Sep 2022 02:14:05 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id bg31-20020a05600c3c9f00b003a5f4fccd4asm14215262wmb.35.2022.09.19.02.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 02:14:05 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: bitbake-devel@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 1/2] lib/bb: warning when the debug message is invalid Date: Mon, 19 Sep 2022 09:13:11 +0000 Message-Id: <20220919091312.894690-1-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Sep 2022 09:14:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13978 There are many messed up calls for the debug log, so is better to warm about this as they will not work as expected. The level need to be an integer and the msg a string. Signed-off-by: Jose Quaresma Reviewed-by: Joshua Watt --- lib/bb/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index b8333bdb..81b5a628 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -60,6 +60,10 @@ class BBLoggerMixin(object): return if loglevel < bb.msg.loggerDefaultLogLevel: return + + if not isinstance(level, int) or not isinstance(msg, str): + mainlogger.warning("Invalid arguments in bbdebug: %s" % repr((level, msg,) + args)) + return self.log(loglevel, msg, *args, **kwargs) def plain(self, msg, *args, **kwargs): From patchwork Mon Sep 19 09:13:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 12959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 050B1ECAAD3 for ; Mon, 19 Sep 2022 09:14:17 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web09.17857.1663578848473577890 for ; Mon, 19 Sep 2022 02:14:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hdKy3ejd; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: quaresma.jose@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id t7so46430643wrm.10 for ; Mon, 19 Sep 2022 02:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=X7XFgUXY7WYpZ0LODOAMw6lRV+N4xhhhMKJGw3uQ7M4=; b=hdKy3ejdECh3EoPg4cwTgDSkvhoE6ntN1oK9+X5Zm7wK+mSGl0BCvGDqbeLfVdpGbl e9Czlk6PiPW+SuFIbLkWxgBVskwc5IxFbYsYj7PbCS6wPXmwXexslpW1lV2m9q7cfT6o lbzfK+ssoolm3Ijrz4yVlOq0Whq6293nEqXd6aAp3xM12IwkbpWJS4hjiJTGrtA+shu7 BIafB8zkLfyepI2a2AQIhRsSQH0gX+/oQ5Wi408wFXWeMdopmDlCT1kwbf8AkBrEYocH 06nzDrjZ/4ztx/D8boEQ2L8k7hxVNg2KJRtQ4VX4wO7XvLit1aY+f0+M+00INvqOMx3B s8YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=X7XFgUXY7WYpZ0LODOAMw6lRV+N4xhhhMKJGw3uQ7M4=; b=WEP7pTtMlr3XfUY/RblcauyQzoXbBxs1rSNoGOaS9G2SmoxpyghRq9AeXSp5sdOm06 rGLRvzYxHddK7jzpqmkqhUAqXeakWnPaqPyov1ApNWPVlISmL5/9vjXJ32P7BkXRHNF6 9Pm9tSVNhq4AG9L8u43NUSsMYtUdV28n6nlrn5JeWXh5s6ZMbvsVjwS0aCfg4yzhy9Vf 9xkdvUYYZ6HwgXYNxdV/2WRcyWl13k+M6KFD7hndgYPVMoTxSOlrP3Ge28WfZi/KWIal 5UIMKSX1C8LpPtLxRdglbNXHwrN9T37xWtFjGznGYJjP4Qd417BJurFRoEqcEsA7wYVg d38Q== X-Gm-Message-State: ACrzQf1Skxblm1TKMpjOkJLiMntCc+PrKgtknAwxt+aNALKCWjVfT5oV WhHcDjhsQXj+4VlhFT/XHTZ+RmI443M= X-Google-Smtp-Source: AMsMyM4ItGgYv4mBXhHgyInlNuECeWlgwZjVZ9AChPdB1GoRXT6ZhbupSmGznqqZ7MwYpnusXr3Mjg== X-Received: by 2002:adf:ee86:0:b0:228:6fe1:371 with SMTP id b6-20020adfee86000000b002286fe10371mr9677549wro.684.1663578846358; Mon, 19 Sep 2022 02:14:06 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id bg31-20020a05600c3c9f00b003a5f4fccd4asm14215262wmb.35.2022.09.19.02.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 02:14:05 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: bitbake-devel@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 2/2] lib/bb: fix bitbake debug logger with invalid args Date: Mon, 19 Sep 2022 09:13:12 +0000 Message-Id: <20220919091312.894690-2-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220919091312.894690-1-jose.quaresma@foundries.io> References: <20220919091312.894690-1-jose.quaresma@foundries.io> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Sep 2022 09:14:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/13979 f68682a7 logging: Make bitbake logger compatible with python logger introduces the "_debug_helper" that change the api of the debug logger as they call now bbdebug always with level 1. Any old code that uses the old syntax "debug(lvl, msg)" is broken if they don't call the main debug log. This issue can be replicated running "bitbake -D" with: from bb.fetch2 import logger logger.debug(2, "I am alive") That one side effect is crashing the knotty: | Traceback (most recent call last): | File "/srv/oe/bitbake/lib/bb/ui/knotty.py", line 685, in main | event.msg = taskinfo['title'] + ': ' + event.msg | TypeError: can only concatenate str (not "int") to str Signed-off-by: Jose Quaresma --- lib/bb/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index 81b5a628..6378bce3 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -45,7 +45,11 @@ class BBLoggerMixin(object): self.debug = self._debug_helper def _debug_helper(self, *args, **kwargs): - return self.bbdebug(1, *args, **kwargs) + lvl = 1 + if isinstance(args[0], int): + lvl = args[0] + args = args[1:] + return self.bbdebug(lvl, *args, **kwargs) def debug2(self, *args, **kwargs): return self.bbdebug(2, *args, **kwargs)