Skip to content

WIP: bpo-36021: WindowsDefault does not execute os.startfile() for a local file#11931

Closed
matrixise wants to merge 8 commits intopython:masterfrom
matrixise:bpo-36021
Closed

WIP: bpo-36021: WindowsDefault does not execute os.startfile() for a local file#11931
matrixise wants to merge 8 commits intopython:masterfrom
matrixise:bpo-36021

Conversation

@matrixise
Copy link
Copy Markdown
Member

@matrixise matrixise commented Feb 19, 2019

@matrixise matrixise changed the title bpo-36021: WindowsDefault does not execute os.startfile() for a local file WIP: bpo-36021: WindowsDefault does not execute os.startfile() for a local file Feb 19, 2019
@JulienPalard
Copy link
Copy Markdown
Member

Have you tried to implement three cases instead of two:

  • file://
  • whitelisted schemes
  • other cases

It may make the intention more readable, by removing - set(['file', '']) and if parsed_url.scheme == 'file'.

?

Also I'm not sure about the behavior of os.access(path, os.X_OK) in windows. Do os.startfile executes a .exe file that is not marked X_OK? (Not a Windows user here).

@matrixise
Copy link
Copy Markdown
Member Author

@JulienPalard
file:// is already tested with file:///tmp/test.txt
for the whitelisted schemes, you have an example with https://

about os.access(path, os.X_OK), after a small check on a Windows VM, it's not portable :/ I use an other solution in my last commit (I read the binary file and read the two first bytes == b'MZ')

@matrixise
Copy link
Copy Markdown
Member Author

ok, I have a whitelist and I allow the HTML files with WebBrowser.WindowsDefault()

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that it's a proper fix. I propose to discuss at https://bugs.python.org/issue36021

@bedevere-bot
Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@JulienPalard
Copy link
Copy Markdown
Member

JulienPalard commented Feb 19, 2019

LGTM, is it still WIP?

@matrixise
Copy link
Copy Markdown
Member Author

@JulienPalard yep, still WIP because we have a discussion about the solution on the bug tracker.

@matrixise
Copy link
Copy Markdown
Member Author

There is a discussion on https://bugs.python.org/issue36021 but no real solution. I prefer to close this PR and wait for a consensus. Thank you for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants