Skip to content

Commit

Permalink
commit: Give a better error message for unhandled file type
Browse files Browse the repository at this point in the history
xref #3319

It'd be useful to know what file type is being hit here; I believe
this code path should be unreachable.
  • Loading branch information
cgwalters committed Oct 10, 2024
1 parent a54518e commit f11e6a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libostree/ostree-repo-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3173,7 +3173,8 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self, OstreeRepoCommitModifier *
if (canonicalize_perms)
{
guint mode = g_file_info_get_attribute_uint32 (modified_info, "unix::mode");
switch (g_file_info_get_file_type (file_info))
GFileType ty = g_file_info_get_file_type (file_info);
switch (ty)
{
case G_FILE_TYPE_REGULAR:
/* In particular, we want to squash the s{ug}id bits, but this also
Expand All @@ -3188,7 +3189,7 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self, OstreeRepoCommitModifier *
case G_FILE_TYPE_SYMBOLIC_LINK:
break;
default:
g_assert_not_reached ();
g_error ("unexpected file type %u", (unsigned)ty);
}
g_file_info_set_attribute_uint32 (modified_info, "unix::uid", 0);
g_file_info_set_attribute_uint32 (modified_info, "unix::gid", 0);
Expand Down

0 comments on commit f11e6a4

Please sign in to comment.