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

Auto cleanup temporary files #66

Closed
wants to merge 20 commits into from
Closed

Auto cleanup temporary files #66

wants to merge 20 commits into from

Conversation

zdyxry
Copy link
Contributor

@zdyxry zdyxry commented Jun 26, 2023

No description provided.

@ezrizhu ezrizhu requested a review from mgree June 26, 2023 00:25
Copy link
Member

@angelhof angelhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes! I left some questions that I am not sure about. In addition to that, could you add/extend a test to check that the sandbox is not deleted in cases where the commit was not accepted?

try Outdated
@@ -109,7 +121,7 @@ EOF
(commit) commit "$SANDBOX_DIR";;
(interactive)
summary "$SANDBOX_DIR" >&2
if [ "$?" -eq 0 ]
if [ "$exitcode" -eq 0 ] && [ "$?" -eq 0 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a non-zero exit could could still warrant committing. What is the purpose of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood here, fixed

try Outdated
@@ -121,6 +133,7 @@ EOF
fi
;;
esac
$CLEANUP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that CLEANUP only needs to be called when things are committed (otherwise we delete a directory that the user might want to use later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have CLEANUP collect the names of things to clean up and then explicitly call rm somewhere in the script than to collect a command and then simply run it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup action is now only executed after commit

try Outdated
@@ -39,6 +43,13 @@ try() {
mount_and_execute=$(mktemp)
export chroot_executable=$(mktemp)
export try_mount_log=$(mktemp)

# Cleanup the temporary files
CLEANUP="rm -rf $mount_and_execute $chroot_executable $try_mount_log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I would delete the try_mount_log by default it might be useful for debugging after the script is done executing. (Though admittedly now it is not shown to the user anywhere so it can't be found anyway).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some branches have messages pointing to $try_mount_log, and we should surface it anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

@angelhof angelhof requested a review from ezrizhu June 26, 2023 13:12
@mgree
Copy link
Contributor

mgree commented Jun 28, 2023

Okay, I'm stumped: I had a brainwave last night that we were leaving the filesystems mounted and that might be the issue... but unmounting seems to work on everything but the /dev mount, and we still have this perms issue in the workdir. 🤔

@ezrizhu
Copy link
Collaborator

ezrizhu commented Jun 28, 2023

unmounting seems to work on everything but the /dev mount

with nested-mount branch, we’re only mounting certain files of /dev, perhaps that could fix it?

@mgree
Copy link
Contributor

mgree commented Jun 28, 2023

That will fix the /dev mount, sure. But the core issue is that overlayfs is leaving zombie/unpermed files in its workdir, so we can't clean it up.

@mgree
Copy link
Contributor

mgree commented Jun 28, 2023

Okay, I've reorganized things so the tests make sense. Everything works... except the cleanup code, which is borking on the remaining overlayfs workdir.

@mgree mgree mentioned this pull request Jun 29, 2023
9 tasks
@angelhof
Copy link
Member

Pulled the commits from this to #92, so closing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants