Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this 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
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Looks like we just need the NEWS entry - click "Details" next to the failed check for info on it (or run Text should be something like ``Fixes :func: |
Misc/NEWS.d/next/Library/2023-08-14-23-11-11.gh-issue-106242.71HMym.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…1HMym.rstCo-authored-by: Steve Dower <steve.dower@microsoft.com>
Sorry,@finnagin and@zooba, I could not cleanly backport this to |
Sorry,@finnagin and@zooba, I could not cleanly backport this to |
bedevere-bot commentedAug 15, 2023
GH-107981 is a backport of this pull request to the3.12 branch. |
bedevere-bot commentedAug 15, 2023
GH-107982 is a backport of this pull request to the3.11 branch. |
Uh oh!
There was an error while loading.Please reload this page.
Following the suggestion fromthis comment in the original issue this PR adds a new function
_Py_normpathAndSizewhich behaves like_Py_normpathbut 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_implto pass the above mentioned length intoPyUnicode_FromWideCharinstead of -1.Additionally, this adds a test to check that normpath is not truncating paths containing a null character as well as changes
test_addpackage_import_bad_pth_fileintest_site.pywhich 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 characterso I changed the test to use'abc<>$$**:://def'instead.