lib/repo: Immediately error creating bare-user repo on tmpfs
And in general, if for some reason we can't write `user.` xattrs, provide an error immediately rather than doing it during a later pull. This way the failure cause is a lot more obvious. Related: https://github.com/ostreedev/ostree/issues/991 Closes: #993 Approved by: jlebon
This commit is contained in:
1 parent
3234295324
commit
23b93a3eb6
4 files changed
+61
-24
No files matched your search
@@ -1752,6 +1752,21 @@ ostree_repo_create (OstreeRepo *self,
|
||||
}
|
||||
}
|
||||
|
||||
/* Test that the fs supports user xattrs now, so we get an error early rather
|
||||
* than during an object write later.
|
||||
*/
|
||||
if (mode == OSTREE_REPO_MODE_BARE_USER)
|
||||
{
|
||||
g_auto(GLnxTmpfile) tmpf = { 0, };
|
||||
|
||||
if (!glnx_open_tmpfile_linkable_at (dfd, ".", O_RDWR|O_CLOEXEC, &tmpf, error))
|
||||
return FALSE;
|
||||
if (fchmod (tmpf.fd, 0600) < 0)
|
||||
return glnx_throw_errno_prefix (error, "fchmod");
|
||||
if (!_ostree_write_bareuser_metadata (tmpf.fd, 0, 0, 644, NULL, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ostree_repo_open (self, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
||||
Reference in new issue
Block a user