Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny fixes #191

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions try
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading