-
Notifications
You must be signed in to change notification settings - Fork 18k
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
os: ambiguous documentation of type FileMode #25422
Comments
I guess the text could be read to be ambiguous. When the comment says "these bits should be considered part of the public API" it refers to all the bits, not just the nine least-significant bits. |
Note that @GinjaNinja32 read the documentation exactly the opposite way, so a fix is clearly in order ;) |
In context, I would interpret it to mean: |
The defined file mode bits are the most significant bits of the FileMode. The nine least-significant bits are the standard Unix rwxrwxrwx permissions. Should I raise CL with above comment? |
I think we should separate the non-single-bit constants into a separate In truth changing any of the constant values would break Go 1 compatibility but it does make sense to clarify that the single-bit flags especially can't be changed. |
How about
|
@bcmills @ianlancetaylor this ticket is over a year old. Could we bump it a bit? Thanks! |
Want to send in a pull request? |
I can send a PR is we are ok with my suggestion. |
Sounds reasonable, thanks. |
@Windsooon if you are referring literally to the text in #25422 (comment), it is insufficient to address the original reason I opened this PR. It is clear that the low 9 bits are "set in stone". The original text and also your suggested text do not answer the question:
( afaik golang does not work on systems without at least rudimentary POSIX-ish support ) |
@mib-kd743naq The os package is responsible for adjusting the underlying file information to use the exported mode bits. |
I gathered as much ;) I simply wanted to point out again that a fix which only discusses "the low 9 bits" is not sufficient. I haven't tried to send a PR myself as CLA's are hard :( |
Change https://golang.org/cl/191313 mentions this issue: |
@bcmills @ianlancetaylor I am really confused... Based on your comments #25422 (comment) and #25422 (comment) all currently defined bits out of the 32 are stable and can be relied upon never changing ( specifically bits 32, 28, 27/22, 26, 25, 24, 21 ) Yet commit https://go-review.googlesource.com/c/go/+/191313/1/src/os/types.go explicitly changes the text to read:
So which one is it? Any defined out of the 32, or just the lowest 9? |
You're right, I'm confused too. The text in #25422 (comment) looks more or less correct. The text in #25422 (comment) looks misleading. I was reading the latter comment out of context. |
What version of Go are you using (
go version
)?N/A
Does this issue reproduce with the latest release?
Yes ( latest document online )
What operating system and processor architecture are you using (
go env
)?N/A
What did you do?
Read documentation of the FileMode bitfields
What did you expect to see?
Either
OR
const
listing below should be considered part of the public API...What did you see instead?
The documentation as currently written is clearly open to interpretation. Further discussion: https://botbot.me/freenode/go-nuts/2018-05-16/?msg=100120706&page=5
The text was updated successfully, but these errors were encountered: