Skip to content
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

Chown :groupName and chgrp provide uid as 4294967295L #67

Open
LuQQiu opened this issue Oct 23, 2018 · 3 comments
Open

Chown :groupName and chgrp provide uid as 4294967295L #67

LuQQiu opened this issue Oct 23, 2018 · 3 comments

Comments

@LuQQiu
Copy link

LuQQiu commented Oct 23, 2018

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?

@SerCeMan
Copy link
Owner

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?

@LuQQiu
Copy link
Author

LuQQiu commented Oct 23, 2018

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!

@LuQQiu
Copy link
Author

LuQQiu commented Dec 21, 2018

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants