Snap fails to build with "Bad Variable Name"
Metadata
Current evaluation
Fixed invalid Go plugin environment handling in merged PR canonical/snapcraft#161, resolving the Bad Variable Name build failure.
Resolution: closed resolved
Reason: Merged PR canonical/snapcraft#161, recorded as commit 62dc469ca, corrected the Go plugin's environment quoting and fixed the build failure. The issue was marked fixed in master after the patch was confirmed.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Trying to build a snap with several different parts using different plugins (go, copy, x-plainbox-provider), snapcraft assemble fails with the following:
tmp/tmpod0y7lbt: 5: export: -L/home/cwayne/Projects/factory-diag-exp/snap/usr/lib: bad variable name
Traceback (most recent call last):
File "/usr/local/bin/snapcraft", line 4, in <module>
__import__('pkg_resources').run_script('snapcraft==0.5', 'snapcraft')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 735, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1652, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/EGG-INFO/scripts/snapcraft", line 33, in <module>
snapcraft.main.main()
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/main.py", line 144, in main
args.func(args)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 95, in assemble
snap(args)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 88, in snap
meta.create(config.data, arches)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/meta.py", line 61, in create
_write_package_yaml(meta_dir, config_data, arches)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/meta.py", line 72, in _write_package_yaml
package_yaml = _compose_package_yaml(meta_dir, config_data, arches)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/meta.py", line 144, in _compose_package_yaml
binaries = _wrap_binaries(binaries)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/meta.py", line 245, in _wrap_binaries
execwrap = _wrap_exe(execparts[0])
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/meta.py", line 227, in _wrap_exe
common.run(['/bin/sh', tempf.name], cwd=snap_dir)
File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/common.py", line 50, in run
subprocess.check_call(['/bin/sh', f.name] + cmd, **kwargs)
File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/sh', '/tmp/tmpy9r5h2dw', '/bin/sh', '/tmp/tmpod0y7lbt']' returned non-zero exit status 2
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed invalid Go plugin environment handling in merged PR canonical/snapcraft#161, resolving the Bad Variable Name build failure. | |
| stealth/space-bunny-alpha | — | closed resolved | Build failed with "export: -L...: bad variable name" when binary wrappers expanded go plugin's unquoted CGO_LDFLAGS. Root-caused by ~jocave and fixed by PR #161 (ubuntu-core/snapcraft), merged to master in Jan 2016. | |
| stealth/space-bunny-alpha | — | closed stale | Snapcraft 0.5's wrapper build failure was closed without a fix, comment, or version reference after 3,888 days of inactivity. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments. Likely abandoned or superseded by newer snapcraft versions. The v0.5 binary wrapping logic causing the export error is obsolete. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The snapcraft build failure caused by an invalid export variable name during binary wrapping was abandoned with no comments or fix provided. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. The report details a snapcraft 0.5 build failure triggered by a shell export error during binary wrapping. With zero comments and no activity, the issue was abandoned. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#161
(confidence 100%)
The merged PR addressed invalid Go plugin environment handling and was cited as the fix in the issue discussion.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1553215 Some go env variable makes snapcraft build failing | snapcraft (launchpad) | closed | Fixed by merged canonical/snapcraft#859 (commit e44e634f6), which set GOBIN in the Go plugin build environment so binaries install within Snapcraft parts. |