Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106242: Fix path truncation in normpath#106816

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zooba merged 27 commits intopython:mainfromfinnagin:106242
Aug 15, 2023
Merged

Conversation

@finnagin
Copy link
Contributor

@finnaginfinnagin commentedJul 17, 2023
edited by bedevere-bot
Loading

Following the suggestion fromthis comment in the original issue this PR adds a new function_Py_normpathAndSize which behaves like_Py_normpath but also takes a pointer which it will use to store the length of the final normalized path. This new function is then used inos__path_normpath_impl to pass the above mentioned length intoPyUnicode_FromWideChar instead of -1.

Additionally, this adds a test to check that normpath is not truncating paths containing a null character as well as changestest_addpackage_import_bad_pth_file intest_site.py which was using a null character to make a bad path, specifically it was using the string'abc\x00def'. The problem is that before this change this was being truncated for parts of the test so the string it was actually using in those parts was'abc'. Upon making the normpath changes it started throwing the errorValueError: embedded null character so I changed the test to use'abc<>$$**:://def' instead.

finnaginand others added22 commitsJuly 3, 2023 12:38
Copy link
Member

@zoobazooba left a comment

Choose a reason for hiding this comment

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

LGTM with the minor name convention update

@zooba
Copy link
Member

Looks like we just need the NEWS entry - click "Details" next to the failed check for info on it (or runPCbuild/blurb.bat to create it locally).

Text should be something like ``Fixes :func:os.normpath to handle embedded null characters without truncating the path.` and put it under Library.

…1HMym.rstCo-authored-by: Steve Dower <steve.dower@microsoft.com>
@zoobazooba merged commit0932272 intopython:mainAug 15, 2023
@zoobazooba added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsAug 15, 2023
@miss-islington
Copy link
Contributor

Thanks@finnagin for the PR, and@zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks@finnagin for the PR, and@zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry,@finnagin and@zooba, I could not cleanly backport this to3.11 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 09322724319d4c23195300b222a1c0ea720af56b 3.11

@miss-islington
Copy link
Contributor

Sorry,@finnagin and@zooba, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 09322724319d4c23195300b222a1c0ea720af56b 3.12

@bedevere-bot
Copy link

GH-107981 is a backport of this pull request to the3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelAug 15, 2023
@bedevere-bot
Copy link

GH-107982 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelAug 15, 2023
zooba pushed a commit to zooba/cpython that referenced this pull requestAug 15, 2023
zooba pushed a commit to zooba/cpython that referenced this pull requestAug 15, 2023
ambv pushed a commit that referenced this pull requestAug 15, 2023
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull requestAug 16, 2023
Yhg1s pushed a commit that referenced this pull requestAug 16, 2023
…#107981)*gh-106242: Fix path truncation in os.path.normpath (GH-106816)*gh-106242: Minor fixup to avoid compiler warnings---------Co-authored-by: Finn Womack <flan313@gmail.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@eryksuneryksuneryksun left review comments

@zoobazoobazooba approved these changes

Assignees

@zoobazooba

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@finnagin@zooba@miss-islington@bedevere-bot@eryksun

[8]ページ先頭

©2009-2025 Movatter.jp