diff --git a/try b/try index 24e0838..32e6942 100755 --- a/try +++ b/try @@ -87,14 +87,8 @@ try() { for lower_dir in $LOWER_DIRS do temp_mountpoint="$lower_dir/upperdir$mountpoint" - if [ -n "$new_mountpoint" ] - then - # If new_mountpoint is not empty, append : and the temp_mountpoint - new_mountpoint="$new_mountpoint:$temp_mountpoint" - else - # If new_mountpoint is empty, just set it to temp_mountpoint - new_mountpoint="$temp_mountpoint" - fi + # Make sure we put : between, but not at the beginning + new_mountpoint="${new_mountpoint:+$new_mountpoint:}$temp_mountpoint" done IFS=$OLDIFS # Add the original mountpoint at the end @@ -211,21 +205,16 @@ do ## To address this, we use unionfs/mergerfs (they support the same functionality) to show all mounts under the target mount as normal directories. ## Then we can normally make the overlay on the new union directory. ## - ## KK 2023-06-29 Since this uses findmnt, it performs the union+overlay for both the outside and the inside mount. - ## In the best case scenario this is only causing extra work (the internal mount is already shown through the unionfs), - ## but in the worst case this could lead to bugs due to the extra complexity (e.g., because we are doing mounts on top of each other). - ## We should try to investigate either: - ## 1. Not doing another overlay if we have done it for a parent directory (we can keep around a list of overlays and skip if we are in a child) - ## 2. Do one unionfs+overlay at the root `/` once and be done with it! - ## - ## EZ 2025-01-10 We have removed findmnt since it is unneccessary #189 + ## MMG 2025-01-27 + ## There used to be more complicated logic here using `findmnt`, but we currently + ## just build unions for every mount in the root. if [ -z "$UNION_HELPER" ] then ## We can ignore this mountpoint, if the user program tries to use it, it will crash, but if not we can run normally printf "%s: Warning: Failed mounting $mountpoint as an overlay and mergerfs or unionfs not set and could not be found, see \"$try_mount_log\"\n" "$TRY_COMMAND" >&2 else - merger_dir="$SANDBOX_DIR"/mergerdir."$(echo "$pure_mountpoint" | tr '/' '.')" + merger_dir="$SANDBOX_DIR"/mergerdir"$(echo "$pure_mountpoint" | tr '/' '.')" mkdir "$merger_dir" ## Create a union directory