This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, matrixise, mdk, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2019-02-20.14:48:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550674133.61.0.409206569904.issue36021@roundup.psfhosted.org>
In-reply-to
Content
> Sure we don't want to execute these kinds of scripts but we could mix with GetBinaryTypeW and add a check on the extensions.

Windows has a convenient feature: if you ask to run "program", Windows tries to run "program.exe", "program.bat", etc.

Example:
---
C:\vstinner>del hello.txt

C:\vstinner>type hello.bat
echo "Hello from hello.bat" > /vstinner/hello.txt

C:\vstinner>\vstinner\python\master\python
Python 3.8.0a0 (heads/master:8f59ee01be, Jan 25 2019, 01:16:59) [MSC v.1915 64 bit (AMD64)] on win32
>>> import os
>>> os.startfile(r"c:\vstinner\hello")
>>> with open(r"c:\vstinner\hello.txt") as fp: print(fp.read())
...
"Hello from hello.bat"
---

os.startfile(r"c:\vstinner\hello") <= "hello" filename has no extension
History
Date User Action Args
2019-02-20 14:48:53vstinnersetrecipients: + vstinner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, matrixise, mdk
2019-02-20 14:48:53vstinnersetmessageid: <1550674133.61.0.409206569904.issue36021@roundup.psfhosted.org>
2019-02-20 14:48:53vstinnerlinkissue36021 messages
2019-02-20 14:48:53vstinnercreate