https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295444
Bug ID: 295444
Summary: getfacl: Inconsistent printing of uid & gid for user:
& group: entries in NFS4/ZFS ACLs
Product: Base System
Version: 15.0-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
# chgrp 3000000005 testdir
# setfacl -x 1 -a 1 group:3000000005:full_set:fd:allow testdir
# getfacl testdir
# file: testdir
# owner: peter86
# group: 3000000005
owner@:rwxpDdaARWcCos:fd-----:allow
group:-1294967291:rwxpDdaARWcCos:fd-----:allow
Looking at the code in /usr/src/lib/libc/posix1e/acl_to_text_nfs4.c it isn't so
surprising, although wrong:
if (grp == NULL)
snprintf(str, size, "group:%d", (unsigned int)*id);
else
snprintf(str, size, "group:%s", grp->gr_name);
(and similar for user:)
uid_t/gid_t are an unsigned 32bit integers, so should be printed using "%u"
instead.
The current code makes it difficult to use scripts to extract ACL entries and
copy them correctly to new files:
# mkdir newdir
# getfacl testdir | setfacl -b -n -M - newdir
setfacl: malformed ACL: unknown user or group name "-1294967291"
setfacl: -: get_acl_from_file() failed: Invalid argument
Which is due to it being impossible to set it using the "signed" variant:
# setfacl -x 1 -a 1 group:-1294967291:full_set:fd:allow td
setfacl: malformed ACL: unknown user or group name "-1294967291"
A quick look in the acl_id_to_name.c file used for POSIX ACLs seems to indicate
similar %d usage.
I think the right way to fix this is to change %d to %u when printing uid_t &
gid_t in ACL entries (and since most people probably don't use uid/gid's over 2
billion not many will have noticed this :-).
--
You are receiving this mail because:
You are the assignee for the bug.