summaryrefslogtreecommitdiff
path: root/src/partition
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-01-23 14:47:00 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-01-23 16:33:03 +0100
commitff1b55ffdf7ba7294e9e9d00393acbac426295c9 (patch)
tree834f334619427f5ddda6a3deb4cd85348afc38c3 /src/partition
parent49fb6e97d2ffeb026829e6e6d780816abea407ae (diff)
downloadsystemd-ff1b55ffdf7ba7294e9e9d00393acbac426295c9.tar.gz
Revert "repart: Ensure files end up owned by root in generated filesystems"
This reverts commit e59678b2cf42e4206ddabc959d3cf9a5a865ecdc. We also modify the repart integration tests to make them pass with the changes in this commit. In short, we have to make sure every file is owned by the user executing repart. We use tee instead of cat since it makes that easier. This also has the benefit of improving debugability as seeing the config file contents on stdout makes it easier to know which test is failing.
Diffstat (limited to 'src/partition')
-rw-r--r--src/partition/repart.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 12ed0b02f5..c95b1d601d 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -3745,7 +3745,6 @@ static int context_copy_blocks(Context *context) {
}
static int do_copy_files(Partition *p, const char *root, const Set *denylist) {
-
int r;
assert(p);
@@ -3794,14 +3793,14 @@ static int do_copy_files(Partition *p, const char *root, const Set *denylist) {
r = copy_tree_at(
sfd, ".",
pfd, fn,
- getuid(), getgid(),
+ UID_INVALID, GID_INVALID,
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN,
denylist);
} else
r = copy_tree_at(
sfd, ".",
tfd, ".",
- getuid(), getgid(),
+ UID_INVALID, GID_INVALID,
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN,
denylist);
if (r < 0)
@@ -3856,7 +3855,7 @@ static int do_make_directories(Partition *p, const char *root) {
STRV_FOREACH(d, p->make_directories) {
- r = mkdir_p_root(root, *d, getuid(), getgid(), 0755);
+ r = mkdir_p_root(root, *d, UID_INVALID, GID_INVALID, 0755);
if (r < 0)
return log_error_errno(r, "Failed to create directory '%s' in file system: %m", *d);
}