Teach fsck about partial commits
An OSTree user noticed that `ostree fsck` would produce `missing object` errors in the case of interrupted pulls. It's possible to do e.g. `ostree pull --subpath=/usr/share/rpm ...`, which gets you just that portion of the commit. The use case for this was being able to see what changes would appear in an update before actually downloading all of it. (I think this would be better covered by static deltas, but those aren't final yet, and `--subpath` predates it) Further, `.commitpartial` is used as a successor to the `transaction` symlink for more precise knowledge in the case where a pull was interrupted that we needed to resume scanning. So it makes sense for `ostree fsck` to be aware of it.
This commit is contained in:
1 parent
279308b5b9
commit
5becd5ccad
10 files changed
+153
-20
No files matched your search
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ot-fs-utils.h"
|
||||
#include "libgsystem.h"
|
||||
#include "libglnx.h"
|
||||
#include <sys/xattr.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
|
||||
@@ -188,3 +189,20 @@ ot_openat_read_stream (int dfd,
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_ensure_unlinked_at (int dfd,
|
||||
const char *path,
|
||||
GError **error)
|
||||
{
|
||||
if (unlinkat (dfd, path, 0) != 0)
|
||||
{
|
||||
if (G_UNLIKELY (errno != ENOENT))
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -57,4 +57,8 @@ gboolean ot_openat_read_stream (int dfd,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean ot_ensure_unlinked_at (int dfd,
|
||||
const char *path,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
Reference in new issue
Block a user