Add inital suport for chmod and chown on ext4 as well as the abllity to read permissions.
#337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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