From 0a8ed345e0dfce5577a0b9323dc1e0f7d83c84dc Mon Sep 17 00:00:00 2001 From: Beniamin Sandu Date: Wed, 25 Mar 2026 08:43:02 +0200 Subject: [PATCH] fix race condition when building multiple path sourced extensions Signed-off-by: Beniamin Sandu --- src/utils/container.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/container.rs b/src/utils/container.rs index 2d815ea..3938197 100644 --- a/src/utils/container.rs +++ b/src/utils/container.rs @@ -1718,8 +1718,9 @@ if [ -n "$AVOCADO_EXT_PATH_MOUNTS" ]; then target_path="$EXT_PREFIX/$ext_name" if [ -d "$mnt_path" ]; then - # Clear any stale files from a previous source type (e.g. package -> path switch) - rm -rf "$target_path" + # Create target if it doesn't exist. Avoid rm -rf because parallel + # containers share this volume and would race on the same paths. + # Stale package-sourced files are harmless — bindfs overlays them. mkdir -p "$target_path" if [ -n "$AVOCADO_HOST_UID" ] && [ -n "$AVOCADO_HOST_GID" ]; then if [ "$AVOCADO_HOST_UID" = "0" ] && [ "$AVOCADO_HOST_GID" = "0" ]; then @@ -1967,8 +1968,9 @@ if [ -n "$AVOCADO_EXT_PATH_MOUNTS" ]; then target_path="$EXT_PREFIX/$ext_name" if [ -d "$mnt_path" ]; then - # Clear any stale files from a previous source type (e.g. package -> path switch) - rm -rf "$target_path" + # Create target if it doesn't exist. Avoid rm -rf because parallel + # containers share this volume and would race on the same paths. + # Stale package-sourced files are harmless — bindfs overlays them. mkdir -p "$target_path" if [ -n "$AVOCADO_HOST_UID" ] && [ -n "$AVOCADO_HOST_GID" ]; then if [ "$AVOCADO_HOST_UID" = "0" ] && [ "$AVOCADO_HOST_GID" = "0" ]; then