← Back to issue list

zipfile.BadZipFile: File is not a zip file raises an exception

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1809852
Type
issue
State
open
Author
~timhirrel
Labels
Created
Updated
Closed

Current evaluation

Snapcraft 2.43.1 crash during pull: zipfile.BadZipFile when a source file is not a valid zip. No maintainer interaction for ~7.5 years; the old internal/sources code path no longer exists in current snapcraft.

Suggested action: close stale

Reason: The traceback points to snapcraft/internal/sources/_zip.py in version 2.43.1 (Dec 2018), but the current repo layout has no internal/ directory at all — the lifecycle was rewritten around craft-parts, so the affected code path and version no longer exist. With 0 comments, no labels, and no maintainer activity in ~7.5 years, the issue is both inactive and no longer applicable to the current codebase; the underlying cause (user pointing source: at a non-zip file) would surface differently today.

Impact: 20 Quick Win: 16.0 Staleness: 92 Complexity: 20 Confidence: 70 Support Request: 30

Issue body

Sorry, an error occurred in Snapcraft: We would appreciate it if you created a bug report at https://launchpad.net/snapcraft/+filebug with the above text included. Traceback (most recent call last): File "/usr/bin/snapcraft", line 9, in <module> load_entry_point('snapcraft==2.43.1', 'console_scripts', 'snapcraft')() File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 70, in pull _execute(steps.PULL, parts, **kwargs) File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 35, in _execute lifecycle.execute(step, project_config, parts) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute executor.run(step, part_names) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 194, in run self._handle_step(part_names, part, step, current_step, cli_config) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 208, in _handle_step getattr(self, "_run_{}".format(current_step.name))(part) File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 250, in _run_pull self._run_step(step=steps.PULL, part=part, progress="Pulling") File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 327, in _run_step getattr(part, step.name)() File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 415, in pull self._runner.pull() File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 83, in pull "override-pull", self._override_pull_scriptlet, self._sourcedir File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 162, in _run_scriptlet scriptlet_name, function_call.strip() File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 218, in _handle_builtin_function function(**function_args) File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 434, in _do_pull self.source_handler.pull() File "/usr/lib/python3/dist-packages/snapcraft/internal/sources/_base.py", line 106, in pull self.provision(self.source_dir, src=source_file, clean_target=False) File "/usr/lib/python3/dist-packages/snapcraft/internal/sources/_zip.py", line 66, in provision with zipfile.ZipFile(zip, "r") as f: File "/usr/lib/python3.5/zipfile.py", line 1026, in __init__ self._RealGetContents() File "/usr/lib/python3.5/zipfile.py", line 1093, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file Build failed Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 230, in run self.pull() File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 195, in pull env=env) File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 75, in run_build_command return self.backend.run(args, env=full_env, **kwargs) File "/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py", line 460, in run subprocess.check_call(cmd, **kwargs) File "/usr/lib/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '['lxc', 'exec', 'lp-xenial-s390x', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build_url": "https://launchpad.net/~build.snapcraft.io/+snap/055b5e89fe72240b622b24b0d1829724-xenial/+build/415579"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/tdhcad && linux64 snapcraft pull']' returned non-zero exit status 1 [27/Dec/2018:02:07:53 +0000] "CONNECT github.com:443 HTTP/1.0" 200 17715 "-" "-" Revoking proxy token... RUN: /usr/share/launchpad-buildd/slavebin/in-target scan-for-processes --backend=lxd --series=xenial --arch=s390x SNAPBUILD-415579 Scanning for processes to kill in build SNAPBUILD-415579

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 20
Quick Win: 16.0
Staleness: 92
Complexity: 20
Confidence: 70
Support Request: 30
close stale Snapcraft 2.43.1 crash during pull: zipfile.BadZipFile when a source file is not a valid zip. No maintainer interaction for ~7.5 years; the old internal/sources code path no longer exists in current snapcraft.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 15
Confidence: 90
Support Request: 5
close stale Crash in Snapcraft 2.43.1 during pull step due to zipfile.BadZipFile. No comments or maintainer interaction for over 7 years. Likely resolved in newer versions.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 20
Confidence: 90
Support Request: 75
close stale Raw Snapcraft 2.43.1 traceback showing zipfile.BadZipFile during pull. No comments, labels, or maintainer interaction. Open since 2018 with no reproduction steps.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 25
Confidence: 90
Support Request: 15
close stale Unhandled zipfile.BadZipFile exception during snapcraft pull when processing a malformed source archive. Issue is from 2018, unlabelled, and lacks maintainer engagement.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 25
Confidence: 90
Support Request: 45
close stale Snapcraft throws zipfile.BadZipFile during the pull step when handling invalid source archives. Open, zero comments, no labels, and inactive for over seven years. Requires triage and reproduction steps.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1822197 File "/snap/snapcraft/2650/legacy_snapcraft/bin/snapcraft", line 11, in <module> load_entry_point('snapcraft==2.43.1', 'console_scripts', 'snapcraft')() File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 187, in prime _execute(steps.PRIME, parts, **kwargs) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 98, in _execute lifecycle.execute(step, project_config, parts) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute executor.run(step, part_names) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 194, in run self._handle_step(part_names, part, step, current_step, cli_config) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 208, in _handle_step getattr(self, "_run_{}".format(current_step.name))(part) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 250, in _run_pull self._run_step(step=steps.PULL, part=part, progress="Pulling") File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 327, in _run_step getattr(part, step.name)() File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 413, in pull self._runner.pull() File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 83, in pull "override-pull", self._override_pull_scriptlet, self._sourcedir File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 162, in _run_scriptlet scriptlet_name, function_call.strip() File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 218, in _handle_builtin_function function(**function_args) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 432, in _do_pull self.source_handler.pull() File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/sources/_base.py", line 106, in pull self.provision(self.source_dir, src=source_file, clean_target=False) File "/snap/snapcraft/2650/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/sources/_zip.py", line 66, in provision with zipfile.ZipFile(zip, "r") as f: File "/snap/snapcraft/2650/legacy_snapcraft/usr/lib/python3.5/zipfile.py", line 1026, in __init__ self._RealGetContents() File "/snap/snapcraft/2650/legacy_snapcraft/usr/lib/python3.5/zipfile.py", line 1093, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file We would appreciate it if you created a bug report at https://launchpad.net/snapcraft/+filebug with the above text included. snapcraft (launchpad) open User reports BadZipFile error when snapcraft tries to pull a source file. No maintainer response, 7+ years old.
74%