[issue23462] All os.exec*e variants crash on Windows

2018-02-19 Thread Steve Dower

Change by Steve Dower :


--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2017-02-04 Thread Steve Dower

Steve Dower added the comment:

It's straightforward to detect path->narrow == NULL and raise instead of 
crashing. We can also trivially check path->wide on Windows and raise with a 
more specific error.

Given it's already fixed for 3.6.0 and there's only one more binary release for 
3.5 (and Windows has *very* limited uptake apart from the binary releases), I 
don't think it's worth making this work given how many versions have been 
broken in the past.

--
assignee:  -> steve.dower
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file46520/23462_1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2017-01-26 Thread STINNER Victor

STINNER Victor added the comment:

> Just hit that bug. Is this really not yet fixed in any newer version?

The bug was fixed in Python 3.6.0. It was fixed by Steve Dower in its 
implementation of the PEP 529, in the change e20c7d8a8187:

-execv(path_char, argvlist);
+#ifdef HAVE_WEXECV
+_wexecv(path->wide, argvlist);
+#else
+execv(path->narrow, argvlist);
+#endif

I'm not sure that it's easy to backport the fix in Python 3.5.

Python 3.6 no walways use Unicode internally to call the Windows API, whereas 
Python 3.5 used bytes or Unicode depending on the arguments.

So I suggest to upgrade to Python 3.6, or use bytes in the meanwhile.

Would it be ok to close the bug?

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2017-01-26 Thread Andreas Bergmeier

Andreas Bergmeier added the comment:

Just hit that bug. Is this really not yet fixed in any newer version?

--
nosy: +Andreas Bergmeier

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2015-02-14 Thread eryksun

eryksun added the comment:

Calling nt.execv works with a unicode string because it creates a bytes path 
via PyUnicode_FSConverter. OTOH, nt.execve uses path_converter, which doesn't 
convert unicode to bytes on Windows. Thus in posixmodule.c, for the call 
execve(path-narrow, argvlist, envlist), path-narrow is NULL, and the CRT 
kills the process due to a bad argument:

(70.135c): Break instruction exception - code 8003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
`7733cb70 cc  int 3
0:000 bp ntdll!ZwTerminateProcess
0:000 bp desktopcrt140!execve
0:000 g
ModLoad: 07fe`fc85 07fe`fc868000   
C:\Windows\system32\CRYPTSP.dll
ModLoad: 07fe`fc55 07fe`fc597000   
C:\Windows\system32\rsaenh.dll
ModLoad: 07fe`fceb 07fe`fcebf000   
C:\Windows\system32\CRYPTBASE.dll

Python 3.5.0a1 (v3.5.0a1:5d4b6a57d5fd, Feb  7 2015, 18:15:14) 
[MSC v.1900 64 bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
 import nt, sys   
 path = sys.executable
 nt.execve(path, ['python', '-V'], {})

Breakpoint 1 hit
DESKTOPCRT140!_execve:
07fe`fa5ac43c 4d8bc8  mov r9,r8
0:000 r rcx
rcx=

The first argument is passed in AMD64 register rcx, which you can see is NULL 
here.

0:000 g
Breakpoint 0 hit
ntdll!NtTerminateProcess:
`772e1570 4c8bd1  mov r10,rcx
0:000 k 8
Child-SP  RetAddr   Call Site
`0038f5c8 07fe`fd11402f ntdll!NtTerminateProcess
`0038f5d0 07fe`f54e003a KERNELBASE!TerminateProcess+0x2f
`0038f600 07fe`f54e0055 APPCRT140!_invalid_parameter+0x76
`0038f640 07fe`fa5abbd8 APPCRT140!_invalid_parameter_noinfo+0x19
`0038f680 `6aa116a7 DESKTOPCRT140!common_spawnvchar+0x44
`0038f6e0 `6aa115a8 python35!os_execve_impl+0xb7
`0038f720 `6aa9ff3b python35!os_execve+0xa8
`0038f7d0 `6ab14aed python35!PyCFunction_Call+0xfb

Using a bytes path with nt.execve will work, but it's deprecated on Windows:

C:\py -3.5 -Wall
Python 3.5.0a1 (v3.5.0a1:5d4b6a57d5fd, Feb  7 2015, 18:15:14) 
[MSC v.1900 64 bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
 import os, nt, sys
 path = os.fsencode(sys.executable)
 nt.execve(path, ['python', '-V'], {})
__main__:1: DeprecationWarning: The Windows bytes API has been 
deprecated, use Unicode filenames instead

C:\Python 3.5.0a1

Since bytes paths are deprecated on Windows, these calls should be using wexecv 
and wexecve.

https://msdn.microsoft.com/en-us/library/431x4c1w%28v=vs.100%29.aspx

--
nosy: +eryksun
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23462
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2015-02-14 Thread Jeremy Nicola

New submission from Jeremy Nicola:

On Windows 7, using python 3.4.2 32 bits MSVCv.1600 or 3.4.1 64 bits, all the 
os.exec*e variants crash:

os.execle('C:/Python34/python.exe','Python.exe','-V',{})

os.execve('C:/Python34/python.exe',['python.exe','-V'],{})

os.execlpe('C:/Python34/python.exe','python.exe','-V',{})

os.execvpe('C:/Python34/python.exe',['python.exe','-V'],{})

Without any error message, windows will just open a Python.exe has stopped 
working window, be the scripts run from an interactive shell or invoking 
python script.py

On the other hand, 
os.execl('C:/Python34/python.exe','Python.exe','-V')

os.execve('C:/Python34/python.exe',['python.exe','-V'])

os.execlpe('C:/Python34/python.exe','python.exe','-V')

os.execvpe('C:/Python34/python.exe',['python.exe','-V'])

will work perfectly.

--
components: Windows
messages: 235952
nosy: nicolaje, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: All os.exec*e variants crash on Windows
type: crash
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23462
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2015-02-14 Thread Jeremy Nicola

Jeremy Nicola added the comment:

You should read:

os.execv('C:/Python34/python.exe',['python.exe','-V'])

os.execlp('C:/Python34/python.exe','python.exe','-V')

os.execvp('C:/Python34/python.exe',['python.exe','-V'])

for the what works.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23462
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com