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

set -e # exit on error during chroot processes leaves host OS disfunctional #48

Open
asharrem opened this issue Sep 26, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@asharrem
Copy link

asharrem commented Sep 26, 2022

During chroot_build.sh, any errors - perhaps due to missing packages (lupin-casper - 22.04) - will exit before chroot_exit_teardown() can cleanup. This leaves the build system in a dis-functional state - in the case of building locally.
Adding trap chroot_exit_teardown ERR to build.sh is a way of exiting chroot_build.sh cleanly.

set -eE                  # exit on error
set -o pipefail         # exit on pipeline error
set -u                  # treat unset variable as error
trap chroot_exit_teardown ERR

removing the chroot during 'debootstap()' - before 'debootstap' - also cleans the build.sh workspace in case of EXIT on errors.

function debootstrap() {
    echo "=====> running debootstrap ... will take a couple of minutes ..."
    sudo rm -r chroot
@mvallim mvallim self-assigned this Sep 26, 2022
@mvallim mvallim added the bug Something isn't working label Sep 26, 2022
@asharrem
Copy link
Author

asharrem commented Sep 29, 2022

The trap as I defined is rather crude, as any error will perform chroot_exit_teardown(),
Creates a potential loop if chroot_enter_setup() has not completed.
A flag variable could conditionally perform chroot_exit_teardown() - or conditionally the trap itself.

@kgilmer
Copy link
Collaborator

kgilmer commented Oct 1, 2022

It would be nice to get this fixed, thanks for the tips @asharrem . What I've done in the past is just move the whole chroot to /tmp upon dev iterations but it would be nice to have a better way.

@mvallim mvallim pinned this issue Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants