Skip to content
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

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

jsternberg
Copy link
Contributor

@jsternberg jsternberg commented Feb 5, 2018

Fixes #9266.

  • Rebased/mergable
  • Tests pass

@ghost ghost assigned jsternberg Feb 5, 2018
@ghost ghost added the review label Feb 5, 2018
@jsternberg jsternberg force-pushed the js-9266-unix-socket-permissions branch from 66538f0 to 963106c Compare March 12, 2018 16:52
Copy link
Contributor

@mark-rushakoff mark-rushakoff left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be %04o?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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 0s. 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.

Copy link
Contributor Author

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).

Copy link
Contributor Author

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.

@jsternberg jsternberg force-pushed the js-9266-unix-socket-permissions branch from 963106c to 3c5bebe Compare April 5, 2018 19:14
@jsternberg
Copy link
Contributor Author

@mark-rushakoff I think I addressed your comments on this.

@jsternberg jsternberg force-pushed the js-9266-unix-socket-permissions branch from 3c5bebe to 1b738d3 Compare April 5, 2018 19:40
@jsternberg jsternberg merged commit b24afed into master Apr 5, 2018
@ghost ghost removed the review label Apr 5, 2018
@jsternberg jsternberg deleted the js-9266-unix-socket-permissions branch April 5, 2018 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants