Chown :groupName and chgrp provide uid as 4294967295L
LuQQiu opened this issue · comments
When we implement the jnr-fuse chown()
function in Alluxio/alluxio#8010, we find that if users want to change group without change user, the chown()
function will provide the uid as 4294967295L
instead of -1
.
4294967295L
is just unsigned long -1
.
According to https://linux.die.net/man/3/chown it looks like -1
should be the default.
Is jnr-fuse intended to use 4294967295L
instead of -1
?
Hi, @LuQQiu!
Looking at the native chown in libfuse, https://github.com/libfuse/libfuse/blob/c779a4ee2b8f61e54442d9f65c0efcee18b805cb/lib/fuse.c#L2123-L2125, uid has a type uid_t
. On different platforms uid_t
might be signed or unsigned, is it signed on your machine?
Hi @SerCeMan
In my local mac and remote ec2 (Amazon linux) instances, uid is unsigned 4294967295L
.
It seems that the 4294967295 uid_t
is given by libfuse
and does not change in jnr-fuse
.
The number(-1 or 4294967295) is likely to depend on different platforms, I would better to check both in chown
implementation.
Thanks for your fast reply and great help!
Confirmed that both uid_t and gid_t can be signed or unsigned based on the platforms. We better check both
private static final long ID_NOT_SET_VALUE = -1;
private static final long ID_NOT_SET_VALUE_UNSIGNED = 4294967295L;