From: Richard Purdie Date: Mon, 22 Jun 2020 10:57:17 +0000 (+0100) Subject: rootfs-postcommands: Improve/fix rootfs_check_host_user_contaminated X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~10615 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=504f1d158bf7c6ad08fbce755021db2b14565231;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git rootfs-postcommands: Improve/fix rootfs_check_host_user_contaminated Currently if the find command finds /home it stops checking the other files. Tweak the find expression to fix this. Also, from Alex Kiernan , generate output for each contaminated path so it's visible in the main log file. When matches are found, dump the data from the group and passwd files so useful debugging can be done based on the results. Signed-off-by: Richard Purdie --- diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index 2f171836fa0..c43b9a98230 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass @@ -308,12 +308,16 @@ rootfs_check_host_user_contaminated () { HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)" HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)" - find "${IMAGE_ROOTFS}" -wholename "${IMAGE_ROOTFS}/home" -prune \ - -user "$HOST_USER_UID" -o -group "$HOST_USER_GID" >"$contaminated" + find "${IMAGE_ROOTFS}" -path "${IMAGE_ROOTFS}/home" -prune -o \ + -user "$HOST_USER_UID" -print -o -group "$HOST_USER_GID" -print >"$contaminated" + + sed -e "s,${IMAGE_ROOTFS},," $contaminated | while read line; do + bbwarn "Path in the rootfs is owned by the same user or group as the user running bitbake:" $line `ls -lan ${IMAGE_ROOTFS}/$line` + done if [ -s "$contaminated" ]; then - echo "WARNING: Paths in the rootfs are owned by the same user or group as the user running bitbake. See the logfile for the specific paths." - cat "$contaminated" | sed "s,^, ," + bbwarn "/etc/passwd:" `cat ${IMAGE_ROOTFS}/etc/passwd` + bbwarn "/etc/group:" `cat ${IMAGE_ROOTFS}/etc/group` fi }