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

2019-10-22 Thread STINNER Victor
STINNER Victor added the comment: This issue has been fixed. The subprocess module now uses '/system/bin/sh' by default on Android thanks to Xavier de Gaye! -- nosy: +vstinner resolution: -> fixed stage: needs patch -> resolved status: open -> closed

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

2019-02-09 Thread Chih-Hsuan Yen
Change by Chih-Hsuan Yen : -- nosy: -yan12125 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

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

2019-02-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think the functionality of getting either the system-wide default shell or the current user's default shell can be useful regardless of whether the specific subprocess issue was fixed. -- nosy: +ncoghlan stage: patch review -> needs patch versions:

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

2019-02-09 Thread Cheryl Sabella
Cheryl Sabella added the comment: 3.7 added `sys.getandroidapilevel()` under #28740. As Xavier mentioned in msg271439, that was used for subprocess.Popen in #16255 and also merged as part of 3.7. I'm not sure if there is still interest in adding a `default_shell` to the os module using `sy

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

2016-07-27 Thread Xavier de Gaye
Xavier de Gaye added the comment: > 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. I agree, the last patch that is being reviewed in issue 16255 attempts to do that.

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

2016-07-26 Thread Michael Felt
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 l

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

2016-07-10 Thread Xavier de Gaye
Xavier de Gaye added the comment: Issue 27472 adds test.support.unix_shell as the path to the default shell. -- ___ Python tracker ___ ___

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

2016-06-12 Thread Christian Heimes
Changes by Christian Heimes : -- assignee: christian.heimes -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2016-05-23 Thread Xavier de Gaye
Xavier de Gaye added the comment: Following Serhiy suggestion at msg224477, this tentative patch adds the is_android attribute to the posix module and the default_shell attribute to the os module. No documentation for the moment. No test case is needed I think, as the changes in issue 16255 wi

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

2016-04-27 Thread Roman Evstifeev
Changes by Roman Evstifeev : -- nosy: +Roman.Evstifeev ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

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

2015-11-25 Thread Chi Hsuan Yen
Changes by Chi Hsuan Yen : -- nosy: +Chi Hsuan Yen ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

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

2014-11-06 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: Added file: http://bugs.python.org/file37140/os.get_shell_executable-3.patch ___ Python tracker ___

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

2014-11-06 Thread Akira Li
Akira Li added the comment: > Matt Frank added the comment: > > In msg230720 Akira Li (akira) wrote: >> os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library >> used on Linux) sysdeps/posix/spawni.c I don't know whether it is >> possible to change CS_PATH without recompiling ev

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

2014-11-06 Thread Matt Frank
Matt Frank added the comment: In msg230720 Akira Li (akira) wrote: > os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library > used on Linux) sysdeps/posix/spawni.c I don't know whether it is > possible to change CS_PATH without recompiling every statically linked > executable on

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

2014-11-06 Thread Matt Frank
Matt Frank added the comment: In msg174930 Christian Heimes (christian.heimes) wrote: > I've tested confstr("CS_PATH") on Linux, Mac OS X, Solaris, HP-UX > and BSD. It works and the path to `sh` is always included. In msg230713 Ned Deily(ned.deily) wrote: > ignore Lib/macpath.py. > [...] > OS X

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

2014-11-05 Thread Akira Li
Akira Li added the comment: > Matt Frank added the comment: > > Unfortunately os.defpath seems to be hardcoded. And hardcoded to the > wrong value on every system I have looked at, including Linux. os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library used on Linux) sysdeps/p

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

2014-11-05 Thread Ned Deily
Ned Deily added the comment: Matt, ignore Lib/macpath.py. It is not used on OS X systems other than in the rare case that someone explicitly needs to parse obsolete Classic Mac OS (Mac OS 9 or earlier) style path names. OS X uses Lib/posixpath.py. -- nosy: +ned.deily ___

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

2014-11-05 Thread Matt Frank
Matt Frank added the comment: Unfortunately os.defpath seems to be hardcoded. And hardcoded to the wrong value on every system I have looked at, including Linux. Lib/posixpath.py sets defpath=':/bin:/usr/bin' which is _not_ what `getconf CS_PATH` returns on my Linux (the extra ':' at the begi

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

2014-11-05 Thread Matt Frank
Changes by Matt Frank : -- nosy: +WanderingLogic ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

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

2014-08-01 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: Added file: http://bugs.python.org/file36196/os.get_shell_executable.patch ___ Python tracker ___ __

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

2014-08-01 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: Removed file: http://bugs.python.org/file36195/os.get_shell_executable.patch ___ Python tracker ___

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

2014-08-01 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: -- versions: +Python 3.5 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing lis

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

2014-08-01 Thread Akira Li
Akira Li added the comment: > Should it be function? Why not use just a variable initialized at > import time? The path to the default shell shouldn't change during > the time of program execution. > if sys.platform == 'win32': > default_shell = 'cmd.exe' > else: >default_shell = '/bin/s

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

2014-08-01 Thread eryksun
eryksun added the comment: Defaulting to just "cmd.exe" can execute an arbitrary program named "cmd.exe" in the application directory or current directory. When CreateProcess needs to find the shell to execute a batch file (.bat or .cmd), it doesn't search for "cmd.exe" -- at least not in NT

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

2014-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Taking into consideration msg174586 we can ignore the ComSpec environment variable and hardcode "cmd.exe" on Windows, as we ignore the SHELL environment variable on Posix systems. -- ___ Python tracker

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

2014-08-01 Thread eryksun
eryksun added the comment: > The path to the default shell shouldn't change during the time > of program execution. On Windows the ComSpec environment variable could change during program execution. -- nosy: +eryksun ___ Python tracker

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

2014-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Should it be function? Why not use just a variable initialized at import time? The path to the default shell shouldn't change during the time of program execution. if sys.platform == 'win32': default_shell = 'cmd.exe' else: default_shell = '/bin/sh'

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

2013-11-17 Thread Christian Heimes
Christian Heimes added the comment: 3.4 beta1 will be released next weekend. I'll try to submit a patch in the next couple of days. -- assignee: -> christian.heimes stage: -> patch review ___ Python tracker

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

2013-10-24 Thread Tim Golden
Changes by Tim Golden : -- nosy: -tim.golden ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

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

2012-11-06 Thread Andrew Svetlov
Andrew Svetlov added the comment: I mean the last available SL4A doesn't have os.confstr Fallback should work, os.environ['PATH'] contains '/system/bin' where 'sh' is living. -- ___ Python tracker

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

2012-11-06 Thread Taras Lyapun
Taras Lyapun added the comment: Andrew, do you mean that Christian Heimes last snippet working on Android? -- ___ Python tracker ___ _

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

2012-11-06 Thread Andrew Svetlov
Andrew Svetlov added the comment: Confirm it for SL4A Python 3.2 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

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

2012-11-06 Thread Christian Heimes
Christian Heimes added the comment: Meh, Python 2.6 from SL4A (scripting languages for Android) doesn't have os.confstr(). I just tried it in a Android 2.3.3 emulator. Python 2.6 on Linux has the function. I propose we fall back to PATH env and use /bin as last resort. try: cspath

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

2012-11-05 Thread Chris Jerdonek
Chris Jerdonek added the comment: Some minor comments. +.. function :: get_shell() + + Return the path to default shell. Three leading spaces needed. Also, "Return the path to the default shell." + For unix system returns path to ``sh``, for windows returns path to ``cmd.exe``. "On Unix s

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

2012-11-05 Thread Chris Jerdonek
Chris Jerdonek added the comment: Is someone able to test the patch on Android (the impetus for this issue)? -- ___ Python tracker ___ ___

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

2012-11-05 Thread Taras Lyapun
Taras Lyapun added the comment: Updated patch in regards to Christian Heimes remark. -- Added file: http://bugs.python.org/file27898/issue16353.diff ___ Python tracker ___ __

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

2012-11-05 Thread Christian Heimes
Christian Heimes added the comment: I've tested confstr("CS_PATH") on Linux, Mac OS X, Solaris, HP-UX and BSD. It works and the path to `sh` is always included. Taras: You don't have to perform the platform inside the get_shell() function. I suggest that you define the function depending on th

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

2012-11-05 Thread Taras Lyapun
Taras Lyapun added the comment: Updated patch. Moved function to os and used Christian Heimes implementation. Updated doc, and test. Also renamed function to get_shell. Test passes on mac os and windows. -- Added file: http://bugs.python.org/file27897/issue16353.diff __

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

2012-11-05 Thread Chris Jerdonek
Chris Jerdonek added the comment: > Any interest in doing like os.get_terminal_size/shutil.get_terminal_size If functions with two different behaviors are needed, I think the two functions should probably have different names (e.g. get_shell() and get_user_shell()). Otherwise, it may create c

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

2012-11-05 Thread Andrew Svetlov
Andrew Svetlov added the comment: Christian, Is there ``os.confstr`` supported by MaxOS X? Is there using of environ['PATH'] makes sense as good callback if former is not present? About COMSPEC. From my point of view it's useful if we need default path. Or if we have Win9x, where shell is comma

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

2012-11-03 Thread Éric Araujo
Éric Araujo added the comment: Please use ``sh`` or maybe :command:`sh` (check the sphinx doc) instead of `sh`. -- ___ Python tracker ___

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

2012-11-03 Thread Éric Araujo
Éric Araujo added the comment: Any interest in doing like os.get_terminal_size/shutil.get_terminal_size with the os function being basic (i.e. current patch) and the shutil version querying the env var SHELL in addition? -- nosy: +eric.araujo ___ Py

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

2012-11-03 Thread Christian Heimes
Christian Heimes added the comment: The os module can't import shutil as it would create a circular import. Also shutil.which() does lots of stat calls and we don't want additional stat calls in a core module like os. My implementation requires just one stat() call. COMSPEC can point to an alt

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

2012-11-03 Thread Chris Jerdonek
Chris Jerdonek added the comment: > Also, what reason to get shell name from COMSPEC? What should we do if > COMSPEC points to some another shell, not cmd.exe? FWIW, the subprocess module does this (with surrounding code linked after): comspec = os.environ.get("COMSPEC", "cmd.exe") http://hg.

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

2012-11-03 Thread R. David Murray
R. David Murray added the comment: I think it would not be ok to import shutil in os, so I'm glad there is an alternative. -- ___ Python tracker ___

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

2012-11-03 Thread Andrew Svetlov
Andrew Svetlov added the comment: Is it ok to import *which* functions from shutil in *os* module? There is only reason to put function into shutil. But I like Christian's sketch. Also, what reason to get shell name from COMSPEC? What should we do if COMSPEC points to some another shell, not c

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

2012-11-03 Thread Christian Heimes
Christian Heimes added the comment: I'm with Chris. The information should be stored in the os module. I suggest os.shell var or os.get_shell() function like this: def get_shell(): for path in confstr("CS_PATH").split(pathsep): sh = sep.join((path, "sh")) try: mo

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

2012-11-03 Thread Chris Jerdonek
Chris Jerdonek added the comment: +++ b/Lib/shutil.py Sat Nov 03 13:32:05 2012 +0200 + +def get_default_shell_path(): Why is the patch putting the function in the shutil module? The function should go in the os module as the title and comments of this issue state. shutil seems misplaced

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

2012-11-03 Thread Christian Heimes
Christian Heimes added the comment: which('sh') isn't correct here. 'which' searches in all PATH environ parts. However the shell must be looked up in CS_PATH only. >From man sh(1posix): > Applications should note that the standard PATH to the shell cannot be > assumed to be either /bin/sh or

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

2012-11-03 Thread Taras Lyapun
Taras Lyapun added the comment: > I would to prefer *get_default_shell* as function name (it's a bit shorter). Hm... I'm not sure, because someone can imagine that function returns some object or something like this... 'path' indicates that function returns something like string. > Also pleas

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

2012-11-03 Thread Andrew Svetlov
Andrew Svetlov added the comment: I would to prefer *get_default_shell* as function name (it's a bit shorter). Also please add ".. versionadded:: 3.4" tag to docs. -- ___ Python tracker ___

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

2012-11-03 Thread Taras Lyapun
Taras Lyapun added the comment: Diff with implementation, test and doc. -- keywords: +patch nosy: +lyapun Added file: http://bugs.python.org/file27849/issue16353.diff ___ Python tracker

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

2012-11-02 Thread Andrew Svetlov
Andrew Svetlov added the comment: BTW, according to PEP 11 (http://www.python.org/dev/peps/pep-0011/) Python 3.4 will remove code for "Windows systems where COMSPEC points to command.com". There are only winner: cmd.exe as well known shell good as default, command.com is gone. cmd.exe can be

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

2012-11-02 Thread R. David Murray
R. David Murray added the comment: The "system default shell" (which should always be a /bin/sh workalike, I think) should always be the default. Any other shell should be something that has to be specified explicitly. At least, that's the way most posix programs work, I think. As Chris sai

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

2012-11-02 Thread Gregory P. Smith
Gregory P. Smith added the comment: > That is, shouldn't we look up `pwd.getpwuid(os.getuid()).pw_shell` ? > (but only when os.getuid() == os.geteuid()?) No, you can't use the users shell from the pwd module. That can be any crazy program. Not a functional /bin/sh for use in making commands wh

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

2012-11-02 Thread Chris Jerdonek
Chris Jerdonek added the comment: > Well, the question then becomes whether Popen() shouldn't use the user's > default shell instead? :) That's a good question, too. :) I was thinking just in terms of supporting the status quo. Maybe two functions would be useful? (as suggested also by Andre

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

2012-11-02 Thread Tim Golden
Tim Golden added the comment: On 02/11/2012 21:00, Andrew Svetlov wrote: > I guess to return sh if supported, cmd.exe for Windows. FWIW the canonical approach on Windows is to return whatever %COMSPEC% points to. -- nosy: +tim.golden ___ Python trac

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

2012-11-02 Thread Andrew Svetlov
Andrew Svetlov added the comment: I guess to return sh if supported, cmd.exe for Windows. The reason is: other shells can have different calling agreements (I mean rules to process command line). subprocess intended to use by library writers, so we need solid well known basis. There are anothe

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

2012-11-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The system default shell is what I had in mind when filing this issue > (i.e. what Popen() uses by default or, in the case of Android, what > Popen() should use). Well, the question then becomes whether Popen() shouldn't use the user's default shell instead? :

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

2012-11-02 Thread Chris Jerdonek
Chris Jerdonek added the comment: The system default shell is what I had in mind when filing this issue (i.e. what Popen() uses by default or, in the case of Android, what Popen() should use). -- ___ Python tracker

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

2012-11-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: Is it the "system default shell" or the user's default shell that we want here? That is, shouldn't we look up `pwd.getpwuid(os.getuid()).pw_shell` ? (but only when os.getuid() == os.geteuid()?) -- nosy: +gregory.p.smith, neologix, pitrou __

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

2012-11-02 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

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

2012-10-28 Thread Chris Jerdonek
Changes by Chris Jerdonek : -- nosy: +asvetlov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

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

2012-10-28 Thread Chris Jerdonek
New submission from Chris Jerdonek: This issue is to add a function to the os module for getting the path to the default shell (e.g. os.getdefaultshell()). In issue 16255, it was reported that on Android, the path to the default shell is "/system/bin/sh" rather than "/bin/sh" which it is on ot