Merge pull request #1984 from jlebon/pr/supp-groups
lib/repo: Create repo directories as 0775
This commit is contained in:
commit
010e6c38bc
|
|
@ -30,6 +30,12 @@ G_BEGIN_DECLS
|
||||||
/* It's what gzip does, 9 is too slow */
|
/* It's what gzip does, 9 is too slow */
|
||||||
#define OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL (6)
|
#define OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL (6)
|
||||||
|
|
||||||
|
/* Note the permissive group bits. We want to be liberal here and let individual machines
|
||||||
|
* narrow permissions as needed via umask. This is important in setups where group ownership
|
||||||
|
* can matter for repo management (like OpenShift). */
|
||||||
|
#define DEFAULT_DIRECTORY_MODE 0775
|
||||||
|
#define DEFAULT_REGFILE_MODE 0660
|
||||||
|
|
||||||
/* This file contains private implementation data format definitions
|
/* This file contains private implementation data format definitions
|
||||||
* read by multiple implementation .c files.
|
* read by multiple implementation .c files.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ checkout_object_for_uncompressed_cache (OstreeRepo *self,
|
||||||
|
|
||||||
if (self->uncompressed_objects_dir_fd == -1)
|
if (self->uncompressed_objects_dir_fd == -1)
|
||||||
{
|
{
|
||||||
if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, "uncompressed-objects-cache", 0755,
|
if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, "uncompressed-objects-cache",
|
||||||
cancellable, error))
|
DEFAULT_DIRECTORY_MODE, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!glnx_opendirat (self->repo_dir_fd, "uncompressed-objects-cache", TRUE,
|
if (!glnx_opendirat (self->repo_dir_fd, "uncompressed-objects-cache", TRUE,
|
||||||
&self->uncompressed_objects_dir_fd,
|
&self->uncompressed_objects_dir_fd,
|
||||||
|
|
|
||||||
|
|
@ -2925,7 +2925,7 @@ _ostree_repo_cache_summary (OstreeRepo *self,
|
||||||
if (self->cache_dir_fd == -1)
|
if (self->cache_dir_fd == -1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!glnx_shutil_mkdir_p_at (self->cache_dir_fd, _OSTREE_SUMMARY_CACHE_DIR, 0775, cancellable, error))
|
if (!glnx_shutil_mkdir_p_at (self->cache_dir_fd, _OSTREE_SUMMARY_CACHE_DIR, DEFAULT_DIRECTORY_MODE, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
const char *summary_cache_file = glnx_strjoina (_OSTREE_SUMMARY_CACHE_DIR, "/", remote);
|
const char *summary_cache_file = glnx_strjoina (_OSTREE_SUMMARY_CACHE_DIR, "/", remote);
|
||||||
|
|
|
||||||
|
|
@ -1181,7 +1181,7 @@ _ostree_repo_write_ref (OstreeRepo *self,
|
||||||
char *parent = strdupa (ref->ref_name);
|
char *parent = strdupa (ref->ref_name);
|
||||||
parent[lastslash - ref->ref_name] = '\0';
|
parent[lastslash - ref->ref_name] = '\0';
|
||||||
|
|
||||||
if (!glnx_shutil_mkdir_p_at (dfd, parent, 0755, cancellable, error))
|
if (!glnx_shutil_mkdir_p_at (dfd, parent, DEFAULT_DIRECTORY_MODE, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1427,7 +1427,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||||
g_autofree char *dnbuf = g_strdup (descriptor_relpath);
|
g_autofree char *dnbuf = g_strdup (descriptor_relpath);
|
||||||
const char *dn = dirname (dnbuf);
|
const char *dn = dirname (dnbuf);
|
||||||
|
|
||||||
if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, dn, 0755, cancellable, error))
|
if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, dn, DEFAULT_DIRECTORY_MODE, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
if (!glnx_opendirat (self->repo_dir_fd, dn, TRUE, &descriptor_dfd, error))
|
if (!glnx_opendirat (self->repo_dir_fd, dn, TRUE, &descriptor_dfd, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ push_repo_lock (OstreeRepo *self,
|
||||||
g_debug ("Opening repo lock file");
|
g_debug ("Opening repo lock file");
|
||||||
lock->fd = TEMP_FAILURE_RETRY (openat (self->repo_dir_fd, ".lock",
|
lock->fd = TEMP_FAILURE_RETRY (openat (self->repo_dir_fd, ".lock",
|
||||||
O_CREAT | O_RDWR | O_CLOEXEC,
|
O_CREAT | O_RDWR | O_CLOEXEC,
|
||||||
0600));
|
DEFAULT_REGFILE_MODE));
|
||||||
if (lock->fd < 0)
|
if (lock->fd < 0)
|
||||||
{
|
{
|
||||||
free_repo_lock (lock);
|
free_repo_lock (lock);
|
||||||
|
|
@ -2491,7 +2491,7 @@ repo_create_at_internal (int dfd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mkdirat (dfd, path, 0755) != 0)
|
if (mkdirat (dfd, path, DEFAULT_DIRECTORY_MODE) != 0)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY (errno != EEXIST))
|
if (G_UNLIKELY (errno != EEXIST))
|
||||||
return glnx_throw_errno_prefix (error, "mkdirat");
|
return glnx_throw_errno_prefix (error, "mkdirat");
|
||||||
|
|
@ -2529,7 +2529,7 @@ repo_create_at_internal (int dfd,
|
||||||
for (guint i = 0; i < G_N_ELEMENTS (state_dirs); i++)
|
for (guint i = 0; i < G_N_ELEMENTS (state_dirs); i++)
|
||||||
{
|
{
|
||||||
const char *elt = state_dirs[i];
|
const char *elt = state_dirs[i];
|
||||||
if (mkdirat (repo_dfd, elt, 0755) == -1)
|
if (mkdirat (repo_dfd, elt, DEFAULT_DIRECTORY_MODE) == -1)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY (errno != EEXIST))
|
if (G_UNLIKELY (errno != EEXIST))
|
||||||
return glnx_throw_errno_prefix (error, "mkdirat");
|
return glnx_throw_errno_prefix (error, "mkdirat");
|
||||||
|
|
@ -3325,7 +3325,7 @@ ostree_repo_open (OstreeRepo *self,
|
||||||
*
|
*
|
||||||
* https://github.com/ostreedev/ostree/issues/1018
|
* https://github.com/ostreedev/ostree/issues/1018
|
||||||
*/
|
*/
|
||||||
if (mkdirat (self->repo_dir_fd, "tmp", 0755) == -1)
|
if (mkdirat (self->repo_dir_fd, "tmp", DEFAULT_DIRECTORY_MODE) == -1)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY (errno != EEXIST))
|
if (G_UNLIKELY (errno != EEXIST))
|
||||||
return glnx_throw_errno_prefix (error, "mkdir(tmp)");
|
return glnx_throw_errno_prefix (error, "mkdir(tmp)");
|
||||||
|
|
@ -3337,7 +3337,7 @@ ostree_repo_open (OstreeRepo *self,
|
||||||
|
|
||||||
if (self->writable)
|
if (self->writable)
|
||||||
{
|
{
|
||||||
if (!glnx_shutil_mkdir_p_at (self->tmp_dir_fd, _OSTREE_CACHE_DIR, 0775, cancellable, error))
|
if (!glnx_shutil_mkdir_p_at (self->tmp_dir_fd, _OSTREE_CACHE_DIR, DEFAULT_DIRECTORY_MODE, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!glnx_opendirat (self->tmp_dir_fd, _OSTREE_CACHE_DIR, TRUE, &self->cache_dir_fd, error))
|
if (!glnx_opendirat (self->tmp_dir_fd, _OSTREE_CACHE_DIR, TRUE, &self->cache_dir_fd, error))
|
||||||
|
|
@ -6129,7 +6129,7 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
|
||||||
{
|
{
|
||||||
g_auto(GLnxTmpDir) new_tmpdir = { 0, };
|
g_auto(GLnxTmpDir) new_tmpdir = { 0, };
|
||||||
/* No existing tmpdir found, create a new */
|
/* No existing tmpdir found, create a new */
|
||||||
if (!glnx_mkdtempat (tmpdir_dfd, tmpdir_name_template, 0755,
|
if (!glnx_mkdtempat (tmpdir_dfd, tmpdir_name_template, DEFAULT_DIRECTORY_MODE,
|
||||||
&new_tmpdir, error))
|
&new_tmpdir, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue