Skip to content

Commit 3625130

Browse files
authored
Merge pull request #3323 from cgwalters/copydir-no-xattrs
deploy: Don't copy xattrs for devicetree
2 parents f7018d8 + 72202df commit 3625130

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/libostree/ostree-sysroot-deploy.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,16 @@ install_into_boot (OstreeRepo *repo, OstreeSePolicy *sepolicy, int src_dfd, cons
184184
/* Copy ownership, mode, and xattrs from source directory to destination */
185185
static gboolean
186186
dirfd_copy_attributes_and_xattrs (int src_parent_dfd, const char *src_name, int src_dfd,
187-
int dest_dfd, OstreeSysrootDebugFlags flags,
188-
GCancellable *cancellable, GError **error)
187+
int dest_dfd, GLnxFileCopyFlags flags, GCancellable *cancellable,
188+
GError **error)
189189
{
190190
g_autoptr (GVariant) xattrs = NULL;
191191

192192
/* Clone all xattrs first, so we get the SELinux security context
193193
* right. This will allow other users access if they have ACLs, but
194194
* oh well.
195195
*/
196-
if (!(flags & OSTREE_SYSROOT_DEBUG_NO_XATTRS))
196+
if (!(flags & GLNX_FILE_COPY_NOXATTRS))
197197
{
198198
if (!glnx_dfd_name_get_all_xattrs (src_parent_dfd, src_name, &xattrs, cancellable, error))
199199
return FALSE;
@@ -284,7 +284,7 @@ checksum_dir_recurse (int dfd, const char *path, OtChecksum *checksum, GCancella
284284

285285
static gboolean
286286
copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name,
287-
OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error)
287+
GLnxFileCopyFlags copy_flags, GCancellable *cancellable, GError **error)
288288
{
289289
g_auto (GLnxDirFdIterator) src_dfd_iter = {
290290
0,
@@ -302,8 +302,8 @@ copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name,
302302
if (!glnx_opendirat (dest_parent_dfd, name, TRUE, &dest_dfd, error))
303303
return FALSE;
304304

305-
if (!dirfd_copy_attributes_and_xattrs (src_parent_dfd, name, src_dfd_iter.fd, dest_dfd, flags,
306-
cancellable, error))
305+
if (!dirfd_copy_attributes_and_xattrs (src_parent_dfd, name, src_dfd_iter.fd, dest_dfd,
306+
copy_flags, cancellable, error))
307307
return glnx_prefix_error (error, "Copying attributes of %s", name);
308308

309309
while (TRUE)
@@ -320,7 +320,7 @@ copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name,
320320

321321
if (S_ISDIR (child_stbuf.st_mode))
322322
{
323-
if (!copy_dir_recurse (src_dfd_iter.fd, dest_dfd, dent->d_name, flags, cancellable,
323+
if (!copy_dir_recurse (src_dfd_iter.fd, dest_dfd, dent->d_name, copy_flags, cancellable,
324324
error))
325325
return FALSE;
326326
}
@@ -329,8 +329,7 @@ copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name,
329329
if (S_ISLNK (child_stbuf.st_mode) || S_ISREG (child_stbuf.st_mode))
330330
{
331331
if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf, dest_dfd,
332-
dent->d_name,
333-
sysroot_flags_to_copy_flags (GLNX_FILE_COPY_OVERWRITE, flags),
332+
dent->d_name, GLNX_FILE_COPY_OVERWRITE | copy_flags,
334333
cancellable, error))
335334
return glnx_prefix_error (error, "Copying %s", dent->d_name);
336335
}
@@ -468,7 +467,8 @@ copy_modified_config_file (int orig_etc_fd, int modified_etc_fd, int new_etc_fd,
468467

469468
if (S_ISDIR (modified_stbuf.st_mode))
470469
{
471-
if (!copy_dir_recurse (modified_etc_fd, new_etc_fd, path, flags, cancellable, error))
470+
GLnxFileCopyFlags copy_flags = sysroot_flags_to_copy_flags (0, flags);
471+
if (!copy_dir_recurse (modified_etc_fd, new_etc_fd, path, copy_flags, cancellable, error))
472472
return FALSE;
473473
}
474474
else if (S_ISLNK (modified_stbuf.st_mode) || S_ISREG (modified_stbuf.st_mode))
@@ -1900,8 +1900,10 @@ install_deployment_kernel (OstreeSysroot *sysroot, int new_bootversion,
19001900
}
19011901
else
19021902
{
1903+
// Don't copy xattrs for devicetree; Fedora derives label them modules_t which is
1904+
// wrong for when they're installed, we want the default boot_t.
19031905
if (!copy_dir_recurse (kernel_layout->boot_dfd, bootcsum_dfd,
1904-
kernel_layout->devicetree_srcpath, sysroot->debug_flags,
1906+
kernel_layout->devicetree_srcpath, GLNX_FILE_COPY_NOXATTRS,
19051907
cancellable, error))
19061908
return FALSE;
19071909
}

0 commit comments

Comments
 (0)