From patchwork Tue Jun 14 13:16:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9192 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 6ED6DC43334 for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web12.5889.1655212619696010915 for ; Tue, 14 Jun 2022 06:17:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ixvr9wZZ; spf=pass (domain: gmail.com, ip: 209.85.128.52, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f52.google.com with SMTP id r123-20020a1c2b81000000b0039c1439c33cso4780388wmr.5 for ; Tue, 14 Jun 2022 06:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FTC5cXBGpbyP49C4is+heUbT3LnE71851DctikNERJo=; b=ixvr9wZZkRtnsvHmeCN53+l5Dr7lGjj7F6v5TaOY7rTpMGFtB2Fc/hHPRopF4Rg/o4 m/o0eO3a/TFqjtnhjgEeAwzpVKn+SizGzGaDe+tokZ+TI3tEhxSFNi/Cd1GtHktUnp0j E0+DvHvpFRKKIo3WC8fukInGJ36BEgz1uukiPyaDJOGCWsEL2sAwqDoP+DPxJAIm21JA NDgI5ehePAISU/BAh3gmrEEewc89+rPrWmOppfXlj+SccgeAGOeFgI4mxflmkMiI2zAf +4cpzuULVf1vh3/QJsjK4GGnnVjN/b6jhtJtmpzKafBoLMgNhlf5VbgiojVk0Bhj8DFA wT1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FTC5cXBGpbyP49C4is+heUbT3LnE71851DctikNERJo=; b=CXy4BQMTB10jT0L+FrGiekReYYLik2w4MBmhlfo7srw70c4x2UIGygkBvzL8+ErKjX HqLQP7cKdRvgR+dHWA42O4i8kelJTVV3QI0tmRUbF0N0TzAI4dI/diYNx0puNrxmTXnP 41lRpd97URRrtK+1qoK6ux+W/KRl2Wh6L3C3QSHUg5I/4fn0oFNNovsFBSYgfu+W9pgo Zh1FQZW5p+uvXsSgrL05XuZWGWUOXz7qNWzG+lynAIzBzb8NPNv7SblF2O2LUTuUYKRA +SGsJDAwHf4LiEY1XgWOFFp+sdT5FajPWxE2ngnz4qEGcj9ONKeCyIED9y9A6DAKWsyJ hNyg== X-Gm-Message-State: AOAM530MZ3xLl4WM+gd+S0wf3E729+oxB5Qw44BGFutZC/EGGuo21pzg +q+ogdYnoGlVWd4/f8k3W3PkpXM0Xw== X-Google-Smtp-Source: ABdhPJyduKXE4Ts9ETtm09uBWyBXTtwrRZioRbqJiThdyyZS5AI5eBrF8UogA+zcGZQylOBVMVaArw== X-Received: by 2002:a05:600c:1547:b0:39c:804c:dc23 with SMTP id f7-20020a05600c154700b0039c804cdc23mr4146753wmg.23.1655212618141; Tue, 14 Jun 2022 06:16:58 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:16:57 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 1/7] python: Avoid shebang overflow on python-config.py Date: Tue, 14 Jun 2022 15:16:46 +0200 Message-Id: <20220614131652.566471-1-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606155807.1414519-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166882 The native path may be too big, leading to shebang overflow. Just use the #!/usr/bin/env python3. Signed-off-by: Paulo Neves --- ...shebang-overflow-on-python-config.py.patch | 33 +++++++++++++++++++ .../recipes-devtools/python/python3_3.10.4.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch diff --git a/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch b/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch new file mode 100644 index 0000000000..921da8de7c --- /dev/null +++ b/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch @@ -0,0 +1,33 @@ +From f0c9dec63d452a7cd1e15ea653f4aced281f021c Mon Sep 17 00:00:00 2001 +From: Paulo Neves +Date: Tue, 7 Jun 2022 16:16:41 +0200 +Subject: [PATCH 1/1] Avoid shebang overflow on python-config.py + +The whole native path may be too big, leading to shebang +overflow. Let's just use the env shebang. + +Denial reason: [1] + +Upstream-Status: Denied [distribution] + +[1] https://github.com/python/cpython/pull/93760#pullrequestreview-1005365737 +--- + Makefile.pre.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index f0aedb76cb58999427804255da56fa53284d7032..dd88e43114730f7681715777cc76dabb31113176 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1638,6 +1638,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh + @ # Substitution happens here, as the completely-expanded BINDIR + @ # is not available in configure + sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py ++ @ # Otherwise we might get huge shebangs with native paths ++ sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py + @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} + LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config + @ # In OpenEmbedded, always use the python version of the script, the shell +-- +2.25.1 + diff --git a/meta/recipes-devtools/python/python3_3.10.4.bb b/meta/recipes-devtools/python/python3_3.10.4.bb index 6bd3a6aba8..357025f856 100644 --- a/meta/recipes-devtools/python/python3_3.10.4.bb +++ b/meta/recipes-devtools/python/python3_3.10.4.bb @@ -34,6 +34,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \ file://deterministic_imports.patch \ + file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ " SRC_URI:append:class-native = " \ From patchwork Tue Jun 14 13:16:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9193 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 8DB65CCA480 for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web10.5979.1655212620761240563 for ; Tue, 14 Jun 2022 06:17:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WH3b3kzG; spf=pass (domain: gmail.com, ip: 209.85.128.42, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f42.google.com with SMTP id n185so4628324wmn.4 for ; Tue, 14 Jun 2022 06:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jx10Eh51y4HbWngWLtUzs8P6priZADjXMkCR29+D+5U=; b=WH3b3kzGRE1G+mDqo8kyYB07NxRAb+8HPIqhADqIRZQ6+bbpfzaGv9VNWC5LFrrF6N 7DLUgAQQWB0FYVIJC1WrP3Y1p9EukoFgcsA8BeizQtLEtdNXdcAz67ezoE+LwOMS87Oz 1DOIoy8F0yatncK16nqQjRk/4wkbOgXPlhsItQQpPtXbadb+vw21PJuA0kpniaF90BSM AlTVUcgS8JKczj/gWBNhohUyHjCj7G8/koTHwG5gZzNFFbQvjy/HZ5//DifNF/69H0lA Qs5+qh8AMg/j/9afagPzoxPexNx3wzbxMe2f0j0ujHQCytUulLJtWz9EbqEMad0OOnn2 a/bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jx10Eh51y4HbWngWLtUzs8P6priZADjXMkCR29+D+5U=; b=3+4za7Gio3IdbkDkHkEYJJkvU4cMnA933xJQOY3KAygWbA3HDl74GXbY9gkyjmpqeY bg3Qe2WyXRwlyCxCL3Xo8JCQMY2+B1vrMBFjOeH+yRceA/eu3RdZNL4HhoxoA82idzaK CRiuVA8QTAHEaK5NOCbMPC5O1MAzwW3fa4j0sQCFRAUDcBJ73k8o93IDBTa4motMKppr TZVWX6O1nyTLsFrIRHPYWq8BpAhyMUkewFTRpX/cFC6d7v31EsNU5X2D5F+ojhvRMVSo rPvOJ2EZ9mM1ubm8Ga0I1jkIdMl+29nhfkqOGUysl+GbCk5Z8u3P2BF3Qdxqv088+sQM 741Q== X-Gm-Message-State: AOAM533h3euny2miKeBLoLA/yZCicBV4kjna8bmyZqRiZhFH4sYUg7Wp 1cewxoX45eN0x0Rt3ENfGpaTegnFFQ== X-Google-Smtp-Source: ABdhPJxbA1iPipsRWQ2W/u0dCFJNmYJnqKJe3PEu4Fx80Cu9M+bwz0KEHH54/fO+VjyFh/XvSTcY6Q== X-Received: by 2002:a05:600c:2c46:b0:39c:55a0:9533 with SMTP id r6-20020a05600c2c4600b0039c55a09533mr4090225wmg.104.1655212619014; Tue, 14 Jun 2022 06:16:59 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:16:58 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 2/7] gtk-doc: Fix potential shebang overflow on gtkdoc-mkhtml2 Date: Tue, 14 Jun 2022 15:16:47 +0200 Message-Id: <20220614131652.566471-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166883 A native path can cause a shebang overflow on gtkdoc-mkhtml. Replace it with /usr/bin/env. Signed-off-by: Paulo Neves --- meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb b/meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb index 150d2c0b23..392913fcc6 100644 --- a/meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb +++ b/meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb @@ -43,6 +43,7 @@ do_install:append () { ${datadir}/gtk-doc/python/gtkdoc/config.py; do sed -e 's,${RECIPE_SYSROOT_NATIVE}/usr/bin/pkg-config,${bindir}/pkg-config,' \ -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \ + -e '1s|^#!.*|#!/usr/bin/env python3|' \ -i ${D}$fn done } From patchwork Tue Jun 14 13:16:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9194 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 84068CCA47E for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web12.5890.1655212621498481580 for ; Tue, 14 Jun 2022 06:17:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KwsFzFux; spf=pass (domain: gmail.com, ip: 209.85.128.42, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f42.google.com with SMTP id x6-20020a1c7c06000000b003972dfca96cso4782283wmc.4 for ; Tue, 14 Jun 2022 06:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2M59DV9KSK0oz9TPBtZO/rVVlzv0gmoU1XlQPGxMdXs=; b=KwsFzFuxWYU5UcoFzmjGr/QHFuLoS1Pw49FvND3PbCogzUnw/5flxjC0TMQ2hatWRO 73HhgQfOtL/vvSgnE5DLOu43aCEE0lGzlqPrQi6ID8SCcBwlBLLi92MaIcgTZ2xQaXzw i3WYrVgMc7DJAKtS0EnQSbLuswvsuvt2BovnUacp8MpLvkw6dTk65f/XO9AeL1vkoxy5 Rs8GxgWQReuAe6F3C0RG+DJ/HJ4eS64lrd1BaeemPazqzjr0oQtikcbRC6Ur3VhRYCQj PNVgYdzAbVobMUXkHvtByjTGS1dl9ndhl5UUlhB1mwItbacp5VvyP+0NJkztpDjLOrsk r/lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2M59DV9KSK0oz9TPBtZO/rVVlzv0gmoU1XlQPGxMdXs=; b=CGXbFlpJzYrKU3o5vnuoYlYLFz4BSQzbzfsBlUhue2GBrREb+7Fmv6JrTF44d3eW9k 9200IoNOFMdd4D0kW9QRJzvfMnNNtD9Qdqhb0gtdWYCW9OcMkP/rFh4QhK++KteoF63m qH+SXjovs0M2ITR2CvwLpYgD7VAKOnUr0FAH3xmAEbpbVnpXormcraGxnM/vhdDzHA29 CkJwqbEV8WMyMctMM5Bqv6XrYZSYxm4DtnXhHdR02uHoGbzc+0UTuKSnyrPM9t0CRSMs XVFaIdLMjLJ01YlJEQjRSOINMJTxjwQVf7TmysRjKRA/oxYdva/ceDfigjrWwlbhhsHm FLNw== X-Gm-Message-State: AOAM5337M7AfXcZeic5qiKoD9O1OMko72AIBSeBk0IqNI0rd4BTjvNjB rA8LcftqAvYiOMmXdcK5JgxVfYn6Pw== X-Google-Smtp-Source: ABdhPJynStg+AzP0Qez1ynsXzEjaQ/VjGSx/ZEHwwNqfTzKgPhXi/rDWmWd9c70JIVj20BIbrZaB6w== X-Received: by 2002:a7b:c38b:0:b0:39c:6964:34a2 with SMTP id s11-20020a7bc38b000000b0039c696434a2mr4036673wmj.165.1655212619998; Tue, 14 Jun 2022 06:16:59 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:16:59 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 3/7] insane.bbclass: Make do_qa_staging check shebangs Date: Tue, 14 Jun 2022 15:16:48 +0200 Message-Id: <20220614131652.566471-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166884 As reported in the bug report [1], there was no check for shebang sizes on native scripts and now this is fixed. The path scope of the qa_staging was increased from just checking libdir to all the relevant SYSROOT_DIRS. It is possible to skip this check through INSANE_SKIP. [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=11053 Signed-off-by: Paulo Neves --- meta/classes/insane.bbclass | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 9ca84bace9..b2951a48fe 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass @@ -630,6 +630,11 @@ def qa_check_staged(path,d): bb.note("Recipe %s skipping qa checking: pkgconfig" % d.getVar('PN')) skip_pkgconfig = True + skip_shebang_size = False + if 'shebang-size' in skip: + bb.note("Recipe %s skipping qa checkking: shebang-size" % d.getVar('PN')) + skip_shebang_size = True + # find all .la and .pc files # read the content # and check for stuff that looks wrong @@ -651,6 +656,13 @@ def qa_check_staged(path,d): error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root) oe.qa.handle_error("pkgconfig", error_msg, d) + if not skip_shebang_size: + errors = {} + package_qa_check_shebang_size(path, "", d, None, errors) + for e in errors: + oe.qa.handle_error(e, errors[e], d) + + # Run all package-wide warnfuncs and errorfuncs def package_qa_package(warnfuncs, errorfuncs, package, d): warnings = {} @@ -1139,7 +1151,9 @@ addtask do_package_qa_setscene python do_qa_staging() { bb.note("QA checking staging") - qa_check_staged(d.expand('${SYSROOT_DESTDIR}${libdir}'), d) + sysroot_destdir = d.expand('${SYSROOT_DESTDIR}') + for sysroot_dir in d.expand('${SYSROOT_DIRS}').split(): + qa_check_staged(sysroot_destdir + sysroot_dir, d) oe.qa.exit_with_message_if_errors("QA staging was broken by the package built above", d) } From patchwork Tue Jun 14 13:16:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9195 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 85599CCA47C for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web10.5979.1655212620761240563 for ; Tue, 14 Jun 2022 06:17:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NJn/ZISS; spf=pass (domain: gmail.com, ip: 209.85.128.42, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f42.google.com with SMTP id n185so4628324wmn.4 for ; Tue, 14 Jun 2022 06:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uAMPa++ia1KnffFugYvd8o2vuvtd+oNHzbTD5UJLnpo=; b=NJn/ZISS00qzyTdAmzu0/wN8B+7W6XU97VtFvv4KLwlcmW+JR9AZhRB6/pWWEwuk/s zJe78QqmG/V/Sjw/J/CmFn9hjNYFwk0mboPTmGROi8HPUM7ziLXojRj7AcGjr+HL2sKI IOlutcdxZtGFdnegR/4ULlwTW0r2rSZD3zyNoGZWek+Pk9VJ8YgkYRkMULsIAK9FPnQc qoP5hT88QwW2VUTustQ9hpSriYZC6hVmnLdm//3QF6DpTMTP4T2Ocm9UC3dUvraZjhPk HGqVbExQ87Xg28Px/8RQgsUl7gEUxwZbebbkMUpIyzFjRUHNpsQWj2H5w64aWSRMNccz xAdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uAMPa++ia1KnffFugYvd8o2vuvtd+oNHzbTD5UJLnpo=; b=s1eC46w1r4e4zTVQgeqchcf+hkAHk/D4sWwBs5upzKFWoUMgNSI4fIeu3BYPVsKiyd wFZEEUkUQo1NzhK2BfdrL0CTDQB+dRWHNmqRo38IiASQr3sUF+PScFe04RrtQEO2B8i5 PxBkciCkFSrtLtygAVxC3iWt8yT7iJLK7oieZsmnNzHVmu+y49G/1oIfAT5OQ9A641eC 21G7kIq2D2aVDARndyq+jPg4BzAJoj6gMVCcX8VcdEy1HOvts/8of0ZKDkQA8VY5NghL 0MFM685dSy9vMHGtO9mJ73gPxDc59UXIEGij95SFj+U/Q8bBsM9LI+QYjmrsXpMrtye9 5NQQ== X-Gm-Message-State: AOAM531fck4CCBWtaS2HPSgc7/NVwrD/0JuSO/v+Z73tDlYrzKXgC9+p 89y2pXsPkfaVlYX4QKA0MKqN/m4gBA== X-Google-Smtp-Source: ABdhPJy84HNZe+idvvaFqhFM7d9vtKNbgZyj03px+uTM00nVoKKBF7oTDnoQetaapi/lcSSqvAk3hA== X-Received: by 2002:a7b:c31a:0:b0:39c:4783:385e with SMTP id k26-20020a7bc31a000000b0039c4783385emr4187963wmj.185.1655212621131; Tue, 14 Jun 2022 06:17:01 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:17:00 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 4/7] oeqa/selftest: Add test for shebang overflow Date: Tue, 14 Jun 2022 15:16:49 +0200 Message-Id: <20220614131652.566471-4-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166885 Make sure we do not stage any executable with a bigger shebang than 128. Fixes [1] [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=11053 Signed-off-by: Paulo Neves --- .../sysroot-test/sysroot-shebang-test_1.0.bb | 12 ++++++++++++ meta/lib/oeqa/selftest/cases/sysroot.py | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 meta-selftest/recipes-test/sysroot-test/sysroot-shebang-test_1.0.bb diff --git a/meta-selftest/recipes-test/sysroot-test/sysroot-shebang-test_1.0.bb b/meta-selftest/recipes-test/sysroot-test/sysroot-shebang-test_1.0.bb new file mode 100644 index 0000000000..6c834be897 --- /dev/null +++ b/meta-selftest/recipes-test/sysroot-test/sysroot-shebang-test_1.0.bb @@ -0,0 +1,12 @@ +SUMMARY = "Check that shebang does not exceed 128 characters" +LICENSE = "CLOSED" +INHIBIT_DEFAULT_DEPS = "1" + +EXCLUDE_FROM_WORLD = "1" +do_install() { + install -d ${D}${bindir} + echo '#!BiM3cnVd1Amtv6PG+FynrQiVMbZnX5ELgF21q3EkuB+44JEGWtq8TvBJ7EGidfVs3eR3wVOUbLnjYDlKUWcm7YC/ute7f+KDHbwxziRUSUBZAUqgjiQdfQ0HnxajI0ozbM863E9JV9k13yZKYfh9/zR77Y6Dl4Dd3zOWS75LSpkAXV' > ${D}${bindir}/max-shebang + chmod 755 ${D}${bindir}/max-shebang +} + +BBCLASSEXTEND = "native" diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py index 315d1a61c2..9457f1e3ac 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -35,3 +35,13 @@ TESTSTRING:pn-sysroot-test-arch1 = "%s" TESTSTRING:pn-sysroot-test-arch2 = "%s" """ % (uuid1, uuid2)) bitbake("sysroot-test") + + def test_sysroot_max_shebang(self): + """ + Summary: Check max shebang triggers. To confirm [YOCTO #11053] is closed. + Expected: Fail when a shebang bigger than the max shebang-size is reached. + Author: Paulo Neves + """ + expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]" + res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True) + self.assertTrue(expected in res.output, msg=res.output) From patchwork Tue Jun 14 13:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9191 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 6F918CCA47A for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.web11.5972.1655212623753104710 for ; Tue, 14 Jun 2022 06:17:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m59Yphms; spf=pass (domain: gmail.com, ip: 209.85.221.47, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f47.google.com with SMTP id h19so8028405wrc.12 for ; Tue, 14 Jun 2022 06:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L214Ml3yzg5bNWzkvsSdrl1/Ke3TbE7wfxjnrdmaebs=; b=m59YphmsvSyQoLGlMVSWgOv2w9QB3k1vDIlKNpbX39ybolizhshhDr9l+y8WPy5uGQ B83LqEDfQapW9iI/gpqbzoH8kimyV6sUHgyVMYdlnMpC3Bw8qzOLD0RZrEbZtFLh4yTP CcQnBOaIpJeMTxzSMvnUPDLthybEACLwjdakjl/BqKm/Bakaum2SKHeOi4UYOPa7zYkE N5WudFg7qMzvBskzpxg9AnvgvB4zzsjArfBXZnZHADcTzfP49diU+Q2GsY1POrJTgreM jPH+9qmVlVx2xIDBYD7tzw0oM4SPVBBq0399TPzFrketUL5SIJjWe97YHlOrkl6l/INI AjHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L214Ml3yzg5bNWzkvsSdrl1/Ke3TbE7wfxjnrdmaebs=; b=PpOjVkdCd7MIHmsCdtbTMu2WJVGpwkjt87hsnIV+4DdGNAPkS572jmP9upKvp8eOjd e79TK9WoXm//qTKzEvSesQtydQOqdxnDR4yBOCpsfmkYDUuWtC/44MLiQDA//dmYCvfU W1Wn20mtnlNKUw8Ipm2GdNfP29JghNQUMuXNu4+WATMx/37Y6ue3ryXt0VQ1oHqauAxM BdG1Gm0D2jMYCyq429HiKGrJxhex4JWjjGb+EIIlHrf+oM4ZYe20V3U6tFoROBSnA42e ydRJB4k/qmCej4AFUA6YYwDrZhqlE94Q5B1TCeybpInhDieZ2o+J/Dzw/F9Zbkqka8AX cQDA== X-Gm-Message-State: AJIora8T0xL6onWjFEs0re+kOaCvKsuq1t+NrfHA1ckKcrlJrNwJe3jH y6sfjUcIfX1i3jJ96adTc8EcMO97QA== X-Google-Smtp-Source: AGRyM1vudOo0wNBqjGbxvUogcF9jy3b+wO9K7PsfmArb01vkr/tO8+gc7pbEtIaNoXDc/plLAPhvkQ== X-Received: by 2002:a5d:4289:0:b0:219:fd71:a9f7 with SMTP id k9-20020a5d4289000000b00219fd71a9f7mr4742197wrq.9.1655212622082; Tue, 14 Jun 2022 06:17:02 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:17:01 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 5/7] oeqa/selftest: Test staged .la and .pc files Date: Tue, 14 Jun 2022 15:16:50 +0200 Message-Id: <20220614131652.566471-5-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166886 These files are checked by qa_check_staged but there was no test cases for whether the tests actually worked. Now there are. Signed-off-by: Paulo Neves --- .../sysroot-test/sysroot-la-test_1.0.bb | 16 ++++++++++ .../sysroot-test/sysroot-pc-test_1.0.bb | 12 +++++++ meta/lib/oeqa/selftest/cases/sysroot.py | 32 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 meta-selftest/recipes-test/sysroot-test/sysroot-la-test_1.0.bb create mode 100644 meta-selftest/recipes-test/sysroot-test/sysroot-pc-test_1.0.bb diff --git a/meta-selftest/recipes-test/sysroot-test/sysroot-la-test_1.0.bb b/meta-selftest/recipes-test/sysroot-test/sysroot-la-test_1.0.bb new file mode 100644 index 0000000000..21f06782fb --- /dev/null +++ b/meta-selftest/recipes-test/sysroot-test/sysroot-la-test_1.0.bb @@ -0,0 +1,16 @@ +SUMMARY = "Produce a broken la file" +LICENSE = "CLOSED" +INHIBIT_DEFAULT_DEPS = "1" + +EXCLUDE_FROM_WORLD = "1" + +# remove-libtool.bbclass is inherited by default and removes all +# .la files which for this test we specifically do not want. +REMOVE_LIBTOOL_LA = "0" + +do_install() { + install -d ${D}${libdir}/test/ + echo '${WORKDIR}' > ${D}${libdir}/test/la-test.la +} + +BBCLASSEXTEND += "native" diff --git a/meta-selftest/recipes-test/sysroot-test/sysroot-pc-test_1.0.bb b/meta-selftest/recipes-test/sysroot-test/sysroot-pc-test_1.0.bb new file mode 100644 index 0000000000..e748310fc4 --- /dev/null +++ b/meta-selftest/recipes-test/sysroot-test/sysroot-pc-test_1.0.bb @@ -0,0 +1,12 @@ +SUMMARY = "Produce a broken pc file" +LICENSE = "CLOSED" +INHIBIT_DEFAULT_DEPS = "1" + +EXCLUDE_FROM_WORLD = "1" + +do_install() { + install -d ${D}${libdir}/test/ + echo '${WORKDIR}' > ${D}${libdir}/test/test.pc +} + +BBCLASSEXTEND += "native" diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py index 9457f1e3ac..588fc8c713 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -45,3 +45,35 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]" res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True) self.assertTrue(expected in res.output, msg=res.output) + + def test_sysroot_la(self): + """ + Summary: Check that workdir paths are not contained in .la files. + Expected: Fail when a workdir path is found in the file content. + Author: Paulo Neves + """ + expected = "la-test.la failed sanity test (workdir) in path" + + res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True) + self.assertTrue(expected in res.output, msg=res.output) + self.assertTrue('[la]' in res.output, msg=res.output) + + res = bitbake("sysroot-la-test-native -c populate_sysroot", ignore_status=True) + self.assertTrue(expected in res.output, msg=res.output) + self.assertTrue('[la]' in res.output, msg=res.output) + + def test_sysroot_pkgconfig(self): + """ + Summary: Check that tmpdir paths are not contained in .pc files. + Expected: Fail when a tmpdir path is found in the file content. + Author: Paulo Neves + """ + expected = "test.pc failed sanity test (tmpdir) in path" + + res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True) + self.assertTrue('[pkgconfig]' in res.output, msg=res.output) + self.assertTrue(expected in res.output, msg=res.output) + + res = bitbake("sysroot-pc-test-native -c populate_sysroot", ignore_status=True) + self.assertTrue(expected in res.output, msg=res.output) + self.assertTrue('[pkgconfig]' in res.output, msg=res.output) From patchwork Tue Jun 14 13:16:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9196 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 83C01C433EF for ; Tue, 14 Jun 2022 13:17:05 +0000 (UTC) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.groups.io with SMTP id smtpd.web08.6119.1655212624367329031 for ; Tue, 14 Jun 2022 06:17:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EA8I3mPZ; spf=pass (domain: gmail.com, ip: 209.85.221.52, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f52.google.com with SMTP id h5so11313104wrb.0 for ; Tue, 14 Jun 2022 06:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CR6UkZUuS6acAAgx24EaiP1da4rnTNHECXKHjjMSFiY=; b=EA8I3mPZDJjyq8mRgWB8T7otdQWzNgEVa+kZ9ByhAmsXxLWmyxfTuRDJEJgIp8a8wO ulxufCeQ0KWBIY25ijUJ581MxNV7jFb1FqIqAfJDlS29fygF5Y85CbFO/fRWh/vYDu3R hLZIy/XzeODhtTp+JoLLcZBNaYn7PuxMV5CJ7+b0X8ew9qYi+BT2d+Egn1T9JmdFN9BL 06LDSf+0mwQd2KZRHofIQZiA0/ldMx70tMhVYfPjt6kdVdzr7gaxquOJA04ZDE8rfYvv 7KjySXfT8MMunDSQfOpuGQA1DkbNIcE4HHrKf4sS59AvIfsMQfDTrrYrGiVLhkqe4K8b jLZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CR6UkZUuS6acAAgx24EaiP1da4rnTNHECXKHjjMSFiY=; b=7hXNYrBIilFvfjB8/la2xEK7t/miU7EQ8Xy8CjZIH3O/rC7QZ2XSkErjqoL1Gi1LY/ T3N1YaPQuLw/odDu2FYwkw5GHl/xIj3XXRo/S+JtJKi6qhfrgbcCrLdgsmywkcx2vIql CnJ8QdAPxTx1OfPDBgziPt16gfrz8rW0Mn1e2XbkPN5Vg5VnABswJMRrD622hsZqWc1k 3pTXvxlGe+GnhcSQlyF8zB5ndyyoafc2HeguT9taKSnLZ95U6sZdbBjSmrmROWSZAX3Z WVCnmUJHChuAYUWAH8IEYm+kqUxn+6qpes0MZsEv10fzfZC7MkYbdBwRRF8Hdf2Cfpwi TnWw== X-Gm-Message-State: AJIora/lf6zPD3ZP8UV33yZKVp1x/wAFofiLv4aQc9IhAnfG4skV4vln iTix9tg/RehUyRdUW+PgXttDybl6kQ== X-Google-Smtp-Source: AGRyM1uOs0oxabxQAjK1p8sikDXfSisFtzm7BcYu1K95HQn12N8yKqmtdst+Ybtoew2/KyOTP7G9HQ== X-Received: by 2002:a5d:6945:0:b0:211:7de7:7247 with SMTP id r5-20020a5d6945000000b002117de77247mr4836105wrw.169.1655212622934; Tue, 14 Jun 2022 06:17:02 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:17:02 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 6/7] utils: Add cmdline_shebang_wrapper util. Date: Tue, 14 Jun 2022 15:16:51 +0200 Message-Id: <20220614131652.566471-6-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166887 Useful to work around shebang relocation issues, where shebangs are too long or have arguments in them, thus preventing them from using the /usr/bin/env shebang. --- .../wrapper/cmdline-shebang-wrapper-test.bb | 21 ++++++++++++ .../recipes-test/wrapper/files/test.awk | 2 ++ meta/classes/utils.bbclass | 34 +++++++++++++++++++ meta/lib/oeqa/selftest/cases/wrapper.py | 11 ++++++ 4 files changed, 68 insertions(+) create mode 100644 meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb create mode 100644 meta-selftest/recipes-test/wrapper/files/test.awk create mode 100644 meta/lib/oeqa/selftest/cases/wrapper.py diff --git a/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb b/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb new file mode 100644 index 0000000000..302eea8901 --- /dev/null +++ b/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb @@ -0,0 +1,21 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SUMMARY = "Check that create_cmdline_shebang works" +LICENSE = "CLOSED" +INHIBIT_DEFAULT_DEPS = "1" + +SRC_URI += "file://test.awk" + +EXCLUDE_FROM_WORLD = "1" +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/test.awk ${D}${bindir}/test + sed -i -e 's|@AWK_BIN@|${bindir}/awk|g' ${D}${bindir}/test + create_cmdline_shebang_wrapper ${D}${bindir}/test + if [ $(${D}${bindir}/test) != "Don't Panic!" ]; then + bbfatal "Wrapper is broken" + else + bbnote "Wrapper is good" + fi +} + +BBCLASSEXTEND = "native" diff --git a/meta-selftest/recipes-test/wrapper/files/test.awk b/meta-selftest/recipes-test/wrapper/files/test.awk new file mode 100644 index 0000000000..91429197b1 --- /dev/null +++ b/meta-selftest/recipes-test/wrapper/files/test.awk @@ -0,0 +1,2 @@ +#! @AWK_BIN@ -f +BEGIN { print "Don't Panic!" } diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index b4eb3d38ab..b617632d9f 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -184,6 +184,40 @@ END chmod +x $cmd } +create_cmdline_shebang_wrapper () { + # Create a wrapper script where commandline options are needed + # + # These are useful to work around shebang relocation issues, where shebangs are too + # long or have arguments in them, thus preventing them from using the /usr/bin/env + # shebang + # + # Usage: create_cmdline_wrapper FILENAME + + cmd=$1 + shift + + echo "Generating wrapper script for $cmd" + + # Strip #! and get remaining interpreter + arg + argument="$(basename "$(head -n1 $cmd | sed -e 's|#![ ]*||g' )")" + # strip the shebang from the real script as we do not want it to be usable anyway + tail -n +2 $cmd > $cmd.real + cmdname=$(basename $cmd) + dirname=$(dirname $cmd) + cmdoptions=$@ + if [ "${base_prefix}" != "" ]; then + relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"` + cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"` + fi + cat <$cmd +#!/usr/bin/env bash +realpath=\`readlink -fn \$0\` +realdir=\`dirname \$realpath\` +exec -a \$realdir/$cmdname $argument \$realdir/$cmdname.real $cmdoptions "\$@" +END + chmod +x $cmd +} + create_wrapper () { # Create a wrapper script where extra environment variables are needed # diff --git a/meta/lib/oeqa/selftest/cases/wrapper.py b/meta/lib/oeqa/selftest/cases/wrapper.py new file mode 100644 index 0000000000..6de63310c0 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/wrapper.py @@ -0,0 +1,11 @@ +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake + +class WrapperTests(OESelftestTestCase): + def test_shebang_wrapper(self): + """ + Summary: Build a recipe which will fail if the cmdline_shebang_wrapper function is defective. + Expected: Exit status to be 0. + Author: Paulo Neves + """ + res = bitbake("cmdline-shebang-wrapper-test -c install", ignore_status=False) From patchwork Tue Jun 14 13:16:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9197 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 504C3C433EF for ; Tue, 14 Jun 2022 13:17:15 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web10.5982.1655212625115459385 for ; Tue, 14 Jun 2022 06:17:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OljoBu7j; spf=pass (domain: gmail.com, ip: 209.85.128.48, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f48.google.com with SMTP id m125-20020a1ca383000000b0039c63fe5f64so4799831wme.0 for ; Tue, 14 Jun 2022 06:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gd+TT2+h7sHZ8k4eCB3EylAjwP5hm50V6/bgYDIOHXA=; b=OljoBu7jKbD3ngEm6mug8aTqO7JBq/oW55xrKp90H0Zl03+RtsooxHCyh8Lv8Y0kP+ Y9yjvHRQW2JreffxOegfOXbzHe/ixZzfDFoesztgbqKrTV4gHruZmUg06QU/0JHsvivu 5TSMCP4ijnCuj9TEx5Ywfli3KZsV7GRfQZffPoPp4/Yj4ogwdqBQNy7mMlPb4I8UbLuB B/0MJ1kf7BV4wv8ievgW11uzl104vR9S6GEVhhnKLlzABwT+B7hTQxseFOHg77LpYYJO cP1ovhdtV7v5ZFv94Fen31oTkpIIR7LW8RDPZbMj4esLrowkZwJ0iNc4Gxh7cRUXYw+n TIAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gd+TT2+h7sHZ8k4eCB3EylAjwP5hm50V6/bgYDIOHXA=; b=szjsEw7efUXVGNt4zbGQ1yf7l52OAphmUVBzDzfKBOqegIa/1aaQM9ToOl73DBz07c 5dm1ORiGIUgdYyvMAnEYMgnxm2GjIeNo1cl1RDa0wsuUQprT2kZtVjabmNXWud1CD9v5 ELDkeY9DBjCzx9nDy48Ny+bQD18Ma2WK/Iu6LMG1ErDUG5J2nSzm3NYIzV9XWo/cBF/A q5K9cexdJW427LiG3gCIzFDvtQD5zGDV/UiERl3iS4Q46WmjdQm1/8Eqt1AsVLg2eT50 2NlUoiaXMvmqpNOkT2pJWPDdbVR6ChXc7QnhQJqlleeskv7olnR6gN+K0AZwOwKssthn V+bg== X-Gm-Message-State: AOAM5309iEabmjQhoLeQAdN5R/I4f5PnR7MhP3+G0wN5xwi2bF+hM7Rj wGFlc4N7S25xJo+UK0N1KFvQNSpp5Q== X-Google-Smtp-Source: ABdhPJw2YjeArArXRWLULt0bvNLF99NuOfNMegdtrmkqFeYQMgcsvSMoBPscE/cn6Kyk5Wd3Nn/Zcg== X-Received: by 2002:a05:600c:1da4:b0:39c:8ca8:5f1d with SMTP id p36-20020a05600c1da400b0039c8ca85f1dmr4078945wms.138.1655212623744; Tue, 14 Jun 2022 06:17:03 -0700 (PDT) Received: from localhost.localdomain (031011128028.dynamic-3-poz-k-0-2-0.vectranet.pl. [31.11.128.28]) by smtp.gmail.com with ESMTPSA id ay15-20020a5d6f0f000000b002183cf9cd69sm12161092wrb.15.2022.06.14.06.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 06:17:03 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v4 7/7] libcheck: Fix too long shebang for native case. Date: Tue, 14 Jun 2022 15:16:52 +0200 Message-Id: <20220614131652.566471-7-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614131652.566471-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614131652.566471-1-ptsneves@gmail.com> 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 ; Tue, 14 Jun 2022 13:17:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166888 It requires a shebang wrapper due to the fact that awk interpreter has an argument. --- meta/recipes-support/libcheck/libcheck_0.15.2.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/recipes-support/libcheck/libcheck_0.15.2.bb b/meta/recipes-support/libcheck/libcheck_0.15.2.bb index 188d689cc3..1393aa2a1c 100644 --- a/meta/recipes-support/libcheck/libcheck_0.15.2.bb +++ b/meta/recipes-support/libcheck/libcheck_0.15.2.bb @@ -23,6 +23,9 @@ CACHED_CONFIGUREVARS += "ac_cv_path_AWK_PATH=${bindir}/gawk" RREPLACES:${PN} = "check (<= 0.9.5)" +do_install:append:class-native() { + create_cmdline_shebang_wrapper ${D}${bindir}/checkmk +} BBCLASSEXTEND = "native nativesdk" PACKAGES =+ "checkmk"