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

Rework the permission output #17

Closed
uap-universe opened this issue Oct 24, 2020 · 2 comments
Closed

Rework the permission output #17

uap-universe opened this issue Oct 24, 2020 · 2 comments

Comments

@uap-universe
Copy link

uap-universe commented Oct 24, 2020

The permission output is confusing to say the least.
Maybe the reason is that you did not understand the permission system yet, so I'll explain and maybe you can use this information to improve your program.

The permissions are stored as a 9 or 12 bit value organized as follows:

  1. 3 bits (read, write, executable) for user, group, others
  2. 3 bits for setuid, setgid, sticky bit (if available)

Each bit can be set individually making up the permissions.

Now you can represent numbers in decimal form (the usual human system, because we have ten fingers to count with).
But this is not good when talking about bits, because they live in the binary system.

So the permissions rw-rw-r-- would translate to

000110110100

Because this is long and hard to read, you can group the individual sections and represent them as octal numbers.

000 = 0
110 = 6
100 = 4

So the above example would read 0664.

So you are required to display the permissions exactly as you read them out with stat().

If you get 0755 (octal) from stat() you have to display it as rwxr-xr-x - at least of you wish to use the rwx notation. You can invent another notation if you wish, but that must exactly represent the permissions nevertheless.

Another note: you are appending the @ symbol to each of your permission outputs. But the @ symbol is not a matter of style or to look cool - it actually has a meaning. The presence of the @ symbol says that there are extended attributes on that file.

@willdoescode
Copy link
Owner

I will work on the permission output.

@willdoescode
Copy link
Owner

this is fixed in the latest release.

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