From patchwork Mon Jul 4 14:46:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9824 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 96A76C433EF for ; Mon, 4 Jul 2022 14:47:01 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.web09.73292.1656946018255994232 for ; Mon, 04 Jul 2022 07:46:58 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gm1T1t9v; spf=pass (domain: gmail.com, ip: 209.85.221.47, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f47.google.com with SMTP id r14so8026144wrg.1 for ; Mon, 04 Jul 2022 07:46:58 -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=NIMcz5kxF4sUq59CN9N4jKK6BKA8IMx7U1PXcNFyPvI=; b=gm1T1t9vr/JYzbXCzZ0OFOvy6yx0sHV6Ipzfx/i0hOBYt8FTWtfH+in9WkmoJh6CQV OhoRyqadk9V0LoOwkm/1ARKZMVg2a0BgBXFCmGUAv+gp5HRPsK2bT12cHtCCJ6jXtU28 3266XcXnQeV8dcpYv/JSlOJ7Keh8C3enZRypdLoi8E2IaXsPNsyEff624BoetNzWOiAf LIQVa86fRnl6Lk782aocR1cCw1CVmjXFIdM3b/gjE/nbb9QpSpDLh1mYrZ2LSZyqnfUy ef7Jt04V5moUtOaM96MwIOso7yTPa1myKtODMmZEmgZyQng8kk6EsxvBTWYtmZPgm8Ir F2OQ== 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=NIMcz5kxF4sUq59CN9N4jKK6BKA8IMx7U1PXcNFyPvI=; b=ROhQQXWhwCAwp7Ii93t0VaHx1ZX8kvZyx02rfZ8t3Q8Pyq5PQTCclCR+dfub16MA3l 22bnO+oUsGaEs93feyn6ACFaf3Y1g3Juw5LgbloeC93BeULSm7iDHev4M4UFSTMw7fME VO/d//fvih9NmEPo66OioGxfss5Ix4U9C8zYSx4vabTSSm0PnJEMmrvYUBXpAvuAdTdC y7NZfRAPNQv3/E7nx4VZDeM9IFE0NeXS9k6P7+gF5gEt+uI9oLEHhklz2KmM80qwR79W s2JEKc/hhix/xgX09n4WBzRxM9ksNHjkWxf1GHUzQOQl8MNZ3fQXbl20s0E1TooCvF17 f8hw== X-Gm-Message-State: AJIora9CqioRe2HzhmeqEy3WXJKk3rL/7G5DuOq/PhSvs1CHnio2Ah9j y6gw8wMPKNgkvxxYOCwzXC1twvy+tIov X-Google-Smtp-Source: AGRyM1tylQSWZRaVihRxMFBgmHBoeL/0RDUxpZryXiJ/KhZ7Nztm5wg1jzRsy7awILY9vhSK3gcG3g== X-Received: by 2002:a05:6000:18ad:b0:21b:a24a:1786 with SMTP id b13-20020a05600018ad00b0021ba24a1786mr29334757wri.115.1656946016572; Mon, 04 Jul 2022 07:46:56 -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 p15-20020a05600c204f00b0039c5cecf206sm19518363wmg.4.2022.07.04.07.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 07:46:56 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves , Richard Purdie Subject: [PATCH v2 1/3] utils: create_cmdline_shebang_wrapper whitespace and sed refactor Date: Mon, 4 Jul 2022 16:46:51 +0200 Message-Id: <20220704144653.2490662-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 ; Mon, 04 Jul 2022 14:47:01 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167619 Correct whitespace to match the rest of the code in utils. Refactored sed expression with a simpler equivalent. Signed-off-by: Paulo Neves Signed-off-by: Richard Purdie --- 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 Mon Jul 4 14:46:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9826 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 81EB5C43334 for ; Mon, 4 Jul 2022 14:47:11 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web11.72559.1656946018945298449 for ; Mon, 04 Jul 2022 07:46:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gx4oL7ES; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id f2so8449466wrr.6 for ; Mon, 04 Jul 2022 07:46:58 -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=FB+lxeDkQMMf3ltvmmPYpZT1PmNB3xNBOlUvDeB2bBU=; b=gx4oL7ESTbcuTUkfi2GRg2AmLerhdgIbUBeqxzxPnTHmFukB5PHI377vTomuEu1ICG g5AZugc4aNU3CTgRpTWDNGz893WYL832Id/rXPx7cbWeVca/sWLcWQsPYgLUB9plCglX zhQhsbnuYqcm8/xBCCyGFGkSJzP87Rhf46rKjolN8UHIxQvCjZxmUivEe3GhYYsvsD/q 02bVa6qRz284V4qOX0ZB3gIPq2vk1LAbqZQOygzxHJxvA+a/gMn1sOuszJ1ywBlMz0K2 nIieyZkYyhGvC2PKGz0Wx3jRkp94YZxFvhqAEf+BAyeuHvAvu+1/S39+yO/rRnIg2h93 s5SQ== 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=FB+lxeDkQMMf3ltvmmPYpZT1PmNB3xNBOlUvDeB2bBU=; b=nM+De34xqvpWz67PFMpWIkP4zjjlzTr9ycqCisZU6Iy8+fujZrsx7KVofKjNLEgr24 w9TA9EWx2Qqe+YheEvQ5iv1eHW97RO4DFl2EPppQMCIN2Br0enPWBRqYjL+W+RgARkEj pD0lGCDJ7jNKyf6vUur0DIhetHubeO+P5mB/c09R5SBZOHVMEAD7VRtROWS2P464i2F9 TvkXcAakWYIhcPClMNlmryhUafFqlyO/oNVbR9pPPNEgjY5zZAELlFOZ8O5xBzNidsTM tvsmdkB36aYseqz83RvYDTAWZIXCRgJJmzKFXjdOcC7BQdQkY6AkurX0zWRo4aVAwHPn n3XA== X-Gm-Message-State: AJIora/cwj7Bdl+x2GHeGhCv/CJYYnVHoxbYXA0g/eVO+e4zQ7JskCB8 l8L62Hpvfu0wETRG8VJ99bC9QZCrCuga X-Google-Smtp-Source: AGRyM1vJEUUx7vNWpwJ3Y3s/XeYAheKN1GsW4BZ8q0/wVGcZiKsL4IroUu0S4T05qkECeg+rb0NAUQ== X-Received: by 2002:a5d:6da3:0:b0:21b:aaf5:b814 with SMTP id u3-20020a5d6da3000000b0021baaf5b814mr27018968wrs.140.1656946017383; Mon, 04 Jul 2022 07:46:57 -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 p15-20020a05600c204f00b0039c5cecf206sm19518363wmg.4.2022.07.04.07.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 07:46:57 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves , Richard Purdie Subject: [PATCH v2 2/3] utils: create_cmdline_shebang_wrapper preserve permission and ownership Date: Mon, 4 Jul 2022 16:46:52 +0200 Message-Id: <20220704144653.2490662-2-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704144653.2490662-1-ptsneves@gmail.com> References: <20220704144653.2490662-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 ; Mon, 04 Jul 2022 14:47:11 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167620 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 Signed-off-by: Richard Purdie --- .../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=$@ From patchwork Mon Jul 4 14:46:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Neves X-Patchwork-Id: 9825 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 9529FC43334 for ; Mon, 4 Jul 2022 14:47:01 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web09.73294.1656946019677558319 for ; Mon, 04 Jul 2022 07:47:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qoelnEk1; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: ptsneves@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id h17so669583wrx.0 for ; Mon, 04 Jul 2022 07:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NrCvaciejEb2VGHC7QMHM3mpuxy+s4PNgkom7LNi+j8=; b=qoelnEk1rlu3mggH+FO1SXdyjcULjWJH31ckLmGt5lI6VHnkCXupcaXVGkimgWoLik P0vyoyuXwoGpbfSOYSRj7D2yLjfg9DGLMwgR1NQ96XULIEca+MhHHABIY+GHdLoHnySh CDwH2YeTko/Sh6wS3jB2DQi2ZCMMXP0hxT6hxkO0+BYTPtaXoIMiu7CxGipZB1P6okhd N8ukb/iGSp+NqQym1qo+YkzEUYo1J1cO08eJjxyHaBpC8qsXfmZ+4cniUtg4k5XtNG6h WCeW9f7APgI9phxkNVd/XU2ax8UD7aqDDBLQiBJk2o3ZwMB3PTcXYNhe4qxFTuH3qFRc 2kuw== 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=NrCvaciejEb2VGHC7QMHM3mpuxy+s4PNgkom7LNi+j8=; b=uhgLmk/FGUXwslSOhZTnuqUSRlx1BXWuBoaBMprzgmienQBOSQgkV4LcEEIXcPVeTW /n2cDHWVNrNhqGxG6QSUh4uDe+InEG84CYom7yVy95A65rIShissVZmr0T+K7txQXq21 iQXT8Gfu94x/1JbL4NbEReTEDSEMz47xft/rDLawSN3cfGGGQ8KAohmxJ/GIpNRCFPkN sN2DegTZGK9Yjds0wumczbwOQATVbcNhoYKdOjCEDtLHxwQaC4LiAfVnTpd5H3LIbbil T7Qjn2tMvMrXIWb47/iCb4wN+UNxL6vxJLBkUgDeaKX8gt54s7S/J6TjXoZilwlvuu3l csEQ== X-Gm-Message-State: AJIora/XhfSTY0Lxjnpj96Ow7hOx9FPuZ9U9UQmJJ8uC86+eHyWP9+nK tQhlCpiKj+S7zqIBJUsm3pSglFyh6S9e X-Google-Smtp-Source: AGRyM1ucJGXXJOgNO6N8/9dubpEdW7Fi5HPGT981KA2eg98ov9lUtxB+4GHbwjdw1CHh5T/E+6+KKw== X-Received: by 2002:a05:6000:1d97:b0:210:25d6:e125 with SMTP id bk23-20020a0560001d9700b0021025d6e125mr26389632wrb.464.1656946018206; Mon, 04 Jul 2022 07:46:58 -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 p15-20020a05600c204f00b0039c5cecf206sm19518363wmg.4.2022.07.04.07.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 07:46:57 -0700 (PDT) From: Paulo Neves To: openembedded-core@lists.openembedded.org Cc: Paulo Neves Subject: [PATCH v2 3/3] oeqa/sysroot.py: Check bitbake return status Date: Mon, 4 Jul 2022 16:46:53 +0200 Message-Id: <20220704144653.2490662-3-ptsneves@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704144653.2490662-1-ptsneves@gmail.com> References: <20220704144653.2490662-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 ; Mon, 04 Jul 2022 14:47:01 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/167621 bitbake ran but we incorrectly did not check 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py index 588fc8c713..6371a10074 100644 --- a/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/meta/lib/oeqa/selftest/cases/sysroot.py @@ -43,7 +43,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" 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) + res = bitbake("sysroot-shebang-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) def test_sysroot_la(self): @@ -54,11 +54,11 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" """ expected = "la-test.la failed sanity test (workdir) in path" - res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-la-test -c populate_sysroot") 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) + res = bitbake("sysroot-la-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) self.assertTrue('[la]' in res.output, msg=res.output) @@ -70,10 +70,11 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s" """ expected = "test.pc failed sanity test (tmpdir) in path" - res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True) + res = bitbake("sysroot-pc-test -c populate_sysroot") 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) + res = bitbake("sysroot-pc-test-native -c populate_sysroot") self.assertTrue(expected in res.output, msg=res.output) self.assertTrue('[pkgconfig]' in res.output, msg=res.output) + self.assertTrue(res.status != 0)