From a2d67f658a908bb2b36601d594a6406b7551675c Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 2 Nov 2018 13:26:28 -0400 Subject: [PATCH] app/tree: Check upfront if repo is writable Didn't hit this but this will be useful for a following commit which delays committing to the final repo until the end. Closes: #1658 Approved by: cgwalters --- src/app/rpmostree-compose-builtin-tree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/rpmostree-compose-builtin-tree.c b/src/app/rpmostree-compose-builtin-tree.c index 22b60120..fb7db09b 100644 --- a/src/app/rpmostree-compose-builtin-tree.c +++ b/src/app/rpmostree-compose-builtin-tree.c @@ -484,6 +484,10 @@ rpm_ostree_compose_context_new (const char *treefile_pathstr, if (!self->repo) return FALSE; + /* sanity check upfront we can even write to this repo; e.g. might be a mount */ + if (!ostree_repo_is_writable (self->repo, error)) + return glnx_prefix_error (error, "Cannot write to repository"); + if (opt_workdir_tmpfs) g_printerr ("note: --workdir-tmpfs is deprecated and will be ignored\n");