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

pathlib.PurePath.with_name() rejects names with NTFS alternate data streams; accepts '.' #110488

Closed
barneygale opened this issue Oct 6, 2023 · 2 comments
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes topic-pathlib type-bug An unexpected behavior, bug, or error

Comments

@barneygale
Copy link
Contributor

barneygale commented Oct 6, 2023

Bug report

This shouldn't raise an exception:

>>> pathlib.PureWindowsPath('foo', 'a').with_name('a:b')
ValueError: Invalid name 'a:b'

(affects all versions of pathlib)

This should raise an exception:

>>> pathlib.PurePath('foo', 'a').with_name('.')
PurePosixPath('foo/.')

(affects 3.12 and up)

Linked PRs

@barneygale barneygale added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 bugs and security fixes topic-pathlib 3.13 bugs and security fixes labels Oct 6, 2023
@barneygale
Copy link
Contributor Author

Removing the 3.11 tag as pathlib in Python 3.11 doesn't properly support NTFS alternate data streams, see #80486.

@barneygale barneygale removed the 3.11 only security fixes label Oct 10, 2023
barneygale added a commit to barneygale/cpython that referenced this issue Oct 10, 2023
Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`.
barneygale added a commit that referenced this issue Oct 11, 2023
…10651)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`.
barneygale added a commit to barneygale/cpython that referenced this issue Oct 11, 2023
…)` (python#110651)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`.

(cherry picked from commit b5f7777)
barneygale added a commit to barneygale/cpython that referenced this issue Oct 11, 2023
…h_name()` (pythonGH-110651)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`..
(cherry picked from commit b5f7777)

Co-authored-by: Barney Gale <[email protected]>
barneygale added a commit to barneygale/cpython that referenced this issue Oct 11, 2023
…h_name()` (pythonGH-110651)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`..
(cherry picked from commit b5f7777)

Co-authored-by: Barney Gale <[email protected]>
barneygale added a commit that referenced this issue Oct 11, 2023
…()` (GH-110651) (#110678)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`.

(cherry picked from commit b5f7777)
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…)` (python#110651)

Ensure that `PurePath('foo/a').with_name('.')` raises `ValueError`

Ensure that `PureWindowsPath('foo/a').with_name('a:b')` does not raise
`ValueError`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes topic-pathlib type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant