René's URL Explorer Experiment


Title: gh-106242: Fix path truncation in normpath by finnagin · Pull Request #106816 · python/cpython · GitHub

Open Graph Title: gh-106242: Fix path truncation in normpath by finnagin · Pull Request #106816 · python/cpython

X Title: gh-106242: Fix path truncation in normpath by finnagin · Pull Request #106816 · python/cpython

Description: Following the suggestion from this 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 in os__path_normpath_impl to pass the above mentioned length into PyUnicode_FromWideChar instead 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_file in test_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 error ValueError: embedded null character so I changed the test to use 'abc<>$$**:://def' instead. Issue: gh-106242

Open Graph Description: Following the suggestion from this 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 ...

X Description: Following the suggestion from this 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 ...

Opengraph URL: https://github.com/python/cpython/pull/106816

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b6cfa20a-3faa-4a8e-5435-e6b2afb54f9c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE294:5592:1BB58A0:24F2DAF:6A5D45D5
html-safe-nonce06a8dd743e62d2b17c6bf0fae70961127753886229dca1663ff35cfb960ab126
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjk0OjU1OTI6MUJCNThBMDoyNEYyREFGOjZBNUQ0NUQ1IiwidmlzaXRvcl9pZCI6Ijc4NDg4OTAzNzY4NzA3NzQyMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaceb8f371cfb90730249d1772d0b637953802f1a2cddb69e56bd7388a36d455ced
hovercard-subject-tagpull_request:1436415030
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/106816/files
twitter:imagehttps://avatars.githubusercontent.com/u/20198864?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/20198864?s=400&v=4
og:image:altFollowing the suggestion from this 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 ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/106816/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F106816%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F106816%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/106816/files
Reloadhttps://github.com/python/cpython/pull/106816/files
Reloadhttps://github.com/python/cpython/pull/106816/files
Please reload this pagehttps://github.com/python/cpython/pull/106816/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/106816/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.4k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
zoobahttps://github.com/zooba
python:mainhttps://github.com/python/cpython/tree/main
finnagin:106242https://github.com/finnagin/cpython/tree/106242
Conversation 21 https://github.com/python/cpython/pull/106816
Commits 27 https://github.com/python/cpython/pull/106816/commits
Checks 0 https://github.com/python/cpython/pull/106816/checks
Files changed https://github.com/python/cpython/pull/106816/files
Please reload this pagehttps://github.com/python/cpython/pull/106816/files
gh-106242: Fix path truncation in normpath https://github.com/python/cpython/pull/106816/files#top
Show all changes 27 commits https://github.com/python/cpython/pull/106816/files
d1fe8fa added _Py_normpathAndSize finnagin Jul 3, 2023 https://github.com/python/cpython/pull/106816/commits/d1fe8fade29a3bf60a2b57af83f18e94f1fd5b48
726da04 Merge remote-tracking branch 'upstream/main' into 106242 finnagin Jul 3, 2023 https://github.com/python/cpython/pull/106816/commits/726da048d4c8bbdcf332fe43d6c41a232337b66f
8cab42c PyAPI_FUNC -> extern finnagin Jul 5, 2023 https://github.com/python/cpython/pull/106816/commits/8cab42c5cca34c5c272e9f0dd7704a6b9a580eac
82a9d36 remove prinfs finnagin Jul 5, 2023 https://github.com/python/cpython/pull/106816/commits/82a9d360a248a26dff340113db5a3b40407ed7ed
6c18bf8 fix length calculation finnagin Jul 5, 2023 https://github.com/python/cpython/pull/106816/commits/6c18bf8d10b8688c05ab2c0b98e4a5b8e116f91a
c90249d length -> norm_size, fix begining null char case finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/c90249de10d3ccbc6ff6f788130a4187f20ff546
8e1f1ea fix norm_size calculation finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/8e1f1ea5456fd2c1796346d9dd45c1dc68000fb2
3003891 add test cases finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/30038913b66a89a42cd2348a9bfd080b2c36913d
2fcae77 Merge remote-tracking branch 'upstream/main' into 106242 finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/2fcae775becb29040fe8ee0f7e8712da6d75df9b
30fa3a4 move tests to test_genericpath.py finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/30fa3a40c3325f2050434169465bc96793f91e17
f0afe44 handle edge cases finnagin Jul 6, 2023 https://github.com/python/cpython/pull/106816/commits/f0afe44906c9a2dce62e580480fa349a0c6ed71a
6412901 decrement p2 when == minp2 & update minp2 handling with leading ./ finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/641290104d332aa29e18866233bf612a3dffdce1
78192de change test case to no longer include null character finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/78192de7abce32052a44068b24bda53dadf91ec5
199abac Merge remote-tracking branch 'upstream/main' into 106242 finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/199abac9b1bd6737df6b7d202ffdbf50728a9c50
cbe57c4 Merge branch 'python:main' into 106242 finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/cbe57c47f71063ffc3926d0a91fd6191c78cd224
4b9de2c Add norm_size variable description, add normpath description finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/4b9de2cacb35d55aef4cbbdb6a34e364cf583aaf
f1731f1 update normpathAndSize description finnagin Jul 13, 2023 https://github.com/python/cpython/pull/106816/commits/f1731f1f093a951d587cfbacba71c2b405141480
d7f7045 norm_size->normsize finnagin Jul 16, 2023 https://github.com/python/cpython/pull/106816/commits/d7f70457dc51973ffb47dd653c0c221085f00ca0
184fde9 Merge remote-tracking branch 'upstream/main' into 106242 finnagin Jul 16, 2023 https://github.com/python/cpython/pull/106816/commits/184fde9a960af02ab702a9f8be23bd91f4c9e266
9e0d52a remove trailing whitespace finnagin Jul 16, 2023 https://github.com/python/cpython/pull/106816/commits/9e0d52a25182691497a0522b5402574ad811bd5b
3815967 Merge remote-tracking branch 'upstream/main' into 106242 finnagin Jul 16, 2023 https://github.com/python/cpython/pull/106816/commits/38159671a256908eafb6a7c06e3f4dabbb4cbe5a
d9d78cc Merge branch 'python:main' into 106242 finnagin Jul 16, 2023 https://github.com/python/cpython/pull/106816/commits/d9d78cc2071ee4d161e81fe217ff5600b35fcc13
3ef9e3b _Py_normpathAndSize -> _Py_normpath_and_size finnagin Jul 17, 2023 https://github.com/python/cpython/pull/106816/commits/3ef9e3b1e12f316fd5b04f536486db882d19149b
c885d13 revert test_addpackage_import_bad_pth_file change finnagin Jul 17, 2023 https://github.com/python/cpython/pull/106816/commits/c885d13975ec9fefdb2ae34d5ea63184cd28ea87
d896d45 merge upstream/main, fix merge conflicts finnagin Aug 14, 2023 https://github.com/python/cpython/pull/106816/commits/d896d45a540a420e5082a073030917b510f83f5b
0959e2b 📜🤖 Added by blurb_it. blurb-it[bot] Aug 14, 2023 https://github.com/python/cpython/pull/106816/commits/0959e2b56e2814afe7e630275e1ab2fdf56809d4
aecae84 Update Misc/NEWS.d/next/Library/2023-08-14-23-11-11.gh-issue-106242.7… finnagin Aug 14, 2023 https://github.com/python/cpython/pull/106816/commits/aecae846fff0a15585178d61cdc44cae1b91bb76
Clear filters https://github.com/python/cpython/pull/106816/files
Please reload this pagehttps://github.com/python/cpython/pull/106816/files
Please reload this pagehttps://github.com/python/cpython/pull/106816/files
pycore_fileutils.h https://github.com/python/cpython/pull/106816/files#diff-b419a047f587ec3afef8493e19dbfc142624bf278f3298bfc74729abd89e311d
test_genericpath.py https://github.com/python/cpython/pull/106816/files#diff-daabfa1f7a578479d9ba61864808dca470581ecbae838c850734a033f851b2fb
2023-08-14-23-11-11.gh-issue-106242.71HMym.rst https://github.com/python/cpython/pull/106816/files#diff-ed2531b10f63a282c32ce95449c31c8cf03f6d634658a899e5e25bdd5cc03438
posixmodule.c https://github.com/python/cpython/pull/106816/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
fileutils.c https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
Include/internal/pycore_fileutils.hhttps://github.com/python/cpython/pull/106816/files#diff-b419a047f587ec3afef8493e19dbfc142624bf278f3298bfc74729abd89e311d
View file https://github.com/finnagin/cpython/blob/aecae846fff0a15585178d61cdc44cae1b91bb76/Include/internal/pycore_fileutils.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106816/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106816/files#diff-b419a047f587ec3afef8493e19dbfc142624bf278f3298bfc74729abd89e311d
https://github.com/python/cpython/pull/106816/files#diff-b419a047f587ec3afef8493e19dbfc142624bf278f3298bfc74729abd89e311d
Lib/test/test_genericpath.pyhttps://github.com/python/cpython/pull/106816/files#diff-daabfa1f7a578479d9ba61864808dca470581ecbae838c850734a033f851b2fb
View file https://github.com/finnagin/cpython/blob/aecae846fff0a15585178d61cdc44cae1b91bb76/Lib/test/test_genericpath.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106816/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106816/files#diff-daabfa1f7a578479d9ba61864808dca470581ecbae838c850734a033f851b2fb
https://github.com/python/cpython/pull/106816/files#diff-daabfa1f7a578479d9ba61864808dca470581ecbae838c850734a033f851b2fb
Misc/NEWS.d/next/Library/2023-08-14-23-11-11.gh-issue-106242.71HMym.rsthttps://github.com/python/cpython/pull/106816/files#diff-ed2531b10f63a282c32ce95449c31c8cf03f6d634658a899e5e25bdd5cc03438
View file https://github.com/finnagin/cpython/blob/aecae846fff0a15585178d61cdc44cae1b91bb76/Misc/NEWS.d/next/Library/2023-08-14-23-11-11.gh-issue-106242.71HMym.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106816/{{ revealButtonHref }}
Modules/posixmodule.chttps://github.com/python/cpython/pull/106816/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
View file https://github.com/finnagin/cpython/blob/aecae846fff0a15585178d61cdc44cae1b91bb76/Modules/posixmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106816/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106816/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/106816/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
Python/fileutils.chttps://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
View file https://github.com/finnagin/cpython/blob/aecae846fff0a15585178d61cdc44cae1b91bb76/Python/fileutils.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106816/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com/python/cpython/pull/106816/files#diff-27e9033ac552bd8208213a2d5a0a294312e3918cd81c4da822ab32c382e392c4
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.