I'm running into a rather odd problem with Ruby and File.chmod (same problem exists with FileUtils.chmod.
Here is what I am doing for a test case:
File.chmod(1777, "testfile")
But once I have done that, I get this as a permission set:
--wxrwS--t
This problem only exists when using the *nix 4 digit permission sets. I googled it, but didn't get anything of value. When the permission set is 0777 it assigns properly, but anything higher than 0 for the first digit will mess up the permissions pretty bad.
Anybody have any tips?
I know I could make a system call to do what I want, but I'm sure it is something simple that I'm missing.
01777 will work. In ruby a leading zero in an integer literal specifies that it's written in octal notation and file permissions are usually written as octal numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With