Skip to content
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

Python interpreter calling "PathCchCombineEx" on startup, Windows 8 and above only #74372

Closed
s-m-e mannequin opened this issue Apr 27, 2017 · 6 comments
Closed

Python interpreter calling "PathCchCombineEx" on startup, Windows 8 and above only #74372

s-m-e mannequin opened this issue Apr 27, 2017 · 6 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@s-m-e
Copy link
Mannequin

s-m-e mannequin commented Apr 27, 2017

BPO 30186
Nosy @pfmoore, @tjguk, @bitdancer, @zware, @eryksun, @zooba, @s-m-e

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-04-27.21:01:32.820>
created_at = <Date 2017-04-27.12:17:59.958>
labels = ['interpreter-core', 'type-bug', 'OS-windows']
title = 'Python interpreter calling "PathCchCombineEx" on startup, Windows 8 and above only'
updated_at = <Date 2017-04-27.21:01:32.820>
user = 'https://github.com/s-m-e'

bugs.python.org fields:

activity = <Date 2017-04-27.21:01:32.820>
actor = 'steve.dower'
assignee = 'none'
closed = True
closed_date = <Date 2017-04-27.21:01:32.820>
closer = 'steve.dower'
components = ['Interpreter Core', 'Windows']
creation = <Date 2017-04-27.12:17:59.958>
creator = 'smernst'
dependencies = []
files = []
hgrepos = []
issue_num = 30186
keywords = []
message_count = 6.0
messages = ['292430', '292471', '292474', '292478', '292481', '292483']
nosy_count = 7.0
nosy_names = ['paul.moore', 'tim.golden', 'r.david.murray', 'zach.ware', 'eryksun', 'steve.dower', 'smernst']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue30186'
versions = ['Python 3.6']

@s-m-e
Copy link
Mannequin Author

s-m-e mannequin commented Apr 27, 2017

I am investigating a bug in Wine:
https://bugs.winehq.org/show_bug.cgi?id=42474

The Python 3.6(.1) interpreter fails to start on Wine because of an unimplemented function in Wine: "api-ms-win-core-path-l1-1-0.dll.PathCchCombineEx".

While the missing function is clearly a problem in Wine, the fact that PathCchCombineEx is called in the first place is somewhat odd. The call was added to Python 3.6 on 09 Sep 2016 by Steve Dower of Microsoft:
https://hg.python.org/cpython/rev/03517dd54977
Logically, Python 3.5.x and prior do not require this call and work flawlessly under Wine.

Digging deeper into this, I found that PathCchCombineEx was introduced in Windows 8:
https://msdn.microsoft.com/en-us/library/windows/desktop/hh707086(v=vs.85).aspx

However, the following page states, that the current version of Python (3.6) should support Windows Vista and 7:
https://docs.python.org/3/using/windows.html

I am seeking clarification on why PathCchCombineEx is called during the Python interpreter startup although Wine pretends to be Windows 7 and although Python should support Windows Vista & 7. My thinking is that this call might also happen on an actual Windows 7 system under some circumstances and break Python there as well, which would make it a bug in Python.

@s-m-e s-m-e mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error labels Apr 27, 2017
@eryksun
Copy link
Contributor

eryksun commented Apr 27, 2017

PathCchCombineEx isn't an import dependency. It's used dynamically via LoadLibraryW and GetProcAddress, with a fallback to PathCombineW. Does Wine maybe have a stub for this function that returns E_NOTIMPL (not implemented)?

@s-m-e
Copy link
Mannequin Author

s-m-e mannequin commented Apr 27, 2017

Relaying this on behalf of Gijs Vermeulen from Wine: "In my patch I tried returning E_NOTIMPL and I got the error: Fatal Python error: buffer overflow in getpathp.c's join()"

@eryksun
Copy link
Contributor

eryksun commented Apr 27, 2017

I didn't mean that there's support to fall back on PathCombineW if PathCchCombineEx returns E_NOTIMPL. I was just guessing at what the stub in Wine might be doing. I took a look at the source. It seems the Wine stub function for unimplemented functions is __wine_spec_unimplemented_stub in dlls/winecrt0/stub.c, which calls RaiseException.

I think this issue should be closed as 3rd party since I don't see anything wrong with Steve's code, but I'll leave it open for Steve to make that decision.

@bitdancer
Copy link
Member

Indeed, it sounds like wine is claiming to be Windows 7 but then implementing (as not implemented) later-than-windows-7 apis. That definitely sounds like a bug in wine.

@zooba
Copy link
Member

zooba commented Apr 27, 2017

The approach I used is the correct way to use the function if it's available. If Wine is not supporting this function, it should return NULL from GetProcAddress, not a stub. If the function exists, any error it returns is fatal.

We need the better function for Win10 in order to support paths longer than 260 characters. PathcombineW fails on long paths.

@zooba zooba closed this as completed Apr 27, 2017
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants