From patchwork Tue Jun 14 15:10:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9204 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 11D71CCA47C for ; Tue, 14 Jun 2022 15:11:16 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web11.7329.1655219472692178744 for ; Tue, 14 Jun 2022 08:11:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=h5Fb5peV; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id h19so8481821wrc.12 for ; Tue, 14 Jun 2022 08:11:12 -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=h5Fb5peVcvEKS7bhHIxJaO1pNefHL/vL7UE7aEgPjuc7V/mwLjGgoJ9qpl+0Yoez7C HfqZni9JxpPScsUjaTGLWqmFzvkgEABWvGyUgEwwmE145q6GM1bl2ZoOskuAfn7WL9zQ pkFN8zhM3uinIDoaBJ6ZRTcPaFAkCiVDKO873m6gSJJr9mqsFM2iuKTlNeo7IabjrLNk +LxNMCH1Zms45PHFgxljeLcQTtah97ziKqtehAh1WNz5IqroE3M28+5LeZPEHqrsfCQ7 qpn1sCfRg3sXYXr3G1pQ26IS3G8p3Zs8P8Qro2gbrqwoQGF3EUjE23wbqqwraBm4gKTQ pj+w== 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=L7qIztJYFtBBkIiHfw111hU3V90AhfL27KNvAjJxvxcHmFA5pFAd4OhCCZFmJ08u6k T2onhHRuUts96Af7JNOPddX7JfNsnCj4iU3XybO1iD3ZEo/kRB1riBsSK7rQEURnhe03 cWCotnV1m9MHOtirCKOUMsjxuU8FMcktt5jC2z4mUPHIv06tVSkbKBdj8VgVKPf0RbTK YEny6xsFwP/GhRDbgf17Sk5ybuHetwVpbG5Uf3wI8+pzF/qPKdckSYk889AxkTPzrLzb i67zcXo+w8CtSoSo71M840X2F+BRyPdB2axOidB/bS5LPZHN3ARhhIxOKaYr1BQO4Nza EKeg== X-Gm-Message-State: AJIora8ZpWxBhFXl3ji8FJw6empE2ttm1AIO+MwjVY+dZYwCNvpHqAUm AE/P2+YFM6MwtABhS2mSzjTx8yMroA== X-Google-Smtp-Source: AGRyM1veqP7BHavd9WSyRnWYakLWoGq4QnniF29St5HtiMdprNONRCp0UxhoNb4nQphbmIUdRzYxJw== X-Received: by 2002:a5d:484d:0:b0:215:e7bf:3e71 with SMTP id n13-20020a5d484d000000b00215e7bf3e71mr5529349wrs.435.1655219470940; Tue, 14 Jun 2022 08:11:10 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:10 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 1/7] python: Avoid shebang overflow on python-config.py Date: Tue, 14 Jun 2022 17:10:59 +0200 Message-Id: <20220614151105.1890454-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 15:11:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166895 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 15:11:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9203 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 EEBB4C433EF for ; Tue, 14 Jun 2022 15:11:15 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web11.7330.1655219473327778773 for ; Tue, 14 Jun 2022 08:11:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oZlGPkjA; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso6395944wms.3 for ; Tue, 14 Jun 2022 08:11:13 -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=oZlGPkjAHCVY6utEH6BFRteDdorSEBHLPf/eKKlDl7srcQMvD5RmBpvQvmoPDyGeMG wNOkKyTt2SemJ98CmxLDsIapbAc8g/nuHIG57en8GLLfD56iXDOg19hJ/obe0UdR6Hyd 33Ge6Mfp+S+IqTdYrHHHbUbFWknftKacCgxtZLAFJ00zPiDYDiOoq50+kKYchWuR52Zg lrF4d/b9Fn8PcInJPVemt2wG09j9tGHxPFEPGrxXYQCKXotI7j6LZj6t2qUsjPFJFYAz unGn37cdu06/uAkSh0gqNPgXkWBFobf21ac9AfBSeZ8HpNxMPygNdilJT6bR3F0bbJh5 e2mA== 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=YNWG3FZE42aXTx7IPro/qoy1dMuGeD9rv1MsYnjy6RKT3C9st3vXWIW8nqNwvFfHlT F2Khe4TK8bG0ooQuaXdV1kEdgQGr5elYlEG9iKokZqY32ua1LWzEyMlw1g+AQ+S3V356 WdXU4dx6UjGTHnC/btiDaLt9VaKim5E34hjPVIuPhq1UkwTwXG1tfax1qP3QaIrqj+JV 3+YlWPQMX4dZ0ZgxSVfWaFX464plHMznyyUTOJtDFEYxNgt/dpmr8El3oHj/LTFa8hrb PaClRxX7LagXAba8+Aiu+cNGne1jL5VjrO006AwzC9VFZbkuPqj9QoNoSqGfEPOBcPDq HtWQ== X-Gm-Message-State: AOAM533GfbNILVzv9qg92Nn7P69+ghJnwraEToqMklg6GmwR1H9JzWOy l7ZgddjeNUDwICQE1kXFZqnJqXfLpw== X-Google-Smtp-Source: ABdhPJy1pzW7b6ccEtVQtyf1gbKgt3gtsdhOsT2hYWHDI+tSqoH0kuy6GFn91lIPI3X5lIzi+PxMeA== X-Received: by 2002:a7b:ce98:0:b0:39c:4dc7:6707 with SMTP id q24-20020a7bce98000000b0039c4dc76707mr4688189wmj.51.1655219471925; Tue, 14 Jun 2022 08:11:11 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:11 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 2/7] gtk-doc: Fix potential shebang overflow on gtkdoc-mkhtml2 Date: Tue, 14 Jun 2022 17:11:00 +0200 Message-Id: <20220614151105.1890454-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166896 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 15:11:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9202 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 F053DC43334 for ; Tue, 14 Jun 2022 15:11:15 +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.web08.7466.1655219474136673477 for ; Tue, 14 Jun 2022 08:11:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UD662GjF; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id h19so8481929wrc.12 for ; Tue, 14 Jun 2022 08:11:13 -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=UD662GjFc5WihSgmvmBa8eh8rP0belY0ZlOItPUxGquTUh7L1rsRN2io2wFd08mojo +Io9uZG9G9BCnEO0lEncBqzMd3psE0/BmWvsbfdLnhWGXa/mxYXDxz6kiB0vqi1eqxVr 0DjY5B4LMkuRhkn1TrH5G/KTbZPimtZLY5kXz3izTcSqSeq3BYNqc8GmFyB4sBpx7aj3 vzS1QJ7HO5PmDiI8cyB5tvGi5ZodMeknPuHSzZWcpbrhMHgZw1xGX0SJONhnjr8dQPOD P2s9Wwxn9DhqgT4Vh+Ic82uKwmT0576r0xoLGWNaYFI25l4nDsOl3sxsl4V0qqyWnI2m 72Gg== 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=wlHR3CCaoaqb/mORGykMfh9GGvnU5zZ85M02W6Xyju3gKkMPCerOgpwMKGqci74kDy NUI7X9QAImHMyg0nPku4wqPWUiWN2Dgg3bJhGB5drI8LV2fzWp5+WEHmOtrfcmZiOhX/ 9JVHhftF48i5m5Jn20RSGdxKHDQ9PStH9iYB0ux9gO6wJsAyoyX9rQFQxZB3eA3wn8oz /2AraFtFnE6chC/F+7XdF0IiMgoneaGa5+UC7eIHF1qRBufCX80AseNGPTV8npdIuBVj 1iYserzJvDERKZcqtVxhh50Z+Dmu9SWqwxAaGJ+hoWUD7p68ai31iJ8yTmmkpz3Is2qr y9iQ== X-Gm-Message-State: AJIora/4NN/QenYgzAt/vybQljGFZWxgo/VuQeGzVE+INc/bhP2cKy95 nlpdjLj0JgNyVe6mVZyB3q/lxXcupg== X-Google-Smtp-Source: AGRyM1vGHBBrTMhbV/YkuHdK8ikZePLXKCR6hYqXUrzgOpz+H9dKBXFfHSdzSzdMeOa0Qew6ETSC+g== X-Received: by 2002:a05:6000:144a:b0:218:5f66:294e with SMTP id v10-20020a056000144a00b002185f66294emr5455629wrx.446.1655219472749; Tue, 14 Jun 2022 08:11:12 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:12 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 3/7] insane.bbclass: Make do_qa_staging check shebangs Date: Tue, 14 Jun 2022 17:11:01 +0200 Message-Id: <20220614151105.1890454-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166897 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 15:11:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9206 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 D81D7C43334 for ; Tue, 14 Jun 2022 15:11:25 +0000 (UTC) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.groups.io with SMTP id smtpd.web09.7359.1655219476200199454 for ; Tue, 14 Jun 2022 08:11:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bXl5Jv33; spf=pass (domain: gmail.com, ip: 209.85.221.42, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f42.google.com with SMTP id v14so11717744wra.5 for ; Tue, 14 Jun 2022 08:11:15 -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=bXl5Jv338+CcHVSlfF4G5/BsE68GlLoz29bUM18bFpENsjMjLmZG5BacIwahdRA85s GULyyPJxgY0xQSTu5bjCHJhFdFWX23iqsLjkIzCvFIYrHpDGW2iwk8tH5uHWJDjrGe+3 lRxCm3x7JqbHEThu7ZduDoCQtapRC73EbiAXgUWp0tgRqep3tKCWjV2NxNOHmucJic1S J9Vvhod8WzocnllYamo29ZUHX6OLGn83ywNOtjej7HU0UkKW+hJJ2klpmHkdQ0shZaMc 4m8BPV0MB/Dzs9R48Obv3sN/BYnSYEnupNdcPbDB5cj4bOWo+jfQNmCgCxNrxKS7m6Eo vHGQ== 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=jelCSHLA4jiw4ERP2n1OQORQuaKq4E6CL6agB7hl7pGd0q1un7ye4K5ft66A+G6q13 k5vZwkJwTcI9FACb67mMWBrdUtP68hZh27pmZHpBxqA2Cvo8CdrtMz93b8JNPtMmJhGI PKyuTC4tZUin7C6Hkl6nW6BMHXV6AJzXn6Ng5FTaqmt9JRhxTcz30B2ZTAWBe/V90N3u KeYUqNaxoKzucRRqtbR7pQRxqNzouKKFQ8Z9BDuO8QtQmKgBB5u0kHLcOaWNwfkBz+ak yr0vSYyG7g1jL6TnJgIJ+s6CO7dlE0aBbNMGXKi9/GgiuG6iy1gwr4b6rJCxnzRTYHd1 GyYA== X-Gm-Message-State: AJIora8x/Jo/IiGpS3BY2kJF+iKzSFG2dUdaX+pPvrYhms+iBqLGehe8 P7ctTvnUiYaj/gjZjQID28A0yxjfJg== X-Google-Smtp-Source: AGRyM1tGVicbwVwDixgPV2s2y3gaMZRhOIR8thtm4hGfyOhY5V28vr8u/LFrQVoMtXm4Ag9PPsyCFQ== X-Received: by 2002:a05:6000:1448:b0:219:ebf7:79ff with SMTP id v8-20020a056000144800b00219ebf779ffmr5585359wrx.70.1655219474633; Tue, 14 Jun 2022 08:11:14 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:14 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 4/7] oeqa/selftest: Add test for shebang overflow Date: Tue, 14 Jun 2022 17:11:02 +0200 Message-Id: <20220614151105.1890454-4-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166898 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 15:11:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9207 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 E2C9DCCA47A for ; Tue, 14 Jun 2022 15:11:25 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.groups.io with SMTP id smtpd.web08.7467.1655219476933957674 for ; Tue, 14 Jun 2022 08:11:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YU0TvCuC; spf=pass (domain: gmail.com, ip: 209.85.221.51, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f51.google.com with SMTP id u8so11678384wrm.13 for ; Tue, 14 Jun 2022 08:11:16 -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=YU0TvCuCTP7HQoiFSqHhuY+sLO4D2bJgoW71nJDwb1tcXT57v7nGMcwRLH7p2f7oLZ Ln3ArZPaFBoK5xfsJYsYJpC222UFFG9z5mDgP4FlfhwN4hlleaXFZ9xf0gQFnE51i9bY Kv6/dlN3jTE0WS1nqjvQXM4Qlm7oMF1kvL9amLXsjIFPBDW7Jj7dKewSD3Bd2HQsMY8P it4okAIO0piiDBdCC36FETFq2u5oq/SAlPt+9c9idqqnILyYUpW5AaC3zAKGI/l9sPLP r5wtOGyG7IOy041ihGMpnNyTC+XQklN2JYGjMNv9iSeQsDGQnJnQ/MTeuJRXTVym+YO8 3PhA== 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=ZoVFdpzeClQm7zOyYDsixNfiw/fXxS2WJGSDavPOuBIrb04gbv665GEDAgT1TKY6mf 2njDDFWD3CPzInYCoIpXtgnZsQHntOo4Ty0DdaMkbStjga33dCt1RaLsGNHfBpOCS0MA iHejMwJHmGJ2+HkHoWfCq+wx744abnSjlxutZ+gXjAmoUfnX5A21ztut/cONty0+gdAU fZDNhPZjyuz0O+h/RjCum1szNCG2C3/S7U4OdmUVk1vrLpsiEiKwRj5HsjbtngbY2af3 9lNunPjPz9CWOeZ6ykCqCawgLCxZn8AY5hFmnn/+btdWVovtVpBjeDD0NqSsLbNUjAON EJBw== X-Gm-Message-State: AJIora8fSzh7+0uz3VqZuDpnmf1ofVD1HVl2/tEQH54d1AIKo3dCHpV+ XYAK3OhhHy3/ksKlu4RlaPlBgYcVDw== X-Google-Smtp-Source: AGRyM1txbWMa6TNmt1P6j86mELwvRo3F8mBcrNjIpYI+6D2EYugWfCfv8wkpPj9EJUOmUPz2+8kFEw== X-Received: by 2002:adf:e181:0:b0:213:bbe1:ba66 with SMTP id az1-20020adfe181000000b00213bbe1ba66mr5006889wrb.325.1655219475536; Tue, 14 Jun 2022 08:11:15 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:15 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 5/7] oeqa/selftest: Test staged .la and .pc files Date: Tue, 14 Jun 2022 17:11:03 +0200 Message-Id: <20220614151105.1890454-5-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166899 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 15:11:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9208 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 D7555C433EF for ; Tue, 14 Jun 2022 15:11:25 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web09.7360.1655219478122313165 for ; Tue, 14 Jun 2022 08:11:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H9puScvS; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id m24so11677474wrb.10 for ; Tue, 14 Jun 2022 08:11:17 -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=jz5NAw+FoFqtqB0JVZHivCln3Thx4vdv26ZsFa2A8oE=; b=H9puScvSU02EyxR37EKUFTAp0TlZb6aKsByX989OKbUnwusl06VrPws3Xbqj6BnCWA RHF2JVh8A3vWTDuzVNxyVazlTKwuDeP3nsbtSTuaU2gal43jreAZ4QFB20tj778HkySD cNfouDpcq0cP7cr5EEXFSKRYuS+mppI1DF2HQF01HBa8sTMwMX7DAhJnEzl/PPByx9Ma iEiuYWTZpAfwkpAYJWiFddUGV8h6MuJhrxLjy4wyLSyelToJVV42F0dBShiIpjoue4QN qy2sD29hVpNl13dlzrrzVgHYw4qSyx2QAs5jTZW1x/6fEuj6w9xwZA++/lERVnnw+FfZ zTww== 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=jz5NAw+FoFqtqB0JVZHivCln3Thx4vdv26ZsFa2A8oE=; b=uaq4sR14lWryDbjc9MWBDMC/JfqI0ZPgqRgSPiXkD60jSad/gN88DdMBuiWuwPPozp RToKlmJbjSwxtz6An3u+0liESfwwntHL28U5KOVRkKJ8/nQXrz8MjLHPbm55CPxnKrep 9Ol2SzY+sGnd/XdrqeJG6NE+PsCWd3910j/vT+vd1ANGmk6djvkRINZvbDtWKaP2Wm4V ScYvncbT6aHXEvSUsMSC/Mt7fPluMOMqtgAkILXvrYEd+x9+kehba5HKHxBy0BzPCR9q 6bVPc1ALzteaRZQZXOd3HxE6M+p8z4x1Y66uTWLle866iXz6VKk5kcyxO0VwsPcARwGv XV1g== X-Gm-Message-State: AJIora/wTqjI/0ROmkV5pno1ULr38r5LB3c+b9B4d4SjmadAD5nLER/c b+0PSKTaxZha98Dc0ez2Yp/6uwMPpw== X-Google-Smtp-Source: AGRyM1u2QK2Q2ySX827Cdf5eW7rakxyCL2fo79XHdjo3xmnK7UEOGJbkc1N58yhIItDjQFeIwa9/IA== X-Received: by 2002:adf:dd0a:0:b0:213:ba65:73fa with SMTP id a10-20020adfdd0a000000b00213ba6573famr5450971wrm.521.1655219476559; Tue, 14 Jun 2022 08:11:16 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:16 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 6/7] utils: Add cmdline_shebang_wrapper util. Date: Tue, 14 Jun 2022 17:11:04 +0200 Message-Id: <20220614151105.1890454-6-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166900 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..c4126a41fc --- /dev/null +++ b/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb @@ -0,0 +1,21 @@ +SUMMARY = "Check that create_cmdline_shebang works" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +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 15:11:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9205 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 D9386CCA47C for ; Tue, 14 Jun 2022 15:11:25 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web10.7380.1655219478821221014 for ; Tue, 14 Jun 2022 08:11:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jgB2LxuH; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id a15so11720416wrh.2 for ; Tue, 14 Jun 2022 08:11:18 -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=jgB2LxuHw1OcsSSnmKr91sONWBjnL0kbXLIacOy4vbHarA6ry4XgGeqo67ekVkUbou t4t7NHyP97sdFiil6aWMS/ISOJEs1d2llTA1RLUxYw+KRKI8pFMup/39EaEcy/rOhafo ug8cJAaiUvcTwGc2xBQRzHjRky5KQxKhKc5syu5ij0asop39HdbHEcb8rh4Z0RQaOTyZ fnUNPZHsDHK7JfjQGnY/5X7TsJNF7Cjk03lADBPwFn9pQvbuTiAmydWxnTFJ0s4L4dja 8K2qbwUziar/Ngq/35Pf1qxqZtKgvgfR6/E+otJZt1VFZIy7xExlMVusvRuE+pEcrPNA 3/Pg== 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=YnmRYVvusc3K+8GoKpEp0Ur9nsNBho2+C9qNBhZgI0IZM/DsG3hXwXb8u/e3GQRFJc i041t9rc6xCgoYHslRJ56mbbKMG/ToPE0LO0eEvSY/TTbF+3rQwzVh4ElhWQaMhqFKYY MG41VQaCLsMpku645v1n2HJx9saBv1fNFKtr3rgY62UTGx9Wz3W0BDRVCSBSOfGhGEQV ZPePwmyTibU6QYzebvK92vX0ZT64SAqGpOcTE4OmJPcNoV+m2hfAokcAQppNILgCQyrq xQYsQR3scpZMuRlUdsR3570Wh32twhyGf1dbdsWtWnzNzY/qeObGQj1Z85pxty238JTA BooA== X-Gm-Message-State: AJIora+WAW5Ucn/4k7v7meWAsaSlZGUM+2OVPCzlrI99y7UMvdExZU3S q4zQeKKcYZp659W3GXHVUxRdWIgPdA== X-Google-Smtp-Source: AGRyM1sRZPXgDhIx2mElD9C36wSXv1VCKxYteB69dwsb1ow9qCgcbporBhtNQExWTc+q0eywCBSe1w== X-Received: by 2002:adf:efc3:0:b0:210:3544:4223 with SMTP id i3-20020adfefc3000000b0021035444223mr5321231wrp.581.1655219477471; Tue, 14 Jun 2022 08:11:17 -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 h62-20020a1c2141000000b0039c151298b7sm18114522wmh.10.2022.06.14.08.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:11:17 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v5 7/7] libcheck: Fix too long shebang for native case. Date: Tue, 14 Jun 2022 17:11:05 +0200 Message-Id: <20220614151105.1890454-7-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614151105.1890454-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220614151105.1890454-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 15:11:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166901 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"