aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--lib/Iurt/Chroot.pm8
2 files changed, 9 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 2ab56eb..e31303d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
- rebuild_perl_iurt: set --target to correctly build for armv7hl on aarch64
machines
- iurt: Fix / of the chroot belonging to the user instead of root
+- iurt: Make generation of the chroot archive more atomic
0.8.2.2
- ulri: Fix a crash after build failures
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 4949828..d87a6b9 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -344,7 +344,15 @@ sub create_build_chroot_tar {
$clean->();
return;
}
+ my $tmp_tar = mktemp("$chroot_tar.tmp.XXXXXX");
sudo($config, "--tar", $chroot_tar, $tmp_chroot);
+ if (rename($tmp_tar, $chroot_tar)) {
+ plog('NOTIFY', "archive creation failed.");
+ unlink($tmp_tar);
+ $clean->();
+ return;
+ }
+
}
if (!-d $chroot) {