From patchwork Sun Jul 3 11:41: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: 9770 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 A876CCCA47C for ; Sun, 3 Jul 2022 11:41:23 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web11.59408.1656848479893451363 for ; Sun, 03 Jul 2022 04:41:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jEeK0fV6; spf=pass (domain: gmail.com, ip: 209.85.221.54, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f54.google.com with SMTP id b26so9533575wrc.2 for ; Sun, 03 Jul 2022 04:41:19 -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:mime-version :content-transfer-encoding; bh=cGjGdklO9Lbkk8DxIJtghinkYm/LJU76LJ20ywNVTCo=; b=jEeK0fV66kk/I0BIyu0qdB0Id3WQFR75tmuaI35uyCFDIuGBAeDDYQa+yLopBO0czw 6LPmyyKDjjpyLIHX5AP0Me7/v39CbhF84F207kqRUwwAJveV1S8dL/sCUhfLFrSmUDAc NQzacZiN0subRVHuLdVHBp/vszwVDfX15h2ydbVc46eGYz2b12bWQupp2KB8HjDHU+9s hUWYYITkA4pvAnFijNKePuc8cy6MczKeglEBx5S0WI05MS7cWKBByOiEXV2LpJqhCPbZ N/nUwEHJkA1DmW1DUfUIERSBtPc2brp8AZEgNcdjEuKxaNgeIb+T6s4AEVg/aFF972gk qINg== 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:mime-version :content-transfer-encoding; bh=cGjGdklO9Lbkk8DxIJtghinkYm/LJU76LJ20ywNVTCo=; b=mKLIrMTo9pd7BEWC/GRvfddMjGK4y7H7/EwCkzrgDhEeLVR2xA2mpds/0/XHgHYrzi PN8wmzGfEltffqKYE6gDFJfQBqTGbADgiC/Zip05ZY+c80wWPFDFwPgOLJqzfWK5TuLl f/2Ruf6wTt/AzAT2y7A/E/oFtbPosjoOCiVXSg5RwK5XbjHRMh2FL+/CuMATdWdBkRKg ToA6SSKbqKwdbk92GbXkzX2OD+68Uh1Q/ZZPaDRfYwfZoJCcRDZCofLJajNZxllRQKrU zo7Lqh8gBqM11Qbf6sM8mc0kIIH3jG9F06vBwO//q2TEq2dWs9R9IqVrFJzwjHcANHRL oz1A== X-Gm-Message-State: AJIora9HpeyELWnwV0PijauJ/51oLcs2qoIKUEao6Y2WelnYvk1QkfWM O6nFiLwjHJiJysnKeDU5TpQyl9BVpwNL X-Google-Smtp-Source: AGRyM1sXEZP/v0OFlrKR/7zIuBqr4QwEmyHBnwE2UwdU6EiQWPn45p6b6zkujRcRHnXvQmP0KolZVg== X-Received: by 2002:a5d:4d02:0:b0:21d:31c5:ed18 with SMTP id z2-20020a5d4d02000000b0021d31c5ed18mr20661302wrt.673.1656848478306; Sun, 03 Jul 2022 04:41:18 -0700 (PDT) Received: from localhost.localdomain (83.11.75.211.ipv4.supernova.orange.pl. [83.11.75.211]) by smtp.gmail.com with ESMTPSA id p28-20020a1c545c000000b003a02de5de80sm12413142wmi.4.2022.07.03.04.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 04:41:17 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH 1/3] utils: create_cmdline_shebang_wrapper whitespace and sed refactor Date: Sun, 3 Jul 2022 13:41:12 +0200 Message-Id: <20220703114114.2313369-1-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 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, 03 Jul 2022 11:41:23 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167553 Correct whitespace to match the rest of the code in utils. Refactored sed expression with a simpler equivalent. Signed-off-by: Paulo Neves --- meta/classes/utils.bbclass | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index b617632d9f..b58c22771f 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -188,7 +188,7 @@ 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 + # long or have arguments in them, thus preventing them from using the /usr/bin/env # shebang # # Usage: create_cmdline_wrapper FILENAME @@ -198,10 +198,10 @@ create_cmdline_shebang_wrapper () { 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 + # 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=$@ From patchwork Sun Jul 3 11:41: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: 9768 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 A7996C43334 for ; Sun, 3 Jul 2022 11:41:23 +0000 (UTC) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.groups.io with SMTP id smtpd.web09.60126.1656848480622539610 for ; Sun, 03 Jul 2022 04:41:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cos8NjhZ; spf=pass (domain: gmail.com, ip: 209.85.221.49, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f49.google.com with SMTP id r14so3717883wrg.1 for ; Sun, 03 Jul 2022 04:41:20 -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=Er/D8YCQdFUfKZUHAyv15V7bjk6/00/6C7YBjeKBmz0=; b=cos8NjhZGHaZdUKV0cP00SppAy63Tj7RWMaJIe8hEixErQTqqDOohVeC6jgZ7Nxgxf IfVRTJN4F38YMUz2VWHj32MfGPiB1bVppS5vEf9ahciPOsOJ93r6Bc0OysVrcZTGo1GK qAKLKNOvJmQimM7gr1svs1JvvZ1hYIJd6+XRusza9ydE2SmdsFS8WdHjqrfEf3ut8xFi 1dbpj/nIwJECR6bRmPrghEdl6GRMdAQwkQ0rpCC95Fk+TPSWZO9t/pHD97Gx13IxDzQK rzM8qHoUkcXyPVLR/+7pfX7sI2VHJTTG1EZMtjvoO2WhhlOVAA1AuQSvBn+ieV8TggtS EdaA== 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=Er/D8YCQdFUfKZUHAyv15V7bjk6/00/6C7YBjeKBmz0=; b=zWxoQucEUVuXiLpA6fsOrGQU8JnBM6i/J9YxQeXgzXu0cashYQk1dMiRvqVS6dniA5 jQh8wVTNnvJ/E9caJ8jWDpAnxqnMP1EMJ0WDJyB1k+uDHFkAIJ9VO316Omm+Q9du1qQg Eo2L6gm5snAHqIkTIf1ZAezgYA21opR/Dkyz3n22hc+z2G8SZSGh6m/wbAni4D9tw0sl gcmG4mRJK2ETzXZbUoi1Vt7EBjQvCiTUpF+8dPQ2ONNQx0Uciw9FkMLJ5w3fL60GaKfu wpV/p+3YOpZ/xIVeZKVxqJXQonYca8U6mrKuwD5DX/Vr7NXaeaqY4NOlMLSE/2E7QlwX FlXw== X-Gm-Message-State: AJIora/dIT6N6S/Lqhd7y2zBti9DhW5U2Uyp+eMSv/6Y9zWG21LTSC8k NZYD32xH2+Jw+hnSeiDY6RhxoHnCOQDA X-Google-Smtp-Source: AGRyM1vNQpuIBnQOi5gEOgasBXWO/uSR2yRwq8xVesY9rxw8ooLxre1k0rHNj5NCWdTGUIvy1Do+Rg== X-Received: by 2002:a5d:6d07:0:b0:21d:1ee6:16c0 with SMTP id e7-20020a5d6d07000000b0021d1ee616c0mr22073471wrq.63.1656848479097; Sun, 03 Jul 2022 04:41:19 -0700 (PDT) Received: from localhost.localdomain (83.11.75.211.ipv4.supernova.orange.pl. [83.11.75.211]) by smtp.gmail.com with ESMTPSA id p28-20020a1c545c000000b003a02de5de80sm12413142wmi.4.2022.07.03.04.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 04:41:18 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH 2/3] oeqa/sysroot.py: Check bitbake return status Date: Sun, 3 Jul 2022 13:41:13 +0200 Message-Id: <20220703114114.2313369-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220703114114.2313369-1-ptsneves@gmail.com> References: <20220703114114.2313369-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, 03 Jul 2022 11:41:23 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167554 bitbake ran but we incorrectly did not assert the exit status needs to be non 0. Now all sysroot tests commands expected to fail are verified to do so. Signed-off-by: Paulo Neves --- meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py index 588fc8c713..294ba4a4a0 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -45,6 +45,7 @@ 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) + self.assertTrue(res.status != 0) def test_sysroot_la(self): """ @@ -57,10 +58,12 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" 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): """ @@ -73,7 +76,9 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" 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 Jul 3 11:41: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: 9769 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 A6943C433EF for ; Sun, 3 Jul 2022 11:41:23 +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.web09.60127.1656848481370072949 for ; Sun, 03 Jul 2022 04:41:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kpOZfp6A; spf=pass (domain: gmail.com, ip: 209.85.221.50, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f50.google.com with SMTP id v14so9512359wra.5 for ; Sun, 03 Jul 2022 04:41: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=X2HYAcgvLJ2N+7II3RpghbloZHayIFax+Vb5ne9lZbg=; b=kpOZfp6AAp32DpCBmK/SUAiLghQ6FRWnyhDOWcqaFLtuVtirPfF9Yxeca+yyJiWWar JvDTP0YqPokFDlsBcystHFK0TmlhX5a4+ms5MQLFg2qCukBrTaOHsjysBIIyJznPiQxd QLjiVu36SN4d4Au8e8dDB2LIXzOG9xVC6hmWuF5GRweHru5lL8bmgD4aEySkpH/guTAj 4s/venczlUTsNzte3EieRsa6KwETQTOiSYEUVYUT8KLumjLodpJyZ31+/Sd2mQlWSR3w idj239VpV5TznqGsmLUv1eCJUsH+JWc0D9fC0QCz60Re0wzCFWi2IFdiuGUNlObNWbjO Ecog== 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=X2HYAcgvLJ2N+7II3RpghbloZHayIFax+Vb5ne9lZbg=; b=DO7CjCtj31LYR0gA1eDeIR/or/KMaQdcEflj2ClkDdRrJO4qwdvz5jfEgGEv0Ie2m1 GNyEVbbC0iJrfnbiD3YUfX+Ffrc+1wM4rqOTSg693u45SbXLhZMe4kSZ6RmH88yV7PFM MNVzUuyqnq80cFXmaJjVw3HeUbyiIHg6MBOXtUl/8fNLCMCBRc0+CCyVa1y4mYyB2Pjv sCTnNuLL1lbjYHd9YdgV1WJNla9d4PcjU/A4+lIAp6hYRp+edKvF6Yh4qPMe4DACL+t0 1vNKLrPwq7zt4XrgFqu0CZiUjkOYM3xp66FHRoA/i5C+OvC2FnhbksLVfRrxBJGSEKKv L6gw== X-Gm-Message-State: AJIora+5JGfYHyUnB0bk7NY/2fyNU9nddKno0KDVvbGvyaCtaJgojIDO GERxKMIdME4vR4W2At9Hcv47LN5CH0UB X-Google-Smtp-Source: AGRyM1toRRdvR0GqIYgtpzVNCxH1nPip+93mtVTwcVx+YgeZXn7pQVk3jshQnGUe1IycCrpx3rkT5Q== X-Received: by 2002:a5d:4e12:0:b0:21b:ae89:73e7 with SMTP id p18-20020a5d4e12000000b0021bae8973e7mr21795385wrt.386.1656848479798; Sun, 03 Jul 2022 04:41:19 -0700 (PDT) Received: from localhost.localdomain (83.11.75.211.ipv4.supernova.orange.pl. [83.11.75.211]) by smtp.gmail.com with ESMTPSA id p28-20020a1c545c000000b003a02de5de80sm12413142wmi.4.2022.07.03.04.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 04:41:19 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH 3/3] utils: create_cmdline_shebang_wrapper preserve permission and ownership Date: Sun, 3 Jul 2022 13:41:14 +0200 Message-Id: <20220703114114.2313369-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220703114114.2313369-1-ptsneves@gmail.com> References: <20220703114114.2313369-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, 03 Jul 2022 11:41:23 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167555 The .real command was not given the same permissions and ownership as the original pre-wrap file and this is now fixed. A situation where the original pre-wrap file did not have write permissions would cause a failure in the wrapping is also fixed. Test update also included. Signed-off-by: Paulo Neves --- .../wrapper/cmdline-shebang-wrapper-test.bb | 11 ++++++++++- meta/classes/utils.bbclass | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb b/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb index c4126a41fc..c3d3548d4a 100644 --- a/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb +++ b/meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb @@ -8,7 +8,10 @@ SRC_URI += "file://test.awk" EXCLUDE_FROM_WORLD = "1" do_install() { install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/test.awk ${D}${bindir}/test + # was not able to make ownership preservation check + install -m 0400 ${WORKDIR}/test.awk ${D}${bindir}/test + + perm_old="$(stat --format='%a' ${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 @@ -16,6 +19,12 @@ do_install() { else bbnote "Wrapper is good" fi + + perm_new="$(stat --format='%a' ${D}${bindir}/test.real)" + + if [ "$perm_new" != "$perm_old" ]; then + bbfatal "Wrapper permissions for ${D}${bindir}/test.real not preserved. Found $perm_new but expected $perm_old" + fi } BBCLASSEXTEND = "native" diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index b58c22771f..e6f7f95d80 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -202,6 +202,9 @@ create_cmdline_shebang_wrapper () { 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 + chown --reference=$cmd $cmd.real + chmod --reference=$cmd $cmd.real + rm -f $cmd cmdname=$(basename $cmd) dirname=$(dirname $cmd) cmdoptions=$@