← Back to issue list

sources can't extract tar.xz archive

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1573753
Type
issue
State
open
Author
~olivier-interfasys
Labels
stacktrace
Created
Updated
Closed
—

Current evaluation

Tar source extraction failed with KeyError on linkname not found; cause was hardlink targets keeping the stripped common prefix. Fixed in snapcraft commit 9b240efe3 (PR #688), logic now lives in craft-parts tar_source.py with hardlink tests.

Suggested action: close resolved

Reason: The reporter's own follow-up identified the real cause ('Seems to be sym/hardlink related', pointing at CPython's _find_link_target), which matches the traceback: tar.extractall stripped the 'transmission-2.92/' prefix from member names but not from hardlink linknames, so _find_link_target raised KeyError. Commit 9b240efe3 'Strip common path prefixes from linkname as well as name when extracting a tarfile (#688)' implemented exactly that, and the code now lives in craft_parts/sources/tar_source.py::_strip_prefix with a dedicated test_strip_common_prefix_hardlink unit test, so the defect no longer reproduces.

Evaluated by: mr-cal-bot

Impact: 40 Quick Win: 26 Complexity: 25 Confidence: 86 Actionability: 85

Issue body

That's the trace from Snapcraft 2.8.4 ``` "GET /files/transmission-2.92.tar.xz HTTP/1.1" 200 3378116 Traceback (most recent call last): File "/usr/bin/snapcraft", line 31, in <module> snapcraft.main.main() File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 146, in main return run(args, project_options) File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 193, in run lifecycle.snap(project_options, args['<directory>'], args['--output']) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 240, in snap snap = execute('strip', project_options) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 82, in execute _Executor(config, project_options).run(step, part_names) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 111, in run self._run_step(step, part, part_names, dirty, recursed) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 149, in _run_step getattr(part, step)() File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler.py", line 259, in pull self.code.pull() File "/usr/lib/python3/dist-packages/snapcraft/_baseplugin.py", line 120, in pull sources.get(self.sourcedir, self.build_basedir, self.options) File "/usr/lib/python3/dist-packages/snapcraft/internal/sources.py", line 280, in get handler.pull() File "/usr/lib/python3/dist-packages/snapcraft/internal/sources.py", line 188, in pull self.provision(self.source_dir) File "/usr/lib/python3/dist-packages/snapcraft/internal/sources.py", line 212, in provision self._extract(tarball, dst) File "/usr/lib/python3/dist-packages/snapcraft/internal/sources.py", line 247, in _extract tar.extractall(members=filter_members(tar), path=dst) File "/usr/lib/python3.5/tarfile.py", line 1995, in extractall numeric_owner=numeric_owner) File "/usr/lib/python3.5/tarfile.py", line 2037, in extract numeric_owner=numeric_owner) File "/usr/lib/python3.5/tarfile.py", line 2115, in _extract_member self.makelink(tarinfo, targetpath) File "/usr/lib/python3.5/tarfile.py", line 2202, in makelink self._extract_member(self._find_link_target(tarinfo), File "/usr/lib/python3.5/tarfile.py", line 2369, in _find_link_target raise KeyError("linkname %r not found" % linkname) KeyError: "linkname 'transmission-2.92/qt/icons/Faenza/actions/scalable/small/list-remove.svg' not found" ``` But I can extract the archive just fine from the command line using the xf flags The snapcraft config ``` transmission: plugin: autotools source: https://download.transmissionbt.com/files/transmission-2.92.tar.xz source-type: tar ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 40
Quick Win: 26
Complexity: 25
Confidence: 86
Actionability: 85
close resolved Tar source extraction failed with KeyError on linkname not found; cause was hardlink targets keeping the stripped common prefix. Fixed in snapcraft commit 9b240efe3 (PR #688), logic now lives in craft-parts tar_source.py with hardlink tests.
stealth/space-bunny-alpha
Impact: 50
Quick Win: 32
Complexity: 30
Confidence: 92
Actionability: 90
close resolved Snapcraft failed to extract tarballs with hardlinks (misreported as .tar.xz): KeyError because linkname kept the stripped common prefix. Fixed by 9b240efe3 (PR #688); logic now in craft-parts tar_source.py with hardlink tests.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 2
Complexity: 40
Confidence: 60
Actionability: 10
close stale Snapcraft 2.8.4 fails to extract tar.xz archives with hardlinks due to KeyError in tarfile._find_link_target. Issue is 10 years old; old codebase no longer exists.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18
Staleness: 95
Complexity: 40
Confidence: 60
Support Request: 15
close stale Snapcraft 2.8.4 fails to extract a tar.xz source (transmission-2.92) with a KeyError on a missing symlink target during tarfile.extractall. 10+ years old, no maintainer response; traceback references code paths no longer present in the current codebase.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 30
Confidence: 95
Support Request: 10
close stale Snapcraft 2.8.4 fails to extract tar.xz archives with a KeyError during symlink resolution. Reported over 10 years ago with no maintainer response. The affected version and Python runtime are long deprecated.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 15
Confidence: 90
Support Request: 5
close stale Snapcraft 2.8.4 fails to extract tar.xz archives due to a Python tarfile KeyError. Unaddressed for over 8 years with no maintainer interaction.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 25
Confidence: 95
Support Request: 10
close stale Snapcraft 2.8.4 fails to extract a tar.xz archive due to a Python tarfile KeyError. The report is over 10 years old, references unsupported software, and has had no maintainer interaction.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#688 (confidence 92%)

    Commit 9b240efe3 'Strip common path prefixes from linkname as well as name when extracting a tarfile (#688)' is the direct fix; the logic survives in craft-parts tar_source.py with hardlink coverage.

Related issues

Issue Project State Summary Similarity
#1606700 tarball sources fail if they contain hardlinks snapcraft (launchpad) closed Hardlink extraction was fixed by snapcore/snapcraft PR #688, commit 9b240efe3, which normalizes tar link targets as well as member names.
73%