summaryrefslogtreecommitdiffstats
path: root/meta-selftest/recipes-test
diff options
context:
space:
mode:
authorPaulo Neves <ptsneves@gmail.com>2022-07-03 13:41:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-04 15:15:11 +0100
commit47973fd4f3fbb0af1a0d1bc2c39f2900a963177d (patch)
tree1bec3126946415f5f715db44cbb7f2546867780d /meta-selftest/recipes-test
parent68f49af704a4e808ad274d689e884923776edfec (diff)
downloadopenembedded-core-47973fd4f3fbb0af1a0d1bc2c39f2900a963177d.tar.gz
utils: create_cmdline_shebang_wrapper preserve permission and ownership
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 <ptsneves@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest/recipes-test')
-rw-r--r--meta-selftest/recipes-test/wrapper/cmdline-shebang-wrapper-test.bb11
1 files changed, 10 insertions, 1 deletions
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"