IMPALA-13937: (Addendum) Replace diff with manual bash script

diff require BASE_IMAGE to have diffutils preinstalled. However, not all
BASE_IMAGE have it preinstalled. This patch replace the diff invocation
with manual bash script.

Testing:
Completed build with ubi8:latest that does not have diffutils
preinstalled.

Change-Id: I58e9ef7c344caffd198664e3f9683f54ce2c1914
Reviewed-on: http://gerrit.cloudera.org:8080/22898
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Riza Suminto
2025-05-13 17:45:59 -07:00
committed by Impala Public Jenkins
parent f18cfaf0db
commit 02fb5e1ccb

View File

@@ -291,8 +291,17 @@ mkdir -p /var/tmp
chmod a=rwxt /var/tmp /tmp
# The busybox implementation of chmod is known to ignore certain chmod syntax variations,
# so check if the directories actually have the correct permissions
diff <(stat -c '%u %g %a' /tmp) - <<<'0 0 1777'
diff <(stat -c '%u %g %a' /var/tmp) - <<<'0 0 1777'
check_dir_stat() {
target_dir=$1
stat_expect=$2
stat=$(stat -c '%u %g %a' $target_dir)
if [[ "$stat" != "$stat_expect" ]]; then
echo "Expect $target_dir permission '$stat_expect' but got '$stat' instead."
exit 1
fi
}
check_dir_stat "/tmp" "0 0 1777"
check_dir_stat "/var/tmp" "0 0 1777"
# To minimize the size for the Docker image, clean up any unnecessary files.
if [[ $DISTRIBUTION == Ubuntu ]]; then