[V2,3/3] dbus-test: Replace cp -a/-r with portable options

Submitted by Khem Raj on March 10, 2020, 1:15 a.m. | Patch ID: 170934

Details

Message ID 20200310011544.3022342-3-raj.khem@gmail.com
State New
Headers show

Commit Message

Khem Raj March 10, 2020, 1:15 a.m.
-r are not posix defined and -a leaks UID of
build user into target

Errors like below are fixed when -a is used

bus/connection.h is owned by uid 1000, which is the same as t
he user running bitbake. This may be due to host contamination

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Improve commit message for clear reason for change

 meta/recipes-core/dbus/dbus-test_1.12.16.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/dbus/dbus-test_1.12.16.bb b/meta/recipes-core/dbus/dbus-test_1.12.16.bb
index bea0e74ed0..91e2ba69d2 100644
--- a/meta/recipes-core/dbus/dbus-test_1.12.16.bb
+++ b/meta/recipes-core/dbus/dbus-test_1.12.16.bb
@@ -70,11 +70,11 @@  do_install_ptest() {
 
 	install ${B}/test/test-segfault ${D}${PTEST_PATH}/test
 
-	cp -r ${B}/test/data ${D}${PTEST_PATH}/test
+	cp -R --no-dereference --preserve=mode,links ${B}/test/data ${D}${PTEST_PATH}/test
 	install ${B}/dbus/.libs/test-dbus ${D}${PTEST_PATH}/test
 
 	install -d ${D}${PTEST_PATH}/test/.libs
-	cp -a ${B}/dbus/.libs/*.so* ${D}${PTEST_PATH}/test/.libs
+	cp -R --no-dereference --preserve=mode,links ${B}/dbus/.libs/*.so* ${D}${PTEST_PATH}/test/.libs
 
 	# Remove build host references...
 	find "${D}${PTEST_PATH}/test/data" \( -name *.service -o -name *.conf -o -name "*.aaprofile" \) -type f -exec \

Comments

Richard Purdie March 10, 2020, 8:32 a.m.
On Mon, 2020-03-09 at 18:15 -0700, Khem Raj wrote:
> -r are not posix defined and -a leaks UID of
> build user into target
> 
> Errors like below are fixed when -a is used
> 
> bus/connection.h is owned by uid 1000, which is the same as t
> he user running bitbake. This may be due to host contamination
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> v2: Improve commit message for clear reason for change
> 
>  meta/recipes-core/dbus/dbus-test_1.12.16.bb | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/dbus/dbus-test_1.12.16.bb b/meta/recipes-core/dbus/dbus-test_1.12.16.bb
> index bea0e74ed0..91e2ba69d2 100644
> --- a/meta/recipes-core/dbus/dbus-test_1.12.16.bb
> +++ b/meta/recipes-core/dbus/dbus-test_1.12.16.bb
> @@ -70,11 +70,11 @@ do_install_ptest() {
>  
>  	install ${B}/test/test-segfault ${D}${PTEST_PATH}/test
>  
> -	cp -r ${B}/test/data ${D}${PTEST_PATH}/test
> +	cp -R --no-dereference --preserve=mode,links ${B}/test/data ${D}${PTEST_PATH}/test
>  	install ${B}/dbus/.libs/test-dbus ${D}${PTEST_PATH}/test
>  
>  	install -d ${D}${PTEST_PATH}/test/.libs
> -	cp -a ${B}/dbus/.libs/*.so* ${D}${PTEST_PATH}/test/.libs
> +	cp -R --no-dereference --preserve=mode,links ${B}/dbus/.libs/*.so* ${D}${PTEST_PATH}/test/.libs
>  
>  	# Remove build host references...
>  	find "${D}${PTEST_PATH}/test/data" \( -name *.service -o -name *.conf -o -name "*.aaprofile" \) -type f -exec \

I still want to understand why only you are seeing this first.

The implication is that we have to change most uses of "cp -r" for "cp -R --no-dereference --preserve=mode,links
" in OE-Core and every other OE layer.

If we have to do that, fine, but I do want to understand what set of
circumstances triggers the issue first.

Cheers,

Richard