From patchwork Fri Dec 8 11:37:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Zhukov X-Patchwork-Id: 35950 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 10B0AC4167B for ; Fri, 8 Dec 2023 11:38:03 +0000 (UTC) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by mx.groups.io with SMTP id smtpd.web10.28866.1702035478428247357 for ; Fri, 08 Dec 2023 03:37:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@zhukoff.net header.s=fm1 header.b=LT1fwNzp; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=pIPzpFvq; spf=pass (domain: zhukoff.net, ip: 64.147.123.24, mailfrom: pavel@zhukoff.net) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id C34063200A89; Fri, 8 Dec 2023 06:37:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Fri, 08 Dec 2023 06:37:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhukoff.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1702035477; x=1702121877; bh=XTR4ZLmjYs Hu+0EEEnfhexPlpgC8a+Pfq8W9KTgqGiw=; b=LT1fwNzp+qlIZbRsAjghEl/qXY +Aavol0sg7VhvICGWV01SruiDhJS1SN9Xc81xHjIidzH5GcrLmIvFfZ3mWCy0npF l8uDwKoOUZy+NqXZebmk/+HqGiWEASiYo9l4Ih4uDBlGseltuzSosJ8Ghdk+Qz/i pUE+dyyPuQsO8q1k/nVwQD/pc0Bw3ZBGCxsAiAL3f6naF6lQtIJPSAApEa6KHJCz M9S+t3LeJ1Fw/ArtiX7IQHXlQbpPyGQ2Uehb8NV43gW6bVrWUg/d15TNlM3IQY9g 6rjOVxAXyr/+BbQwjg39M/IQTD2GTHox34pEm4XK9ea3aQdo4NgZ+ph/WbNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1702035477; x=1702121877; bh=XTR4ZLmjYsHu+ 0EEEnfhexPlpgC8a+Pfq8W9KTgqGiw=; b=pIPzpFvq9xQuMbvA1N4jxcYjFReCa qF5cQSlzLhVHaOv1SAfnJ9B5v3yys1wJ9x56xvctZtyuweF0fZZaY6rVTNFr2J0g hGu4JNLhxFRMvm6q56sByfa5m1U/AwN/1dUPK/6KIAXbA+14TZEE32XDvAiE/I3m vJOCsL6XZy4LcZFMEDc6DIyftnKP59W/CwP9IFXJkYnkH/p4w8r2+r9yPUXSflMS LX4zjNKyPBPVhfP4vK8dmEhFed+gYhnNNBN8q5nvVRhJx1Du2CfKcMaKZ3asN9ry dtd7e26tU+NnZVhbAqFpyaQFG82LSZ1m5qZKHNpZyZ0LxD8q4SX1jdKUg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudekiedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpefrrghvvghlucgkhhhukhhovhcuoehprghvvghlseiihhhukhho fhhfrdhnvghtqeenucggtffrrghtthgvrhhnpeevfeejkeejudegledtkeejhfettdefje euffehieekvddugfdtffffledvvdefhfenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehprghvvghlseiihhhukhhofhhfrdhnvght X-ME-Proxy: Feedback-ID: ib94946c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Dec 2023 06:37:56 -0500 (EST) From: Pavel Zhukov To: bitbake-devel@lists.openembedded.org Cc: Pavel Zhukov Subject: [PATCH] utils.py: Do not create directories with ${ in the name Date: Fri, 8 Dec 2023 12:37:24 +0100 Message-ID: <20231208113723.766840-2-pavel@zhukoff.net> X-Mailer: git-send-email 2.41.0 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 ; Fri, 08 Dec 2023 11:38:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15640 In some cases ${ may not be expanded in the WORKDIR (one of the cases is undefined variable) and causes cryptic failures [1]. Guard this by erroring out if directory name contains ${ Fixes: [Yocto #15255] [1] ERROR: x-native-1.0+${SRCPV}-r0 do_deploy_source_date_epoch: Error executing a python function in exec_func_python() autogenerated: The stack trace of python calls that resulted in this exception/failure was: File: 'exec_func_python() autogenerated', lineno: 2, function: 0001: *** 0002:sstate_hardcode_path(d) 0003: File: '/home/mischief/src/poky/meta/classes-global/sstate.bbclass', lineno: 654, function: sstate_hardcode_path 0650: bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)) 0651: subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir) 0652: 0653: # If the fixmefn is empty, remove it.. *** 0654: if os.stat(fixmefn).st_size == 0: 0655: os.remove(fixmefn) 0656: else: 0657: bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) 0658: subprocess.check_output(sstate_filelist_relative_cmd, shell=True) Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/sstate-build-deploy_source_date_epoch/fixmepath' Signed-off-by: Pavel Zhukov --- bitbake/lib/bb/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 61ffad92ce..d299b2efdb 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -759,7 +759,8 @@ def mkdirhier(directory): """Create a directory like 'mkdir -p', but does not complain if directory already exists like os.makedirs """ - + if directory.find('${') != -1: + bb.fatal("Directory name {} contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution.".format(directory)) try: os.makedirs(directory) except OSError as e: