When encountering suid or sgid files, we already set the `u` or `g` property in the prototype file. Given that proto.c only supports three numbers for permissions, we need to remove the redundant information from the permission, else it was incorrectly parsed. [v1] -> [v2] Improve masking as suggested [v2] -> [v3] Fix typo Co-authored-by: Luca Di Maio <luca.dimaio1@xxxxxxxxx> Co-authored-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> Signed-off-by: Luca Di Maio <luca.dimaio1@xxxxxxxxx> --- mkfs/xfs_protofile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkfs/xfs_protofile.in b/mkfs/xfs_protofile.in index e83c39f..9418e7f 100644 --- a/mkfs/xfs_protofile.in +++ b/mkfs/xfs_protofile.in @@ -43,7 +43,9 @@ def stat_to_str(statbuf): else: sgid = '-' - perms = stat.S_IMODE(statbuf.st_mode) + # We already register suid in the proto string, no need + # to also represent it into the octet + perms = stat.S_IMODE(statbuf.st_mode) & 0o777 return '%s%s%s%03o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \ statbuf.st_gid) -- 2.49.0