-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
doc: note misleading error code in uv_os_get_passwd
#3926
base: v1.x
Are you sure you want to change the base?
Conversation
@@ -541,6 +541,10 @@ API | |||
memory allocated to `pwd` needs to be freed with | |||
:c:func:`uv_os_free_passwd`. | |||
|
|||
.. note:: | |||
If the effective uid does not have an entry in the password file this | |||
function will return ENOENT even if the file exists. |
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.
function will return ENOENT even if the file exists. | |
function will return `UV_ENOENT` even if the file exists. |
I kind of feel we shouldn't be using the phrase "password file" since there doesn't have to be one (e.g., on systems that use LDAP-based authentication) but I'm not sure what to replace "password file entry" on line 536 with.
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 "user source" or "user database" would fit well
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.
Yes, that's a good suggestion.
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 took a look at the windows source, and it looks like the specific ENOENT issue is only relevant for unix. Also, the term password file
is used all over the documentation of this function.
Maybe prefixing this block with On Unix systems, if the effective uid...
would be the way to go
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'd consider UV_ENOENT being Unix-only an implementation detail. It's something that can change in the future. I wouldn't mention 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.
What can be particularly confusing here is that the authoritative information for linux systems now comes not directly from /etc/password
but from /etc/nsswitch.conf
which specifies a list of dynamic library (such as libnss_files.so) to open to search for pwnam info corresponding to the given uid. The man page has this to say about the error:
0 or ENOENT or ESRCH or EBADF or EPERM or ...
The given name or uid was not found.
If an effective uid does not have an entry in the passwd file, the
uv_os_get_passwd
function will returnENOENT
which has misled our debugging efforts to look for missing files even if they were present. I've added a short note to the documentation to help others encountering similar issues in the future.