René's URL Explorer Experiment


Title: Race condition writing objects in LooseObjectDB · Issue #85 · gitpython-developers/gitdb · GitHub

Open Graph Title: Race condition writing objects in LooseObjectDB · Issue #85 · gitpython-developers/gitdb

X Title: Race condition writing objects in LooseObjectDB · Issue #85 · gitpython-developers/gitdb

Description: There's a TOCTTOU in LooseObjectDB when storing a new object, that causes storing an object to fail with FileExistsError: File "patch_tree.py", line 132, in write_tree return self.db.store(istream).binsha File ".venv/lib/python3.9/gitdb/...

Open Graph Description: There's a TOCTTOU in LooseObjectDB when storing a new object, that causes storing an object to fail with FileExistsError: File "patch_tree.py", line 132, in write_tree return self.db.store(istream)...

X Description: There's a TOCTTOU in LooseObjectDB when storing a new object, that causes storing an object to fail with FileExistsError: File "patch_tree.py", line 132, in write_tree return self.db....

Opengraph URL: https://github.com/gitpython-developers/gitdb/issues/85

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Race condition writing objects in LooseObjectDB","articleBody":"There's a TOCTTOU in LooseObjectDB when storing a new object, that causes storing an object to fail with `FileExistsError`:\r\n\r\n```\r\n   File \"patch_tree.py\", line 132, in write_tree\r\n     return self.db.store(istream).binsha\r\n   File \".venv/lib/python3.9/gitdb/db/git.py\", line 77, in store\r\n     return self._loose_db.store(istream)\r\n   File \".venv/lib/python3.9/gitdb/db/loose.py\", line 226, in store\r\n     mkdir(obj_dir)\r\nFileExistsError: [Errno 17] File exists: '/tmp/tmp.flUcclypOQ/objects/a0'\r\n```\r\n\r\n[The problem code](https://github.com/gitpython-developers/gitdb/blame/master/gitdb/db/loose.py#L225) is\r\n\r\n```python\r\n            if not isdir(obj_dir):\r\n                mkdir(obj_dir)\r\n```\r\n\r\nand what is happening is\r\n\r\n1. `isdir()` returns `False` because the directory does not exist at that moment\r\n2. The directory is created in another thread\r\n3. `mkdir()` fails with `FileExistsError`\r\n\r\nThis can be avoided by using an EAFP pattern, e.g.\r\n\r\n```python\r\nwith contextlib.suppress(FileExistsError):\r\n    mkdir(obj_dir)\r\n```","author":{"url":"https://github.com/lordmauve","@type":"Person","name":"lordmauve"},"datePublished":"2023-02-13T14:22:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/85/gitdb/issues/85"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3ae68594-3b69-9c61-e821-94b8959ad7da
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA8CC:2C5AFC:21A66C2:2FA7D98:69691690
html-safe-nonce729db2c28ebc0e002723f6091f9a1c3023f97cb0f407e4a84bf2edec64170d53
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOENDOjJDNUFGQzoyMUE2NkMyOjJGQTdEOTg6Njk2OTE2OTAiLCJ2aXNpdG9yX2lkIjoiNzgwNTc0NzM0NDQ2NzEwNTQyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac819f9956bd8c0a230675a4ce6354d55abf3a82e43fca26f719c0b15856c1393a
hovercard-subject-tagissue:1582445326
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/gitdb/85/issue_layout
twitter:imagehttps://opengraph.githubassets.com/649436857bf74f8c1c5e570aab529b9cd2bf3d61ede22c417d29588f76fcd4e7/gitpython-developers/gitdb/issues/85
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/649436857bf74f8c1c5e570aab529b9cd2bf3d61ede22c417d29588f76fcd4e7/gitpython-developers/gitdb/issues/85
og:image:altThere's a TOCTTOU in LooseObjectDB when storing a new object, that causes storing an object to fail with FileExistsError: File "patch_tree.py", line 132, in write_tree return self.db.store(istream)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelordmauve
hostnamegithub.com
expected-hostnamegithub.com
Noneafd5814870f8609d217a32dd3bccc05a5df5f5699df4d458c242e80fdfddcc2e
turbo-cache-controlno-preview
go-importgithub.com/gitpython-developers/gitdb git https://github.com/gitpython-developers/gitdb.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126093
octolytics-dimension-repository_nwogitpython-developers/gitdb
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126093
octolytics-dimension-repository_network_root_nwogitpython-developers/gitdb
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release572e69339f2401a569f15071214cbbee314ea8bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/gitdb/issues/85#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2Fgitdb%2Fissues%2F85
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2Fgitpython-developers%2Fgitdb%2Fissues%2F85
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=gitpython-developers%2Fgitdb
Reloadhttps://github.com/gitpython-developers/gitdb/issues/85
Reloadhttps://github.com/gitpython-developers/gitdb/issues/85
Reloadhttps://github.com/gitpython-developers/gitdb/issues/85
gitpython-developers https://github.com/gitpython-developers
gitdbhttps://github.com/gitpython-developers/gitdb
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Fork 68 https://github.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Star 225 https://github.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Code https://github.com/gitpython-developers/gitdb
Issues 8 https://github.com/gitpython-developers/gitdb/issues
Pull requests 0 https://github.com/gitpython-developers/gitdb/pulls
Discussions https://github.com/gitpython-developers/gitdb/discussions
Actions https://github.com/gitpython-developers/gitdb/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/gitpython-developers/gitdb/security
Please reload this pagehttps://github.com/gitpython-developers/gitdb/issues/85
Insights https://github.com/gitpython-developers/gitdb/pulse
Code https://github.com/gitpython-developers/gitdb
Issues https://github.com/gitpython-developers/gitdb/issues
Pull requests https://github.com/gitpython-developers/gitdb/pulls
Discussions https://github.com/gitpython-developers/gitdb/discussions
Actions https://github.com/gitpython-developers/gitdb/actions
Security https://github.com/gitpython-developers/gitdb/security
Insights https://github.com/gitpython-developers/gitdb/pulse
New issuehttps://github.com/login?return_to=https://github.com/gitpython-developers/gitdb/issues/85
New issuehttps://github.com/login?return_to=https://github.com/gitpython-developers/gitdb/issues/85
#91https://github.com/gitpython-developers/gitdb/pull/91
Race condition writing objects in LooseObjectDBhttps://github.com/gitpython-developers/gitdb/issues/85#top
#91https://github.com/gitpython-developers/gitdb/pull/91
acknowledgedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/lordmauve
https://github.com/lordmauve
lordmauvehttps://github.com/lordmauve
on Feb 13, 2023https://github.com/gitpython-developers/gitdb/issues/85#issue-1582445326
The problem codehttps://github.com/gitpython-developers/gitdb/blame/master/gitdb/db/loose.py#L225
acknowledgedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
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.