Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
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 our terms of service and privacy 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
finnagin commented Jul 17, 2023 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
zooba left a comment
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.
zooba commented Aug 14, 2023
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 Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
…1HMym.rst Co-authored-by: Steve Dower <steve.dower@microsoft.com>
miss-islington commented Aug 15, 2023
miss-islington commented Aug 15, 2023
miss-islington commented Aug 15, 2023
Sorry, @finnagin and @zooba, I could not cleanly backport this to |
miss-islington commented Aug 15, 2023
Sorry, @finnagin and @zooba, I could not cleanly backport this to |
bedevere-bot commented Aug 15, 2023
GH-107981 is a backport of this pull request to the 3.12 branch. |
bedevere-bot commented Aug 15, 2023
GH-107982 is a backport of this pull request to the 3.11 branch. |
Following the suggestion from this 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.