From 9ca5f63fe0149250f70d1a3a2af1408ca8ed9dff Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Wed, 13 May 2026 18:56:37 +0000 Subject: [PATCH] scripts: namespace dev_cli tmp dir per user and drop dead BUILD_DIR The shared /tmp/cloud-hypervisor/ path is created by the first user to run dev_cli.sh and owned by them, so other users on the same host fail the +x+w check and cannot chmod it back. Move both tmp paths under /tmp/cloud-hypervisor-${USER}/ so each user gets their own tree. While here, fold the local BUILD_DIR in build_container() into the existing (previously unused) CLH_CTR_BUILD_DIR, which ensure_build_dir() already creates. Assisted-by: Claude:Opus-4.7 Signed-off-by: Bo Chen --- scripts/dev_cli.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index 2597942f7..adc1a0e7d 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -20,7 +20,7 @@ CLH_ROOT_DIR=$(cd "${CLH_SCRIPTS_DIR}/.." && pwd) CLH_BUILD_DIR="${CLH_ROOT_DIR}/build" CLH_CARGO_TARGET="${CLH_BUILD_DIR}/cargo_target" CLH_DOCKERFILE="${CLH_SCRIPTS_DIR}/../resources/Dockerfile" -CLH_CTR_BUILD_DIR="/tmp/cloud-hypervisor/ctr-build" +CLH_CTR_BUILD_DIR="/tmp/cloud-hypervisor-${USER}/ctr-build" CLH_INTEGRATION_WORKLOADS="${HOME}/workloads" # Container paths @@ -649,10 +649,7 @@ cmd_tests() { build_container() { ensure_build_dir - BUILD_DIR=/tmp/cloud-hypervisor/container/ - - mkdir -p $BUILD_DIR - cp "$CLH_DOCKERFILE" $BUILD_DIR + cp "$CLH_DOCKERFILE" "$CLH_CTR_BUILD_DIR" [ "$(uname -m)" = "aarch64" ] && TARGETARCH="arm64" [ "$(uname -m)" = "x86_64" ] && TARGETARCH="amd64" @@ -660,9 +657,9 @@ build_container() { $DOCKER_RUNTIME build \ --target dev \ -t "$CTR_IMAGE" \ - -f $BUILD_DIR/Dockerfile \ + -f "$CLH_CTR_BUILD_DIR/Dockerfile" \ --build-arg TARGETARCH="$TARGETARCH" \ - $BUILD_DIR + "$CLH_CTR_BUILD_DIR" } cmd_build-container() {