Add bare-user-only repo mode
This mode is similar to bare-user, but does not store the permission, ownership (uid/gid) and xattrs in an xattr on the file objects in the repo. Additionally it stores symlinks as symlinks rather than as regular files+xattrs, like the bare mode. The later is needed because we can't store the is-symlink in the xattr. This means that some metadata is lost, such as the uid. When reading a repo like this we always report uid, gid as 0, and no xattrs, so unless this is true in the commit the resulting repository will not fsck correctly. However, it the main usecase of the repository is to check out with --user-mode, then no information is lost, and the repository can work on filesystems without xattrs (such as tmpfs). Closes: #750 Approved by: cgwalters
This commit is contained in:
1 parent
612150f143
commit
be28c10849
5 files changed
+68
-7
No files matched your search
@@ -227,7 +227,11 @@ commit_loose_object_trusted (OstreeRepo *self,
|
||||
}
|
||||
|
||||
/* Special handling for symlinks in bare repositories */
|
||||
if (object_is_symlink && self->mode == OSTREE_REPO_MODE_BARE)
|
||||
if (object_is_symlink && self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY)
|
||||
{
|
||||
/* We don't store the metadata in bare-user-only, so we're done. */
|
||||
}
|
||||
else if (object_is_symlink && self->mode == OSTREE_REPO_MODE_BARE)
|
||||
{
|
||||
/* Now that we know the checksum is valid, apply uid/gid, mode bits,
|
||||
* and extended attributes.
|
||||
@@ -283,7 +287,8 @@ commit_loose_object_trusted (OstreeRepo *self,
|
||||
}
|
||||
}
|
||||
|
||||
if (objtype == OSTREE_OBJECT_TYPE_FILE && self->mode == OSTREE_REPO_MODE_BARE_USER)
|
||||
if (objtype == OSTREE_OBJECT_TYPE_FILE &&
|
||||
(self->mode == OSTREE_REPO_MODE_BARE_USER || self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY))
|
||||
{
|
||||
if (!object_is_symlink)
|
||||
{
|
||||
@@ -302,7 +307,8 @@ commit_loose_object_trusted (OstreeRepo *self,
|
||||
}
|
||||
}
|
||||
|
||||
if (!write_file_metadata_to_xattr (fd, uid, gid, mode, xattrs, error))
|
||||
if (self->mode == OSTREE_REPO_MODE_BARE_USER &&
|
||||
!write_file_metadata_to_xattr (fd, uid, gid, mode, xattrs, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -708,8 +714,10 @@ write_object (OstreeRepo *self,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
else if (repo_mode == OSTREE_REPO_MODE_BARE && temp_file_is_symlink)
|
||||
else if (_ostree_repo_mode_is_bare (repo_mode) && temp_file_is_symlink)
|
||||
{
|
||||
/* Note: This will not be hit for bare-user mode because its converted to a
|
||||
regular file and take the branch above */
|
||||
if (!_ostree_make_temporary_symlink_at (self->tmp_dir_fd,
|
||||
g_file_info_get_symlink_target (file_info),
|
||||
&temp_filename,
|
||||
@@ -959,6 +967,7 @@ scan_one_loose_devino (OstreeRepo *self,
|
||||
case OSTREE_REPO_MODE_ARCHIVE_Z2:
|
||||
case OSTREE_REPO_MODE_BARE:
|
||||
case OSTREE_REPO_MODE_BARE_USER:
|
||||
case OSTREE_REPO_MODE_BARE_USER_ONLY:
|
||||
skip = !g_str_has_suffix (name, ".file");
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user