Add inital suport for chmod and chown on ext4 as well as the abllity to read permissions.#337
Conversation
chmod and chown as well as the abllity to read permissions.chmod and chown on ext4 as well as the abllity to read permissions.
|
I really dont like the useage of |
|
It seems like type assertion with In another test youve already used |
|
This is a nice bit of addition. Thank you.
Correct (as you discovered). We needed the Chmod and Chown to be in place in order to implement the
Right. Not just here, that is the way it is done in general with
Yeah, that |
Going down the rabbit hole of trying to get permissions out of the ext4 img, turns out that wasn't implemented.
Started by adding
permissionsToMode()to inode as the heavy lifting was already done and we just needed to convert the fields in the inode struct toos.FileModeThen in
ext4.Stat()we can add the file mode withmode: in.permissionsToMode(),Getting the owner and group I added a StatT struct to FileInfo that contains the
UIDandGIDof the file, this is set when the FileInfo object is created.chownandchmodare relatively easy. Check the file exists, apply the permissions and then callfs.writeInode()Added the tests as well for
chmodandchownIn the test we can see the usage of
.Sys(). This returnsanyso we have to tell it what it is returning withstat, ok := fi.Sys().(*StatT). For nowStatTonly containsUIDandGID.Also got the ext4 test time down by 3x