Fixed
Created: Feb 12, 2014
Updated: Dec 3, 2018
Resolved Date: Feb 17, 2014
Previous ID: LIN5-17970
Found In Version: 6.0
Fix Version: 6.0.0.3
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Build & Config
Using "install -m" or "mkdir -m" it is possible to set the required permissions for a file or directory being installed on the target, however it seems that bitbake is ignoring those permissions and setting its own.
$ configure --enable-board=qemux86-64 \
--enable-rootfs=glibc_cgl --enable-kernel=cgl \
--enable-jobs=4 --enable-parallel-pkgbuilds=4 \
--enable-rm-work=yes --enable-rm-oldimgs=yes \
--enable-reconfig --with-sstate-dir=<path_to_sstate> \
--with-rcpl-version=0010
Edit layers/local/recipes-sample/hello/hello_1.0.bb as follows:
--- a/layers/local/recipes-sample/hello/hello_1.0.bb
+++ b/layers/local/recipes-sample/hello/hello_1.0.bb
@@ -5,12 +5,14 @@
SECTION = "sample"
-PR = "r1"
+PR = "r2"
SRC_URI = "file://hello.c"
S = "${WORKDIR}"
+FILES_${PN} += "/my_test_dir"
+
do_compile() {
${CC} ${CFLAGS} -o hello hello.c
}
@@ -18,4 +20,6 @@
do_install() {
install -d ${D}${bindir}
install -m 0755 hello ${D}${bindir}
+ install -m 0500 -d ${D}/my_test_dir
+ ls -laR ${D}
}
Then build:
$ make -C build hello.addpkg
$ make -C build hello
Examine the results of the "ls" command in the build/hello-1.0-r2/temp/log.do_install file and you will see that the permissions for the "my_test_dir" directory are set to 0700:
drwxr-xr-x 4 root root 4096 Jan 14 13:08 .
drwxr-xr-x 6 1000 1000 4096 Jan 14 13:08 ..
drwx------ 2 root root 4096 Jan 14 13:08 my_test_dir
drwxr-xr-x 3 root root 4096 Jan 14 13:08 usr
however, 0500 had been specified in the recipe.
Examining the RPM file also indicates the wrong permissions:
$ ./host-cross/usr/bin/rpm -qvlp export/RPMS/x86_64/hello-1.0-r2.x86_64.rpm
drwx------ 2 root root 0 Jan 14 13:08 /my_test_dir
drwxr-xr-x 2 root root 0 Jan 14 13:08 /usr
drwxr-xr-x 2 root root 0 Jan 14 13:08 /usr/bin
-rwxr-xr-x 1 root root 4128 Jan 14 13:08 /usr/bin/hello
and if a "make fs" is done then again the directory will be incorrect. This also happens for files, not just directories.