mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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. (From OE-Core rev: 47973fd4f3fbb0af1a0d1bc2c39f2900a963177d) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
0e84a9d697
commit
f0ee900859
@@ -8,7 +8,10 @@ SRC_URI += "file://test.awk"
|
|||||||
EXCLUDE_FROM_WORLD = "1"
|
EXCLUDE_FROM_WORLD = "1"
|
||||||
do_install() {
|
do_install() {
|
||||||
install -d ${D}${bindir}
|
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
|
sed -i -e 's|@AWK_BIN@|${bindir}/awk|g' ${D}${bindir}/test
|
||||||
create_cmdline_shebang_wrapper ${D}${bindir}/test
|
create_cmdline_shebang_wrapper ${D}${bindir}/test
|
||||||
if [ $(${D}${bindir}/test) != "Don't Panic!" ]; then
|
if [ $(${D}${bindir}/test) != "Don't Panic!" ]; then
|
||||||
@@ -16,6 +19,12 @@ do_install() {
|
|||||||
else
|
else
|
||||||
bbnote "Wrapper is good"
|
bbnote "Wrapper is good"
|
||||||
fi
|
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"
|
BBCLASSEXTEND = "native"
|
||||||
|
|||||||
@@ -202,6 +202,9 @@ create_cmdline_shebang_wrapper () {
|
|||||||
argument="$(sed -ne 's/^#! *//p;q' $cmd)"
|
argument="$(sed -ne 's/^#! *//p;q' $cmd)"
|
||||||
# strip the shebang from the real script as we do not want it to be usable anyway
|
# strip the shebang from the real script as we do not want it to be usable anyway
|
||||||
tail -n +2 $cmd > $cmd.real
|
tail -n +2 $cmd > $cmd.real
|
||||||
|
chown --reference=$cmd $cmd.real
|
||||||
|
chmod --reference=$cmd $cmd.real
|
||||||
|
rm -f $cmd
|
||||||
cmdname=$(basename $cmd)
|
cmdname=$(basename $cmd)
|
||||||
dirname=$(dirname $cmd)
|
dirname=$(dirname $cmd)
|
||||||
cmdoptions=$@
|
cmdoptions=$@
|
||||||
|
|||||||
Reference in New Issue
Block a user