From patchwork Sun Jun 19 19:20:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9327 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 E5E1BC433EF for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mx.groups.io with SMTP id smtpd.web10.21875.1655666448028395038 for ; Sun, 19 Jun 2022 12:20:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dZNXnMyV; spf=pass (domain: gmail.com, ip: 209.85.167.51, mailfrom: ptsneves@gmail.com) Received: by mail-lf1-f51.google.com with SMTP id y32so14135932lfa.6 for ; Sun, 19 Jun 2022 12:20:47 -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=dZNXnMyVFhzV2rhmj5Eqhg8AZUMmmESt+xaG4ocO9RtVytvGVEFTB6J6tYjxuVCmzR 9NUVjqW0i5ILB3l8RSZde8/UpQi6XqB43uLM/HI1I38X99xDGRyUqskDJf0zFF0jtQCv 6Iw7wtcsTh3u3ZUul8M/qQ36wVIaGMBI2whpPES6RsCoBC+6Gb1mmbHhJCSSwY+/ivv2 nod1/xcc7rsQ1Y6qTTWWcdAKLjNNKjtzp3k98kUd0fSCUgadWa4PhSH2w/t3WgDt2bF8 rz2c3VT0GTrFAwp6n1Nmaj6Xk2oL6tgtoyuT7/VWj3f3sQx7I3sDCtE6pL+jqU0Wpss/ cptg== 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=SUlGzhZWyYki5t69/z8aLXhcvxxMgShr1+5iZDe9h5L4kwW6Kn+ZaD9l9ZqbRaqyQ5 Fmuht7xzizQaMMmRAatD7Nn66mNfoZU/L+YbOKA1P5/0fkK/piVlUOZ3CmCMYi90PcZI iXLmP3Lg9WYxUbnTcPJ2RLzepePVNBjMSOiRhdgXxl2M25PkqzICGpvp48nSi7ZzeHpQ JNWWKRggsH+wHpbCz0qFSoRMc5lutfPqQkMvbF5v8HN707inbvReIJI8YxC/PsEbP/jt 4/qdcog1Za4ELeDo3dSKp3wNFY/okuSAdrF3S90sCNBPzGPoDpvzDucD0IWWGgpBQs+G Lccg== X-Gm-Message-State: AJIora+zajBbmCDSqr0JhE0ntSlYzAd2Ew161D7Ayax2bI9muB5c5kn5 fZIZyzk6PFMi2Hy8gy/gOPvS0YqrNA== X-Google-Smtp-Source: AGRyM1veNlnPn35DwQVTqqHLeeIjCSDh4PCJuJNeMSH9x/Wu0Saxi9cl/FARyAgiPN3XjmuJ9N2HIw== X-Received: by 2002:a05:6512:12d3:b0:47f:5a20:400b with SMTP id p19-20020a05651212d300b0047f5a20400bmr5680110lfg.572.1655666445760; Sun, 19 Jun 2022 12:20:45 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:45 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 1/7] python: Avoid shebang overflow on python-config.py Date: Sun, 19 Jun 2022 21:20:35 +0200 Message-Id: <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167039 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 Sun Jun 19 19:20:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9330 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 F1A0ACCA47C for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by mx.groups.io with SMTP id smtpd.web08.22170.1655666448526232797 for ; Sun, 19 Jun 2022 12:20:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mZ0XzGCW; spf=pass (domain: gmail.com, ip: 209.85.167.41, mailfrom: ptsneves@gmail.com) Received: by mail-lf1-f41.google.com with SMTP id i18so492053lfu.8 for ; Sun, 19 Jun 2022 12:20:48 -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=mZ0XzGCWmbW6Czp7KzxMNoA1jcY/nu/ncogFhQhLee4ZEmIAJSSWT7qrXJsCyh9eXz NcxPTRuYtWyK2+VChW0Pu7DQykTT9q9VpkRZp/EevGvIM4Im2I0mOXM/V/nh2JGK/wGy f2TmnFmOCJlgxMWABbgLzR4E+3OyUwdL11tY5TACHagEjaq2jOzsp+7M5hVVxuHxSmLa CS7WgyLhuOeGEpKayzH4GVI0BzkSR3HBvCce8djCMEHqo3/lM0rZvReOaMH/+Lk2AQtb KdKr1PE1WScjTCR0r5tBS8+zZJ/+9v6k1NAb7f3mPS9G0rEuvrucl+y/9aqNv1rcO2rg W6Sg== 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=7dpRAFJCcaPEfAJ40tEnLWg0XdSOx9YOZK61AkN9mRGF5bFb5mhS4rdIDCtBpkmgm8 HwUK3fFFi3GeM9sSnAMTWrCrC3fA55Lo+ZqZtN4bgGPEhuOPvbBzCAqtqNz4PHFhLbTV LgXrIXfiL0LC2XKjP8CpnB2S6FgQtRb0shBFahkRhmdF6F4rZmtOwEEugwUsJ/MIvRYi rLe9H9yUTinwiSd2hmq4M6GIDovQbnyc9Hvg4G2KlTonfPSSgngI/8+lpDqIHJEP7NgJ RTrZUd8/m56qODAhPilAXs77hfD8VsclD+mzDOFKGRi+Fi+0r7cBQFmjBrbitmtnNnhG JlhA== X-Gm-Message-State: AJIora9pGjTPFEFajqFh2ZvJXIHoK+Z1lSwC1p5sUcnU8qwitSIku2CZ vkI27q7KPFcLSgQGs4cpFAjuU3p/oA== X-Google-Smtp-Source: AGRyM1vmVxTOYc0/FHtYgTkgwRl+/uiU8ktz07TtCvVkCbADb/BFfU3v+j3BFbIrDkO7pAwsFloXtg== X-Received: by 2002:a05:6512:3e03:b0:479:2e0c:3d2c with SMTP id i3-20020a0565123e0300b004792e0c3d2cmr11491641lfv.654.1655666446681; Sun, 19 Jun 2022 12:20:46 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:46 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 2/7] gtk-doc: Fix potential shebang overflow on gtkdoc-mkhtml2 Date: Sun, 19 Jun 2022 21:20:36 +0200 Message-Id: <20220619192041.1113263-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167040 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 Sun Jun 19 19:20:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9331 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 F2533C3F2D4 for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mx.groups.io with SMTP id smtpd.web12.22002.1655666449191216128 for ; Sun, 19 Jun 2022 12:20:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S5dLbKgt; spf=pass (domain: gmail.com, ip: 209.85.167.48, mailfrom: ptsneves@gmail.com) Received: by mail-lf1-f48.google.com with SMTP id i18so492085lfu.8 for ; Sun, 19 Jun 2022 12:20:48 -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=S5dLbKgtP7T9K0P8HXUngaEjn070F4+eL3/Ua+pgttnOHc9iDVZ/0kJCGXBHm9Y8A+ g2pDy0xi+75A21peywdFZdPN7zEUTVQ5HbZplOKl1PL4O1qzJwDpSeUXcn6511Kl/AAj DpLqg7LD98xnIGj2Yf56O+90zgZqqUDn9x0+FDiA5fT9nluSnK6qvm3A689kRHbVKt1W +SgQLnTr6wM8sfrRUTrwMvbuI0ESanKWy07U0EvsJmhby4YfMrOoHRlhPhKm6wy1bjcd CJ1MZiD7UNORN5C9m1ZZe8QFglN9+ARf+5ZUnd7xmD9n9sjR5NXQ8xkLHx6CYC/+OfCs vzsA== 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=eaSJZ/vFOIRqejqvXoKPL/MmJ9tZk7g9xcvUhW5Wt9PaHC4mucPIjTCFAPrQ3j6olI BsGjjx2Ps+MdCTRpT0zYr28hS0Bew5C4ME41q8mvyanxaum+V5nmVdMj79+FTzw+R8Jj 9ASzY9YHPmAWjAW7j0h7jCeh3GNpDJwe+JwcNfB+aJpCgj849yaPWy0VkwRAHnf75KcJ Xat+jnugTY3qBp4Lp0qMvPwAuujQ4omFmBoYoAjRDGUsIWBl+6NimV/2NUp2LeWv4yfr 6JSWQzQnIxuwlAa4lNJ/srT0MMxaBZ2J0FIU0Pi8F4JDNP9jvAwzJPU3jCAI47dHKgy9 LB0Q== X-Gm-Message-State: AJIora/D6Wx8DzhT3fz5Z2Khf/AwtzcVP0j7CHq7KMMpSkTxKhGgPU8O i7V9DcRwmEtj56subRiOS9Yc3xrhmA== X-Google-Smtp-Source: AGRyM1v3v6ocj13KA7MKS7MpW1/FGkI/53gvd/PUqEoK/jJrKRzvooLWc22pWEZchKaKbA5qIRMqsQ== X-Received: by 2002:a05:6512:e9b:b0:479:3911:3359 with SMTP id bi27-20020a0565120e9b00b0047939113359mr11486097lfb.202.1655666447550; Sun, 19 Jun 2022 12:20:47 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:47 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 3/7] insane.bbclass: Make do_qa_staging check shebangs Date: Sun, 19 Jun 2022 21:20:37 +0200 Message-Id: <20220619192041.1113263-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167041 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 Sun Jun 19 19:20:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9329 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 F21BBCCA481 for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.21876.1655666450103501973 for ; Sun, 19 Jun 2022 12:20:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZGDXVKnu; spf=pass (domain: gmail.com, ip: 209.85.208.180, mailfrom: ptsneves@gmail.com) Received: by mail-lj1-f180.google.com with SMTP id c30so9756359ljr.9 for ; Sun, 19 Jun 2022 12:20:49 -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=392+RXmZfikf1YBZaZ0odEAyz2CKeDAcxq+2kA5zL4s=; b=ZGDXVKnuJMlnzdFZ9WEBspEjrXMo/FNxIYheIb9ue3OhWxzK//rPX6q39ap99FOsen cmCK2dDt8v5WoAf0nn9Y/UKpqyrbGjITHS/BYKDo/JepHKg37pk55RFM5VTTSNg7FsX0 7TiH8xpzJ94lJ38kyO82cToP7iNOlrDt6VbdP2f8rzX5JKGpp8WuqQbLcGC72vylmiV9 Qjxg2iJRmz9BgRYPGFrqF+YG4HajBr345Ot5uryov8mdNkizcQQRkgO3VxD6TbQBfVQZ Yky2natBtxebHNP1aUi3cD9bNDtZiiDO0ZFTX4W38vBxNkokLBRGtQbtWbBGuCFSIKAk JGRQ== 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=392+RXmZfikf1YBZaZ0odEAyz2CKeDAcxq+2kA5zL4s=; b=u+5Vx1xNu2n2V2uhsJT6MKt/se4+a3lTNZu+46e2EO2ffdCkcwj6PmdguBqb8fXupc F9gPPW2ShoHRJT7AhKlIGDLyph3BxDDpKzJWF6ZU6O3u11oOC+lXrZOrlR7ZaBqD6CTf eBTlf/7+Qu9CN9UpPvz12PUevSKxcD4gYsnM8QzH020nFpkwxyOKNKEOyqNhswCaM7G8 DCseFUQ1of6CKQcEy//L5/UK4QGt2qAtdHTj0mgkJ51jtTySj1I0oa8rUHJZsZP9GV/J mA8a+Lw8tW1b9uuI1icOd9rSHRRmiOB518mzYOjIitRlo2gt8gyw2OdzPefycIhsUgD0 +aFw== X-Gm-Message-State: AJIora+wfWAF3YODmd8c6COSGmOHlSRSGdFvXNRuJl2wOX4TJcXropzV nhQID0KvEcRUEuPA7oHdxzIc3XhQPg== X-Google-Smtp-Source: AGRyM1sMfndiMNjGc0pKJE7JURJR88k++ATgwOllPaKdsl2VJRtrXMjPJpTmyuvdgCcLgaHeUtP0nA== X-Received: by 2002:a05:651c:1a1f:b0:25a:6389:6135 with SMTP id by31-20020a05651c1a1f00b0025a63896135mr3601437ljb.253.1655666448368; Sun, 19 Jun 2022 12:20:48 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:48 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 4/7] oeqa/selftest: Add test for shebang overflow Date: Sun, 19 Jun 2022 21:20:38 +0200 Message-Id: <20220619192041.1113263-4-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167042 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 | 11 +++++++++++ 2 files changed, 23 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..a17fd1818a 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -35,3 +35,14 @@ 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) + self.assertTrue(res.status != 0) From patchwork Sun Jun 19 19:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9328 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 E6C39C43334 for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by mx.groups.io with SMTP id smtpd.web08.22171.1655666450791947789 for ; Sun, 19 Jun 2022 12:20:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Mugu7U+F; spf=pass (domain: gmail.com, ip: 209.85.208.174, mailfrom: ptsneves@gmail.com) Received: by mail-lj1-f174.google.com with SMTP id s10so9743255ljh.12 for ; Sun, 19 Jun 2022 12:20:50 -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=vlqA5dxz2imy3ZEoQfzVrOYZGick1Bh7QMLhND6Ie7s=; b=Mugu7U+FRbR5fEOkWWXmFl2jDEuZI5kC0ShCVmWRFEwHXhvFo1O8COZ3xswE7cmIEe uq7+nUULLRDatveBRXFItLem88+FGc6/4BP0uE7zZkMZb2FX42xP/LOM5KPCxBT+2rse SUCxDLEhK+8xiGLcOe/EHGgPZNsoMzCdXv094ouVSEW+LzoWRj3gZoj5y6T5HMvrzvnW 2eK9OJrxPZXtt9Jg61rIrdBElXtnWLOOs/g/sOoyfEo29M+YEXEOR6D8gqXhYF6yRZqH QlC22BSTQaLYVvxuPpMLPz9jqPr57L0Zjaqb5T+8E3Lru1xfguo1YbkW1V9+kp7lIjxq z9uA== 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=vlqA5dxz2imy3ZEoQfzVrOYZGick1Bh7QMLhND6Ie7s=; b=tFbwZCODg0oO8nu02a4KAswnrS+lkjjfOU2NA6t3X29xJup3MFXkNv0TMZuYcpBMjD 0G8AIOKWuoPsU4GqY5kh/relU5TUjsZoXZJKqqZCvyVLhK866ZR9cvBZUiZh/wRdHxiy f20Eqihx6rlDgxlEewBbZ+ii/2LFRm61Pklmz9+bigICefBk5QIIDme2hIa6QfDYuveu 57+iQlZssBfV7Re4uD5P3JuP5UdfLGzs1yVpi1EL5Xy+860DlDUIHIGSpBm4/xtiXoon OBAqV5Kb6QITpBkMvPQPsCqZDE2tYCWyTLbvv6D7xHNKm5ONSHz4RVs2i51UfIJlVMQH zF9g== X-Gm-Message-State: AJIora8pr71qawORj0Vvi0IYczn8JP8oeDxziGmqoCDZUedCfdyj9S5M iThpKTYUKzRnKC4zRlccS5ZuYvjTyw== X-Google-Smtp-Source: AGRyM1t81hSTuzG4eSDY4vfA+qCHmiaRvzzXEYq8uagMvXYzfXcl1EwkZaGB3Ie0wvxmA4fd8YGYAA== X-Received: by 2002:a05:651c:1417:b0:258:df6a:731e with SMTP id u23-20020a05651c141700b00258df6a731emr10152338lje.129.1655666449146; Sun, 19 Jun 2022 12:20:49 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:48 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 5/7] oeqa/selftest: Test staged .la and .pc files Date: Sun, 19 Jun 2022 21:20:39 +0200 Message-Id: <20220619192041.1113263-5-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167043 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 | 36 +++++++++++++++++++ 3 files changed, 64 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 a17fd1818a..294ba4a4a0 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -46,3 +46,39 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True) self.assertTrue(expected in res.output, msg=res.output) self.assertTrue(res.status != 0) + + 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) + self.assertTrue(res.status != 0) + + 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) + self.assertTrue(res.status != 0) + + 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) + self.assertTrue(res.status != 0) + + 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) + self.assertTrue(res.status != 0) From patchwork Sun Jun 19 19:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9332 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 E7DA0CCA47A for ; Sun, 19 Jun 2022 19:20:57 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.web12.22003.1655666451768596134 for ; Sun, 19 Jun 2022 12:20:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WB3RKPxV; spf=pass (domain: gmail.com, ip: 209.85.167.42, mailfrom: ptsneves@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id w20so14108939lfa.11 for ; Sun, 19 Jun 2022 12:20:51 -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=cu+ASYQ6/0fvHLurB13BxU9FK1Y8GKvpxkKPQgx/lqA=; b=WB3RKPxVZcaCahWqRu1nwI4B66lA1bRYRz1JKB9OslCIOsNJWvSZQ2/Pns5Q2htmNe XhAQuGbSdYhbW0ve00K68ZnHk0w/kxGDG5KAxVpsKDut+XOGc5M7WGbMHyScJQA5v3JA PGsQZpNWIueF24VSWe1K5TPD0m6PiILPB0pF0KWSZhz1MZ7zopaNm549rOdb5P0BbybS gw0jRz5TfuLYfHO7if24un2v2W2Rx3UVT14Sq9gTzR2EFT1I0YhonhxgSIV1o6Npakkb QczBJ6QlBQtG0F93bEZC2ZXhJb5WPWQQY3lcBzrzRNWO/F/HRbGvts6d0r6wdi21xIcq QSKA== 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=cu+ASYQ6/0fvHLurB13BxU9FK1Y8GKvpxkKPQgx/lqA=; b=bclsjq2B0eDux8GhkxG1/9h0G8JRaKeb0BLt3TezmO/KEjeyLlsbvL8KcIj64SbAaD 8M/6bSKR643CWfWxJy5vDsI3TKPq00D12TtfbBWlS2EfPaNDPIRP/f+DKFkO4/AUB43d XhCaIpK3hXRbjTW9VOR4orKfSd43/jWtN5JhdCRfedcLMSLbQk5J+Vx+Lx6mVnJssI70 2pvYjMGj/+dMcGM1cPzLoomiyzbJO9xN5CmOlgThxQrtjdiEZDcJBkYAPXfOuwjv9bV8 xP7GVU6WN+kkXW/q3kLeTRnSZGSIv19U2e5nJBRlk+YG500uvohHnUrBvMYU4L1K9dO+ Mvfw== X-Gm-Message-State: AJIora/EBxaBEHTtSoRIgOVkYm4iCU3209IhXw96w+Xb4Ks34LTPpmG0 /T9Hz+bpiAHJ9aAvVJ6AW0HXbLNoPg== X-Google-Smtp-Source: AGRyM1uimHXbdwtOWM4+K+GimBg7GzUXCiPdnXenYleNT5ktdM4GHVKU6u3edZLQP2SuhEdia1DrTw== X-Received: by 2002:a05:6512:3084:b0:47f:6c9e:952e with SMTP id z4-20020a056512308400b0047f6c9e952emr1711104lfd.332.1655666450146; Sun, 19 Jun 2022 12:20:50 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:49 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 6/7] utils: Add cmdline_shebang_wrapper util. Date: Sun, 19 Jun 2022 21:20:40 +0200 Message-Id: <20220619192041.1113263-6-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:20:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167044 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..b58c22771f 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="$(sed -ne 's/^#! *//p;q' $cmd)" + # 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 Sun Jun 19 19:20:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9333 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 D6DAFC43334 for ; Sun, 19 Jun 2022 19:21:07 +0000 (UTC) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mx.groups.io with SMTP id smtpd.web08.22172.1655666452552669523 for ; Sun, 19 Jun 2022 12:20:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dZG2T5Gx; spf=pass (domain: gmail.com, ip: 209.85.208.181, mailfrom: ptsneves@gmail.com) Received: by mail-lj1-f181.google.com with SMTP id w9so729077lji.4 for ; Sun, 19 Jun 2022 12:20:52 -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=dZG2T5Gxp0MfFxJQLjSOqomDTflSIkeJjQEglIy9jMAGW+sBteV2XnlxHJGE5Q3F6/ IuMehW50JpAfAZAGKkY/no4fbCN6Zhh9nP8QwhUCwgHvTJELeAJ6mRZgreUfsDf7GTVQ rnQiCMmhz+ob/314ujDoFlNJpwzZJIZGMXslqxsptTae8ZNiFV4Hy4DSltNNvkYNfK42 /hMiPl5t+h5iHHI6qkr16a3PrQlXxzFIVKVNXLojD1ZZqoJrGRbnC8uId4Ywrv6f6CpB xkJ9KA3G4uTuo128u9gT4rq0X+lpRN6UZbhXDZFjh67OkHVPEgSf1AER1lk09sp0NaTg qBoQ== 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=xFO+0/y6fA0y3QGhI7Ap7dTtY8XZ4Y/zohvnYOPQhmQdSP16sWhT/ZUvLPakMkRiDj 1ubnRFbMbfBEfvQkqup/dVzfA7H+dxfCjdja+Bfp3T314SrGv88eXqyq/SKJTTBCGFA0 TEe/WpRcTZrYvK3w4tPwlbKYK1cF+S//YDbz2v9Mw05kvyuTOV9bXp2nLbv3+NxwxRXl IxZ7bWELTqU6kI4eGmTiyqoyk/BJ7WShWEllDzf2CsqXpww1VzSGiYkFGJEAE7OIMDkQ Tjw2vC9DHoyeU1Hi57Jaj+dcc2CAVReen9lSH2M9cmkngJcBHyJ/eJcNbt5dCS0ahANC 1PoQ== X-Gm-Message-State: AJIora+ieVv1wYf4JDwgFFGGnDEMvLqp0/VRhyWRROk30TWKa3mI5ru5 816M+0ZOCT/glR06RmxYVzwqRH5jtA== X-Google-Smtp-Source: AGRyM1s61CoFhkfZwlsci8zkPakZt3W1uIbschmoWiaEDUm+2wtqWKRQnFcj0PTmJyROM2xqeFXzPQ== X-Received: by 2002:a2e:b209:0:b0:25a:705d:c4ba with SMTP id l9-20020a2eb209000000b0025a705dc4bamr284432ljm.468.1655666450908; Sun, 19 Jun 2022 12:20:50 -0700 (PDT) Received: from pneves-XPS-15-9550.home (83.11.57.73.ipv4.supernova.orange.pl. [83.11.57.73]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025a59470621sm817020ljo.26.2022.06.19.12.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 12:20:50 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v6 7/7] libcheck: Fix too long shebang for native case. Date: Sun, 19 Jun 2022 21:20:41 +0200 Message-Id: <20220619192041.1113263-7-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220619192041.1113263-1-ptsneves@gmail.com> References: <20220606155807.1414519-1-ptsneves@gmail.com> <20220619192041.1113263-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 ; Sun, 19 Jun 2022 19:21:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167045 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"