-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Allow customizing the unix socket group and permissions created by the server #9399
Conversation
66538f0
to
963106c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about some TOML parsing tests since this introduces two new types?
I think it's fine if the test for the group type only parses the number; I don't think we can rely on a particular named group being available everywhere we run tests.
toml/toml.go
Outdated
|
||
func (m FileMode) MarshalText() (text []byte, err error) { | ||
if m != 0 { | ||
return []byte(fmt.Sprintf("0%03o", m)), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be %04o
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for %04o
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I just noticed is that the output from MarshalText
appears to be different than what UnmarshalText
parses so I'll update that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%03o
sets the output width to three and left pads with 0
s. The leading 0
could be be part of the padding, i.e. %04o
should be equivalent to 0%03o
which would be the same as 00%02o
etc., as long as the value m
didn't exceed the given width.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be safer to explicitly put the zero. It's possible for a file to have the mode 1777
because of things like the sticky bit.
On the other hand, the value here is always going to be an octal so we could go and declare that 777
will always be interpreted as an octal, even if there is no leading zero. Then we would use %04
instead (and get rid of the trailing o
since it's just confusing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing zero is to tell Sprintf
to use octal and I just remembered that so just ignore that part. We would use %04o
.
963106c
to
3c5bebe
Compare
@mark-rushakoff I think I addressed your comments on this. |
3c5bebe
to
1b738d3
Compare
Fixes #9266.