-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: unify user-mode canonical mask to 0775 #2420
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -298,7 +298,7 @@ commit_loose_regfile_object (OstreeRepo *self, | |
*/ | ||
if (S_ISREG (mode)) | ||
{ | ||
const mode_t content_mode = (mode & (S_IFREG | 0775)) | S_IRUSR; | ||
const mode_t content_mode = (mode & USERMODE_CANONICAL_MASK) | S_IFREG | S_IRUSR; | ||
if (!glnx_fchmod (tmpf->fd, content_mode, error)) | ||
return FALSE; | ||
} | ||
|
@@ -1318,7 +1318,7 @@ adopt_and_commit_regfile (OstreeRepo *self, | |
if (self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY) | ||
{ | ||
const guint32 src_mode = g_file_info_get_attribute_uint32 (finfo, "unix::mode"); | ||
if (fchmod (fd, src_mode & 0755) < 0) | ||
if (fchmod (fd, src_mode & USERMODE_CANONICAL_MASK) < 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. I was surprised this didn't seem to break any tests that looked at the commit permissions. That seems to be a bit lacking in the tests. There are several that look at the permissions after a checkout, but only a few that look at the permissions of the committed objects with |
||
return glnx_throw_errno_prefix (error, "fchmod"); | ||
} | ||
if (renameat (dfd, name, dest_dfd, loose_path) == -1) | ||
|
@@ -3323,11 +3323,11 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self, | |
/* In particular, we want to squash the s{ug}id bits, but this also | ||
* catches the sticky bit for example. | ||
*/ | ||
g_file_info_set_attribute_uint32 (modified_info, "unix::mode", mode & (S_IFREG | 0755)); | ||
g_file_info_set_attribute_uint32 (modified_info, "unix::mode", (mode & USERMODE_CANONICAL_MASK) | S_IFREG); | ||
break; | ||
case G_FILE_TYPE_DIRECTORY: | ||
/* Like the above but for directories */ | ||
g_file_info_set_attribute_uint32 (modified_info, "unix::mode", mode & (S_IFDIR | 0755)); | ||
g_file_info_set_attribute_uint32 (modified_info, "unix::mode", (mode & USERMODE_CANONICAL_MASK) | S_IFDIR); | ||
break; | ||
case G_FILE_TYPE_SYMBOLIC_LINK: | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. There's a really important difference between
bare-user
andbare-user-only
, which is thatbare-user
is intended to be losslessly convertible to-frombare
. Now, we store the mode as an xattr, but it kind of intentional that the checked out tree mostly resembles what's in thebare
.I'd be happier I think if this change only touched code paths involved in
bare-user-only
. Then the messaging is clearer.