From patchwork Fri Jun 10 21:43:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9106 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 05668C43334 for ; Fri, 10 Jun 2022 21:43:32 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.groups.io with SMTP id smtpd.web12.32443.1654897401572229257 for ; Fri, 10 Jun 2022 14:43:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CnMeK7gh; spf=pass (domain: gmail.com, ip: 209.85.128.47, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f47.google.com with SMTP id i131-20020a1c3b89000000b0039c6fd897b4so1246271wma.4 for ; Fri, 10 Jun 2022 14:43:21 -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=wGNBOW5+jNZ1lqxejh6Uz+taEFv3+c9yvvjLz0cp9Jw=; b=CnMeK7ghPEtN9jfdZ1LT/wrmbwjTuf59EQCaCblREIJ10UURDTIgRzxVIjokJ3+s0f 7BcUgRMyhWF7qqxpTaa5gkQHTHztViWcrFYMG/z/nJAryqOE+KXf7YkbyuxiQZPaayWU RqgX2XZdvsWQtLyUV7ydPc7sDSK+nEmLxnBIOyB3OyUGYAl/KtNyBeHSnY/xCbwGVI0E 2FjhdQOlYvy2QCC5A+ytyDLngZ+pplL3Fwmtxvp5nWRApX7/hHgu7tWuscdh/X89rjvJ OR6s0ypwWnKKfZISKsGpcdsTLjCCKstOGK2dP7cvor0EWs8L2Aqp7Y5/EHqnkFkRKugo Y8dA== 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=wGNBOW5+jNZ1lqxejh6Uz+taEFv3+c9yvvjLz0cp9Jw=; b=bp+QYxToH/QJ3k6kJ/93WKjLCfTthKHCVTKTO7wMpCXNQmjJpbAznkOy0NUtSTbJJl IJo9HKFelPyxAvOite9/w6DnUfpIqXvbPcsX0RWLAQx2CGLxhspMlzX2oCuNqvsyUut8 1m8Z8GFQMrCC7NtI82n1u9LXM+y4sFTLBhLEOUxetz/x9XLE4PiKeQx4HqZ1w2VnDG9F m3wgBcZScAFRrl3qOgPi2iaC0A5z3AiM0ei/S0x0wuqTbYuROCSVp/vdUEJs/+tVwpLT 3uycD5GhfcBiOFr2HLtHntfsadz1HGVSJorovbKeClG4rZDasVWEYNt39Gfgv/BI9CmX lVxw== X-Gm-Message-State: AOAM531NW2TFWvRKtA8I/8ztvfCdWThudNrZa43Z0yBDTYbz1Ime/Nfd mV9+Gg480vj684l3v7WcSMvdrPmbOA== X-Google-Smtp-Source: ABdhPJxhIVnyutwDIEmGNHVdowdvQsrktxF8Sv4/e9sEQ6YYlrPeo16IyeOVvq3jNlaLgVImYVA9aQ== X-Received: by 2002:a05:600c:3b05:b0:397:54ce:896 with SMTP id m5-20020a05600c3b0500b0039754ce0896mr1652812wms.3.1654897399909; Fri, 10 Jun 2022 14:43:19 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:19 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 1/7] python: Avoid shebang overflow on python-config.py Date: Fri, 10 Jun 2022 23:43:08 +0200 Message-Id: <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166813 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 | 29 +++++++++++++++++++ .../recipes-devtools/python/python3_3.10.4.bb | 1 + 2 files changed, 30 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..9f23278a30 --- /dev/null +++ b/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch @@ -0,0 +1,29 @@ +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. + +Upstream-Status: Inappropriate [distribution] +--- + 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 Fri Jun 10 21:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9112 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 1E77DCCA480 for ; Fri, 10 Jun 2022 21:43:32 +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.32764.1654897402464040001 for ; Fri, 10 Jun 2022 14:43:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WEcs3fKT; spf=pass (domain: gmail.com, ip: 209.85.128.48, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f48.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso1728089wms.3 for ; Fri, 10 Jun 2022 14:43:22 -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=WEcs3fKTkz48MuTg68wRxkJgfUWq8o09oeVtTCtmYmAaZ8gxmh7FMEiHYi2HKB4YPz pX+HtaGxrXIsfGhhhsSUB8dq0T3MgTRn7fI+Stu/cALnK6qj40r1NsCKk/VLjWFMuHuD odYTB5CWYAetXSCFbOMrScc9uUG9lrFYryc0RShzv6tHqh3iTfEHgV7HCeR/r1bJLaXX IwTDD/yLKYE+pz6WUSuk1YtTltoXnuUdOLaE7l4V1CE+0nmTwyZF2/Nm6KbsmWphmMS0 fMiKl5wRW5ggb929yWOxRlOOdlnCF37SutGj9R3zmchY9xzhrJNl3qS0DYRm94AHUaDi mfwQ== 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=a2IzD6Mmo7uUH+Lmvk2Ig+sxvzK6NDcINkYEU5mMcUsEKl6RSh4us8g0/EOLBpwWZl 8p7HdCHEKsK/1wU5kqHo48TO4P1bBP0dFfHY6U0I52auRhqXS7JJslSXjXft7j26gT8S +Bl+nnrgu8IsSgtzq46su824Dw8gCbPztz0wBZRf1A2/xCyUpRxnF//LqA1LThEMc1Ui 3WHETLjJL9srXRQ5+TlpmR2CDWuugrSZyO6gMDH4dN8nQnsJ2RJ35tVpJ1pkKdsC6C35 49ipZtbKLCW4fWW3U/BI4FYJddNZthK1WCIowHEwuAn06TaFIKxtJ/sTqMP7pC4fkqKr 5dtA== X-Gm-Message-State: AOAM532DhaXkwB5z+zcpsezGWv3hC0X5H+AbYk6iSOfFJZ2uPxdFdlfQ KVV29leOTHzy9KJ1P4DLcZO+DCamTg== X-Google-Smtp-Source: ABdhPJyHKimjLA+dQPJKTOJvoXM0qn1VWtIC4ln6Gg6HUMEyFiThEgvaCh077xKxEtzuF8X/cDXLhw== X-Received: by 2002:a7b:ce0f:0:b0:39c:8217:1a5d with SMTP id m15-20020a7bce0f000000b0039c82171a5dmr989354wmc.101.1654897401058; Fri, 10 Jun 2022 14:43:21 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:20 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 2/7] gtk-doc: Fix potential shebang overflow on gtkdoc-mkhtml2 Date: Fri, 10 Jun 2022 23:43:09 +0200 Message-Id: <20220610214314.2754247-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166814 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 Fri Jun 10 21:43:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9109 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 14E12CCA47D for ; Fri, 10 Jun 2022 21:43:32 +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.web11.32716.1654897403672915518 for ; Fri, 10 Jun 2022 14:43:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mxlO2jQ1; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id x17so184200wrg.6 for ; Fri, 10 Jun 2022 14:43:23 -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=mxlO2jQ1WTt3ddjaa2Chk5lir5NytcQXcighQt884TzIVqMozHkoxuuR/6w5RQ/Vi/ Z5LHhbOnMlXDdOvIrTVvKB3X+7l+gwyLExU4TyQ7G4zdo1Si+TEANKb9twNBVI3kGwLf n4+pRBaUzvzZn4fUefcGYzQl61BC8sB0a5f1pXTF41SYpVfyCIzBn7G3qs23OQRrUGsu 3XV5TXwiYsXddT1KZQmTWCYHJ7AACfmE641KHAN6P+XPO10LKpYnOHvwf4b70Tsi7Bt/ EKLp5epln4B1OjRk8BKoRSBziAndiU4Yyuem0xngCiHNTg1Xz1EZZu55oeESq74bBmvs GhQQ== 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=2fI7KNoO9COHWOFijixIdUoiJPnHT0QtzDJ6V1mHTfzjl1C1pxxKVp5cMp9abpeakk xa2sKI8oJioMZK/ppuAB3W4dstDPTX7JYGP7v3anGG0YB0HQHZuoP0uuzayAboe5u7rq Ibppbe7/el3M1gUW8m3/VeTf+Os99+9YFSx2Ds6qdDPJFq+pKWOVkpYBxNd21B0z3M89 RyiVYv3aZYjef43i4GOZFIS7cbs3upn8Q5Dw443YcP0kWgPEMiHdTfgLCejMD9ak8oLW s4rPRK4dun3kwmKuI9smrMPsOW2iM+DBSYsdvNjW/DNEBDNnMapQp/kSWMxQvebNVM+7 l1aQ== X-Gm-Message-State: AOAM531+z9r+y4MA9ox4YY/w5JrH3Cn30qYbB1vuiS0GZWFUg80eJsDx SBPO8knFeHuaFwahyOBWkTdbJkSH9w== X-Google-Smtp-Source: ABdhPJwdYAx836K/8rtJETAdjc8R3axaoCebt3oEdrA87ZHU5kVW9ab/Vy1xyu52yr+gZoL9qyWZ/g== X-Received: by 2002:adf:e2cb:0:b0:20c:c1bb:9fcb with SMTP id d11-20020adfe2cb000000b0020cc1bb9fcbmr47367695wrj.35.1654897402038; Fri, 10 Jun 2022 14:43:22 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:21 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 3/7] insane.bbclass: Make do_qa_staging check shebangs Date: Fri, 10 Jun 2022 23:43:10 +0200 Message-Id: <20220610214314.2754247-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166815 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 Fri Jun 10 21:43:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9110 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 154A8CCA481 for ; Fri, 10 Jun 2022 21:43:32 +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.web11.32716.1654897403672915518 for ; Fri, 10 Jun 2022 14:43:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QFZM93IX; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id x17so184200wrg.6 for ; Fri, 10 Jun 2022 14:43:24 -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=QFZM93IXCU5P/+t6yPVu8rTfziWH8FYXhyf0dJDKlFsF3X80lLQ+LNbCZxgNZ+Y/eQ aArKKpOXK86ON/6JkdWm5Vpj1sco7BG6zlUknsaBEgQyUw0CKyRDm9tcR5/4IE2zG91S 6Fd/vS/gVZpZMQfUg+sSNrcfFV1m8GMbns8XOAmuGge3iaDvz3Xe8zfTGnRvF0bvcPpD CRky+fkAy6yVw38ktlLDrB/KXje6W6gBKebaa8OHHXZFPylyd6F7SdHWn4D5PI7nfRf9 PsW6Kj9YF6VWGvGA5ecJhZYXqfs2QVf4boONvqz0LIQVIe2tv53doI0SCDwPD7HM5enr rG7g== 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=8NSHihXmK5bfcsO8lZLC8hpmmumaZajeYY5Enio0p44L1qAuAMJRensYGydHyuDUtU +0ixk4YGdvdeIoxtzIZwyEECOTOQtnbGSrdDOsERJ16+l2njjyoJviFVb6tKkwPQ5O8P xyrb+7zVQ0TUrmpiQi4wY28GUI0B4OG4d5YMdv6yU5NdjlfnUJca0ydBwZWYZ5H8YBDm A5PDpMwaZnpxJnyCDwSWhXe8DAcAqcbczY73dROysWtYLMTdPzPvq/XErH5gJjTSurD6 IFsnING52td44Q8AyFXbL7UTS6zSxZGzB2Dj/tVnttWlqW5f/osfhtaMA45zG9Xv26hJ jzeQ== X-Gm-Message-State: AOAM5300HOC6TqG+VpzBr4C2lKRB5GBD+wlKsqV9U6oj/lfxKBpXxNTj knDKrSQp+hJX27/3DraqNgX+fPLyEQ== X-Google-Smtp-Source: ABdhPJxBguDjhLUUfNde7jEIAxb6ICK4NwoyI684KOOom9Z4Gp1sNyAO8oMIkKnX27KqnQnSxnY9Lw== X-Received: by 2002:a5d:64aa:0:b0:218:4287:3c98 with SMTP id m10-20020a5d64aa000000b0021842873c98mr26908284wrp.453.1654897404121; Fri, 10 Jun 2022 14:43:24 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:22 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 4/7] oeqa/selftest: Add test for shebang overflow Date: Fri, 10 Jun 2022 23:43:11 +0200 Message-Id: <20220610214314.2754247-4-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166816 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 Fri Jun 10 21:43:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9111 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 1389DCCA47F for ; Fri, 10 Jun 2022 21:43:32 +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.web10.32766.1654897406672966664 for ; Fri, 10 Jun 2022 14:43:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TH9Z4y/r; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id o16so196863wra.4 for ; Fri, 10 Jun 2022 14:43:26 -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=TH9Z4y/rJIKYF5uV6hispDItl/mFPO4AUBAAvQd1UEaZmM2du1Kjm/OYJh0aZhb84L lrg1i3i1tAuwc/WRvsEdlSHq2HR/LchNv33QcXVcX+6fZAKZrSAR6XEC/14SfE2mV9ci f/JOw4y711Gj6l01KpO5ejiV1FunwZYwRUNwpFWTZOs7eUMxex4XhSl7v5J+L8Bu5M2Z fETHM0lRPF3SYWyaqnzNJGod1lo2fpy+/DL8HX8jHBp45Ub+G3x7vaXrzQpQS44AFaAF 01eBKcAOgeiMknhDsRMIN2GqJlSETm0F4pIANhqmbvMViYM4rxnJZoKf0nbj8IOkHEeG aYRA== 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=AWJrUYVgqDt+Wf/xUpTjBoZx+8a+UDQsNU8WFBUBd3qQDXvoo6gpu/uU7a+u4UaxNk rY7RVTwkhBq9qx+zKKFx83Z+/IZN/fenC6sgOBxIhFOy/iVBZHXy6wPoeHdPO2fmzb3D gg3L2gMZpiGxWXyA2NyiqGg9JDNV4toodsFp+X70GsC3solN6upR6fOvUz/x3rV2raZA iHRgGCX+vPUAqbDthS68FEU0rPLwnaXkGFxoR/asH7rylttSyc/yNFIU6PyCjzfXDa+k j7NTIvnm3Yd4f+tzycuJ8QmXJ2BzWZpxdmJx8/pD6E7hmgVRDHd5Vjq1f2jKRDbQWFXQ EtGg== X-Gm-Message-State: AOAM530nOtEuy77pgayd09CcAXtjI48QC9IFxdCwuDVE+6o3+dH+Us+B wjdfOIDGgD2qG8XLNP/dt6ssOBkCUA== X-Google-Smtp-Source: ABdhPJzCDou6Asw1n3pLqsOU72o2C5KWG0JjzASzIZdlz5gn9gGj9FM6e6DLxQh7MmlH8E0jVoRqRQ== X-Received: by 2002:a05:6000:1841:b0:218:be20:a1b7 with SMTP id c1-20020a056000184100b00218be20a1b7mr14745025wri.390.1654897405186; Fri, 10 Jun 2022 14:43:25 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:24 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 5/7] oeqa/selftest: Test staged .la and .pc files Date: Fri, 10 Jun 2022 23:43:12 +0200 Message-Id: <20220610214314.2754247-5-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166817 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 Fri Jun 10 21:43:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9107 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 04772C433EF for ; Fri, 10 Jun 2022 21:43:32 +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.web09.32845.1654897407602742861 for ; Fri, 10 Jun 2022 14:43:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LAn0p21r; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id o16so196903wra.4 for ; Fri, 10 Jun 2022 14:43:27 -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=LAn0p21rNgymfz4O2qKn41u45SDadMKU6g5w9Jk9m9Usu0gsb1rrs3rMDlPAnAOvOZ gyWqszPWzP6ZMexykf/XfbyVqepkJsmBxKkYTL7aS/3xoK2e+WQc65CaKMAM/SaHLACa 5NcvMoU6hfiVwQ8STiZtqU+4f/KCyhi1MOjWP257nndFuXvp5EjBR3yptL8pnW4gEKef 229VL7xsy0MpYShUT9PaNRaZRAyl6CfnvRUisSaAAkE7Uum0J4rnLc7MU9zmX78s/F1w lSSJ3gzy2fuknVIok2FTP/+KkM6nL2hS9+Ttxa115z4dScKC00sqjyR0JlqxDQ/YVvkV kelg== 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=loX4SqaFpqLaBdMwFUoHf1/BPqlUnHNr6CD70X345H6qm4t4c8PWDmBmyS1LrfwcBx 2R0RtnuDbXaixaS+n+CqeG+Cmd3cZ3pIBq/xaRfZg2bG6R/G9GZ5uc1a9VNNxO5LGa0r O28UW8r4DjWFSdREfjOmWEK26+N6LQg+vUtkyCcTLjH9mbe35I1qAI2opdXmKiN++KT+ a3ZVxVjppj8mrT4+g1LixPxbMho9HavN3o3D6CUoDADAsFNjzu1yQyjf3Rm4LcMvvLgd Q9xnBUWYg46ZFKrAvhsjXEgypWBwGbeH+8v6v80Jed6Yg1kkVAq7me/J6VQPR10jl0RD 5sgw== X-Gm-Message-State: AOAM5337AYB7XXVMlw28+Fr9DopylVO2iVsOcTjsNALKgsgFaLkfoL/G +2zlbWDc0Gm9rkH8ybgbvy6hfiU4gg== X-Google-Smtp-Source: ABdhPJzgCvJBxYBMx5S9hTNb9wVnPbrtFt5I45Vg8SUgCdoVWGDEdURZ3rVGYjasJGibi6oDY6CaRQ== X-Received: by 2002:adf:e30f:0:b0:210:346e:d5da with SMTP id b15-20020adfe30f000000b00210346ed5damr44896667wrj.313.1654897406207; Fri, 10 Jun 2022 14:43:26 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:25 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 6/7] utils: Add cmdline_shebang_wrapper util. Date: Fri, 10 Jun 2022 23:43:13 +0200 Message-Id: <20220610214314.2754247-6-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166818 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 Fri Jun 10 21:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9108 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 07024CCA47B for ; Fri, 10 Jun 2022 21:43:32 +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.32767.1654897408442313828 for ; Fri, 10 Jun 2022 14:43:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e6bmHq6Q; spf=pass (domain: gmail.com, ip: 209.85.128.48, mailfrom: ptsneves@gmail.com) Received: by mail-wm1-f48.google.com with SMTP id p6-20020a05600c1d8600b0039c630b8d96so2312078wms.1 for ; Fri, 10 Jun 2022 14:43:28 -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=e6bmHq6QiJjUUEki9XlP51Bzl3ppGAoRPMOESKk+1xUFDC5xrtdyhvIIPGe73nJpav KyAhzMOYQv+QCUygQBjEaw280g7hUl1BQT1js8bwf/7x3Ql5MtGSjQXl5Xvpqh+oWrzj ddCKtsPW0IKExd7kf2TLJeFF2MqFtMnI6lHW8sV8BbN9aE3/Vfrfz8z89u5T95ksBlj+ n+13W5Qg4qp46XHdOCF/OQpkq4QiZc4D8Nk/Zl3KT7AnvvJ90/Kh7AiFPMPnPM2cvQVX E5Zi80fl68VZ53iQ0cFe5sLG5vpdCr8BGhXM8rYsRswkaoup3+K4QBlxZc43WvNeO4J/ hoHg== 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=0pfeSIb/euJLdMsXPEBPeUG9aIyb6P8Z+Ch1LDWD6njAjpLV3TpZYe1GwiWm3gZyt5 KEmyJe2p5Z4q6/CGcJPQtkGtJAOv37weusi5LCmU3vxtvav6I8UfOk5uPk2xcANPkuQS kGxH6UvqSrqyacfAk2ykKN8sbsef1bOuz/UzKIRnVoJexniqKfumAbWprLV7CEKxtj7z 6phfEdRSO8hy7WmLug1f6X4GHbkTKJ3q59x0BsJf3z8smBIKH5aUBUWEneHBK87e3pUZ G30NRNakgl4wF3XbHDuGz7bJWjEDP1FfsoHNW/XvjAcxIOzE8c7rJJgrkhZVL29efG0O Blyg== X-Gm-Message-State: AOAM5301HIzmLsXoBbzGENkrzCaRyzekEdKMT5kzTJoTD+t6Fsq3tRmk ONtGpNm0cobk5Ekvw5Qgt1ix9I/aGg== X-Google-Smtp-Source: ABdhPJwJLulMSfMljtP1ZkvRTUKwBdXKM4u4MB7vedrCxK98Yh+RVVLmVCXY5VGST/VnwDaTnYmcbQ== X-Received: by 2002:a05:600c:19cb:b0:397:51db:446f with SMTP id u11-20020a05600c19cb00b0039751db446fmr1664349wmq.182.1654897407053; Fri, 10 Jun 2022 14:43:27 -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 e15-20020adfe7cf000000b0020feb9c44c2sm579309wrn.20.2022.06.10.14.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:43:26 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v3 7/7] libcheck: Fix too long shebang for native case. Date: Fri, 10 Jun 2022 23:43:14 +0200 Message-Id: <20220610214314.2754247-7-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610214314.2754247-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220610214314.2754247-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 ; Fri, 10 Jun 2022 21:43:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166819 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"