-
Notifications
You must be signed in to change notification settings - Fork 30k
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.userInfo().shell is '' if no shell in /etc/passwd #15684
Comments
A few comments. First, the
So, I don't think it would be unreasonable to require that the information be in the password file.
The test could still check that a string is returned. It could even go further and perform the current check if the string has a length > 0.
I'm not saying that we should go this route, but we already do something like this with the user's home directory. |
This is potentially an Ubuntu/Debian behaviour. At least, the typical Ubuntu user entry, based on (default) So, it seems it is possible to have an interactive shell without the export of |
Unrelated, but that sounds like a bug in |
That makes sense, so if people need something higher level to get the user's default shell we can just add an |
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: nodejs#16287 Fixes: nodejs#15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: #16287 Fixes: #15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: nodejs/node#16287 Fixes: nodejs/node#15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: #16287 Fixes: #15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: #16287 Fixes: #15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: #16287 Fixes: #15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The shell in /etc/passwd can be blank, in which case the user is given the default shell. Handle this by only checking the shell contains a path separator if the string isn't empty. PR-URL: nodejs/node#16287 Fixes: nodejs/node#15684 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Continuation of libuv/libuv#1570
Basically this line fails:
node/test/parallel/test-os.js
Line 196 in 4843c2f
because
os.userInfo().shell
is''
. This is becauseos.userInfo()
callsuv__getpwuid_r()
which callsgetpwuid_r(3)
, which reads the relevant line from/etc/passwd
:However the user shell on this machine is not defined in
/etc/passwd
, so we get a default.The question is whether we should just update the test (remove this check, so don't actually check that
os.userInfo().shell
actually returns anything, or whetheros.userInfo().shell
should handle this case.I guess it comes down to whether this function's purpose is just "read the shell from
/etc/passwd
", or "tell you which shell the user is using". If it's the former we remove the test, if it's the latter we should check either the default shell, orprocess.env.SHELL
.The default shell is either just defaulting to
/bin/sh
, or it's coming from/etc/adduser.conf
:The text was updated successfully, but these errors were encountered: