← 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

Open report that Snapcraft 2.43.1 fails during pull when a declared ZIP is malformed; current craft-parts tests still expect BadZipFile, and no source/config or desired behavior is provided.

Suggested action: close not a bug

Reason: The traceback reaches zipfile.ZipFile while opening the declared archive, and craft-parts' test_source_zip_error explicitly writes "not a zip file" and asserts BadZipFile. Because the report provides no archive URL, snapcraft.yaml, expected alternative behavior, or maintainer discussion, this is malformed-input handling rather than a demonstrated Snapcraft defect.

Evaluated by: mr-cal-bot

Impact: 30 Quick Win: 6 Complexity: 30 Confidence: 82 Actionability: 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
stealth/space-bunny-alpha
Impact: 30
Quick Win: 6
Complexity: 30
Confidence: 82
Actionability: 30
close not a bug Open report that Snapcraft 2.43.1 fails during pull when a declared ZIP is malformed; current craft-parts tests still expect BadZipFile, and no source/config or desired behavior is provided.
stealth/space-bunny-alpha
Impact: 25
Quick Win: 9
Complexity: 20
Confidence: 62
Actionability: 45
needs triage Zip source handler raises raw zipfile.BadZipFile traceback when a .zip file is invalid (e.g. truncated/HTML proxy response); wants a friendly error. No comments, no triage.
qwen/qwen3.6-35b-a3b
Impact: 5
Quick Win: 2
Complexity: 10
Confidence: 85
Actionability: 50
close not a bug 2018 issue reporting zipfile.BadZipFile exception when snapcraft 2.43.1 encounters an invalid zip source file. The code path no longer exists in the refactored codebase.
qwen/qwen3.8-27b
Impact: 20
Quick Win: 16
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.

Update history

Date Change
created

Related issues

No related issues found above the similarity threshold.