Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use FindFirstFile in ntpath.realpath() when access is denied #82367

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

Closed
zooba opened this issue Sep 16, 2019 · 3 comments
Closed

Use FindFirstFile in ntpath.realpath() when access is denied #82367

zooba opened this issue Sep 16, 2019 · 3 comments

Comments

@zooba
Copy link
Member

zooba commented Sep 16, 2019

BPO 38186
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba

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 = None
created_at = <Date 2019-09-16.12:53:56.807>
labels = ['3.8', '3.9', 'OS-windows']
title = 'Use FindFirstFile in ntpath.realpath() when access is denied'
updated_at = <Date 2019-09-16.12:56:41.984>
user = 'https://github.com/zooba'

bugs.python.org fields:

activity = <Date 2019-09-16.12:56:41.984>
actor = 'steve.dower'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Windows']
creation = <Date 2019-09-16.12:53:56.807>
creator = 'steve.dower'
dependencies = []
files = []
hgrepos = []
issue_num = 38186
keywords = []
message_count = 2.0
messages = ['352543', '352544']
nosy_count = 5.0
nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue38186'
versions = ['Python 3.8', 'Python 3.9']

Linked PRs

@zooba
Copy link
Member Author

zooba commented Sep 16, 2019

There remains a case in ntpath.realpath() where a (handled) ERROR_ACCESS_DENIED or ERROR_SHARING_VIOLATION will break out of traversing a series of paths.

However, in this case (in os.stat(), for example), we could request the real name of the file from the directory using FindFirstFileW. This would correct the case and remove any path shortening (e.g. LONGFI~1 to LongFilename) without needing to directly access the file.

@zooba zooba added 3.8 (EOL) end of life 3.9 only security fixes OS-windows labels Sep 16, 2019
@zooba
Copy link
Member Author

zooba commented Sep 16, 2019

See bpo-38081 and PR 16156 for related discussion and changes.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
moonsikpark added a commit to moonsikpark/cpython that referenced this issue Oct 3, 2023
@zware zware removed 3.9 only security fixes 3.8 (EOL) end of life labels Oct 3, 2023
moonsikpark added a commit to moonsikpark/cpython that referenced this issue Oct 4, 2023
…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
moonsikpark added a commit to moonsikpark/cpython that referenced this issue Oct 4, 2023
…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
moonsikpark added a commit to moonsikpark/cpython that referenced this issue Oct 5, 2023
…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
zware pushed a commit that referenced this issue Oct 5, 2023
…0298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
@zware
Copy link
Member

zware commented Oct 5, 2023

Completed by @moonsikpark in GH-110298. Thanks, Moonsik!

@zware zware closed this as completed Oct 5, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…ythonGH-110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants