You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
3 bits (read, write, executable) for user, group, others
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.
The text was updated successfully, but these errors were encountered:
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:
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 to000110110100
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 therwx
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.
The text was updated successfully, but these errors were encountered: