René's URL Explorer Experiment


Title: `TarFile.extractall` seeks backwards · Issue #106980 · python/cpython · GitHub

Open Graph Title: `TarFile.extractall` seeks backwards · Issue #106980 · python/cpython

X Title: `TarFile.extractall` seeks backwards · Issue #106980 · python/cpython

Description: Bug report Using tarfile.TarFile.extractall on a compressed tarball opened in a streaming mode, like r|bz2, results in a tarfile.StreamError: Traceback (most recent call last): File "C:\\git.py", line 22, in install tar.extract...

Open Graph Description: Bug report Using tarfile.TarFile.extractall on a compressed tarball opened in a streaming mode, like r|bz2, results in a tarfile.StreamError: Traceback (most recent call last): File "C:\\...

X Description: Bug report Using tarfile.TarFile.extractall on a compressed tarball opened in a streaming mode, like r|bz2, results in a tarfile.StreamError: Traceback (most recent call last): File "C:\<re...

Opengraph URL: https://github.com/python/cpython/issues/106980

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`TarFile.extractall` seeks backwards","articleBody":"# Bug report\r\n\r\nUsing `tarfile.TarFile.extractall` on a compressed tarball opened in a streaming mode, like `r|bz2`, results in a `tarfile.StreamError`:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"C:\\\u003credacted>\\git.py\", line 22, in install\r\n    tar.extractall(_PATH_TO_GIT_FOR_WINDOWS)\r\n  File \"tarfile.py\", line 2257, in extractall\r\n  File \"tarfile.py\", line 2320, in _extract_one\r\n  File \"tarfile.py\", line 2403, in _extract_member\r\n  File \"tarfile.py\", line 2446, in makefile\r\n  File \"tarfile.py\", line 520, in seek\r\ntarfile.StreamError: seeking backwards is not allowed\r\n```\r\n\r\nI would expect this to work as the seeks should only ever move forward past headers and never backwards: read a header, create the file/directory, and repeat.\r\n\r\n## Background\r\n\r\nI have a little script that shims calls to `git`. If it can't find `git` in the path, it downloads a portal version of Git for Windows and uses that. Conveniently, Git for Windows distributes bzip2 compressed tarballs, which can be decompressed and extracted with a few short lines. However, doing so in streaming mode (`r|bz2`) results in a `tarfile.StreamError`.\r\n\r\n## Repro\r\n\r\nHere's a minimal script that reproduces the error.\r\n\r\n```py\r\nimport urllib.request\r\nimport tarfile\r\n\r\nurl = \"https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/Git-2.41.0-64-bit.tar.bz2\"\r\n\r\nwith urllib.request.urlopen(url) as response:\r\n  with tarfile.open(fileobj=response, mode='r|bz2') as tar:\r\n    tar.extractall(\"git-for-windows\")\r\n```\r\n\r\nAs a workaround, I currently download the tarball to a temporary file and extract from there.\r\n\r\n# Your environment\r\n\r\nI'm running into this on Windows 10, Version 10.0.19045 Build 19045, using a portable installation of Python.\r\n\r\n```\r\nPython 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32\r\n```","author":{"url":"https://github.com/mtwilliams","@type":"Person","name":"mtwilliams"},"datePublished":"2023-07-21T22:52:27Z","url":"https://github.com/python/cpython/issues/106980"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ff4fed33-9a92-a1d7-48bc-c8790dd5f86d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCA32:97D39:D2D9EB:1167295:6B01FCF5
html-safe-nonceb71ef2a7d8f48f6bc95683317c4a4a3c070d5e69f981ae701af91acaf3e87aac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTMyOjk3RDM5OkQyRDlFQjoxMTY3Mjk1OjZCMDFGQ0Y1IiwidmlzaXRvcl9pZCI6IjQzOTA1MzYxMzQ0OTQ3NzM2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2f25313d790f8e0fbf0e66ee5950f01cb50d82a0063804aa6a0623faa0584e2e
hovercard-subject-tagissue:1816458453
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/python/cpython/106980/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3df759ff0c06ce4ac704c5295d647bff4ec942e5590a1d1594534db9f381afd6/python/cpython/issues/106980
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3df759ff0c06ce4ac704c5295d647bff4ec942e5590a1d1594534db9f381afd6/python/cpython/issues/106980
og:image:altBug report Using tarfile.TarFile.extractall on a compressed tarball opened in a streaming mode, like r|bz2, results in a tarfile.StreamError: Traceback (most recent call last): File "C:\\...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemtwilliams
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/106980#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F106980
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F106980
Sign uphttps://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=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/106980
Reloadhttps://github.com/python/cpython/issues/106980
Reloadhttps://github.com/python/cpython/issues/106980
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/106980
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/106980
TarFile.extractall seeks backwardshttps://github.com/python/cpython/issues/106980#top
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/mtwilliams
mtwilliamshttps://github.com/mtwilliams
on Jul 21, 2023https://github.com/python/cpython/issues/106980#issue-1816458453
mtwilliamshttps://github.com/mtwilliams
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jul 21, 2023https://github.com/python/cpython/issues/106980#event-9889426062
https://github.com/encukou
encukouhttps://github.com/encukou
on Aug 10, 2023https://github.com/python/cpython/issues/106980#issuecomment-1672900377
https://github.com/encukou
encukouhttps://github.com/encukou
on Aug 10, 2023https://github.com/python/cpython/issues/106980#issuecomment-1672940977
https://github.com/mtwilliams
mtwilliamshttps://github.com/mtwilliams
on Aug 20, 2023https://github.com/python/cpython/issues/106980#issuecomment-1685193486
NTFS supports hard (and soft) links.https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createhardlinka
serhiy-storchakahttps://github.com/serhiy-storchaka
Tarfile issues 🗄️https://github.com/orgs/python/projects/11
on Sep 10, 2023https://github.com/python/cpython/issues/106980#event-14892286570
iritkatrielhttps://github.com/iritkatriel
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Nov 26, 2023https://github.com/python/cpython/issues/106980#event-11063927833
sidlovescodinghttps://github.com/sidlovescoding
on Nov 11, 2026https://github.com/python/cpython/issues/106980#event-35747202352
pythongh-106980: Give a clear error for link fallback in tarfile streamshttps://github.com/sidlovescoding/Cpython/commit/92972f537767ffe3f0a5b1fcbdd96fb6f7fca872
pythongh-106980https://github.com/python/cpython/issues/106980
92972f5https://github.com/sidlovescoding/Cpython/commit/92972f537767ffe3f0a5b1fcbdd96fb6f7fca872
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/106980
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/106980
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Tarfile issues 🗄️https://github.com/orgs/python/projects/11
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.