[issue16353] add function to os module for getting path to default shell

Michael Felt report at bugs.python.org
Tue Jul 26 18:46:09 EDT 2016


Michael Felt added the comment:

An interesting read, but I am lost in what the goal is.

e.g., on AIX, which I know well, the system default is /bin/ksh (aka /usr/bin/ksh). However, /bin/sh (/usr/bin/sh) is available as well.

My expectation is that on Linux the default shell is /bin/bash, and like AIX /bin/sh is also available.

/bin/sh, /bin/ksh, /bin/bash are all (potentially) default shells. However, something every posix system is "sh" aka borne shell.

Aside: windows is different, and I expect has a different syntax. 

So, if the goal is to GET the pathname of the so-called "default" shell -again, interesting - BUT - what does that buy me?

For Popen or now subprocess I would want a consistent shell syntax, i.e., borne shell on posix, cmd.exe on windows, and whatever is correct on platforms that do not fit in these two.

Hence, on posix platforms where /bin/sh does not exist (hard)code the correct path for that platform.

FYI: CS_PATH does not exist on AIX

IMHO: (as others have stated) having . in PATH is bad for security, being dependent on PATH opens other security concerns as well.

IMHO2: KISS principle. After several years there is still no consenus, so make it simple - the popen and subprocess shell is one of /bin/sh, cmd.exe, or some other "hard-coded" shell.

(Although I thought that subprocess called "program" directly. Python is still new, so if not applicable for subprocess - please ignore

rereading, direct call would be when shell=False I expect.

Anyway, my two cents.

----------
nosy: +Michael.Felt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16353>
_______________________________________


More information about the Python-bugs-list mailing list