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

bpo-27827: pathlib: identify a greater range of reserved filename on Windows. #26698

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Jun 12, 2021

pathlib.PureWindowsPath.is_reserved() now identifies as reserved filenames with trailing spaces or colons.

All credit to Eryk Sun for this patch.

https://bugs.python.org/issue27827

`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-Authored-By: Eryk Sun <eryksun@gmail.com>
# path processing. Thus relative paths are not resolved and slash is not
# translated to backslash. It has the native NT path limit of 32767
# characters, but a bit less after resolving device symbolic links,
# such as '\??\C:' => '\Device\HarddiskVolume2'.
Copy link

Choose a reason for hiding this comment

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

Do those in-memory symlinks really detract from the limit?
I.e. is a new full path really formed,
or just the remaining part is passed to the FS driver?

@ambv ambv added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jul 28, 2021
@ambv ambv merged commit 56c1f6d into python:main Jul 28, 2021
@miss-islington
Copy link
Contributor

Thanks @barneygale for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2021
…ythonGH-26698)

`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-authored-by: Barney Gale <barney.gale@foundry.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
(cherry picked from commit 56c1f6d)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
@bedevere-bot
Copy link

GH-27421 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 28, 2021
@bedevere-bot
Copy link

GH-27422 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2021
…ythonGH-26698)

`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-authored-by: Barney Gale <barney.gale@foundry.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
(cherry picked from commit 56c1f6d)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jul 28, 2021
ambv pushed a commit that referenced this pull request Jul 28, 2021
…H-26698) (GH-27421)

`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-authored-by: Barney Gale <barney.gale@foundry.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
(cherry picked from commit 56c1f6d)
ambv pushed a commit that referenced this pull request Jul 28, 2021
…H-26698) (#27422)

`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-authored-by: Barney Gale <barney.gale@foundry.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
(cherry picked from commit 56c1f6d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants