Error: 'Section' object has no attribute 'iter_versions'

Bug #1862318 reported by Alfonso Sanchez-Beato
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Low
Chris Patterson

Bug Description

I have seen this error happening while priming a part (3.9.9 and 3.9.8):

$ snapcraft
Skipping pull xwayland-kiosk-helper (already ran)
Skipping pull app-ui (already ran)
Skipping pull dump (already ran)
Skipping pull gnome-extension (already ran)
Skipping pull gstreamer (already ran)
Skipping pull station-daemons (already ran)
Skipping build xwayland-kiosk-helper (already ran)
Skipping build app-ui (already ran)
Skipping build dump (already ran)
Skipping build gnome-extension (already ran)
Skipping build gstreamer (already ran)
Skipping build station-daemons (already ran)
Skipping stage xwayland-kiosk-helper (already ran)
Skipping stage app-ui (already ran)
Skipping stage dump (already ran)
Skipping stage gnome-extension (already ran)
Skipping stage gstreamer (already ran)
Skipping stage station-daemons (already ran)
Skipping prime xwayland-kiosk-helper (already ran)
Skipping prime app-ui (already ran)
Skipping prime dump (already ran)
Skipping prime gnome-extension (already ran)
Skipping prime gstreamer (already ran)
Priming station-daemons
Sorry, an error occurred in Snapcraft:
'Section' object has no attribute 'iter_versions'
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]:
You can find the traceback in file '/tmp/tmpg30vmjhn/trace.txt'.

Trace is:

Traceback (most recent call last):
  File "/snap/snapcraft/4007/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==3.9.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/cli/_runner.py", line 109, in run
    snap_command.invoke(ctx)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 87, in invoke
    return super().invoke(ctx)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 261, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 66, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 132, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 186, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 200, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 275, in _run_prime
    self._run_step(step=steps.PRIME, part=part, progress="Priming")
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 319, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 798, in prime
    self._do_runner_step(steps.PRIME)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 245, in _do_runner_step
    return getattr(self._runner, "{}".format(step.name))()
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 91, in prime
    "override-prime", self._override_prime_scriptlet, self._primedir
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 137, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 193, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 810, in _do_prime
    dependency_paths = self._handle_elf(snap_files)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 817, in _handle_elf
    elf_files = elf.get_elf_files(self.primedir, snap_files)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/elf.py", line 618, in get_elf_files
    elf_file = ElfFile(path=path)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/elf.py", line 264, in __init__
    elf_data = self._extract(path)
  File "/snap/snapcraft/4007/lib/python3.6/site-packages/snapcraft/internal/elf.py", line 319, in _extract
    for library, versions in verneed_section.iter_versions():
AttributeError: 'Section' object has no attribute 'iter_versions'

It smells to me like an issue while stripping elf binaries of debug symbols. The binary does not use glibc, but musl, so maybe it is a bit special.

description: updated
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

$ readelf --version-info <mybinary>

does not find version information in .gnu.version_r, although the section exists.

Chris Patterson (cjp256)
Changed in snapcraft:
assignee: nobody → Chris Patterson (cjp256)
Revision history for this message
Chris Patterson (cjp256) wrote :

Hey Alfonso, would you be able to share a test case to reproduce? I'm not having any luck. But there is a bug there, and I think this ought to fix it (though there may be some side effects in your case by ignoring the needed, perhaps failing to catch a set of missing dependencies):

https://github.com/snapcore/snapcraft/pull/291

Changed in snapcraft:
status: New → In Progress
Revision history for this message
Chris Patterson (cjp256) wrote :

The PR link I botched above:
https://github.com/snapcore/snapcraft/pull/2918

The snapcraft `edge` channel will treat this error as a warning.
To switch: `sudo snap refresh snapcraft --channel=edge`.

The PR above will address the error, but snapcraft will log a different warning:
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft: - libc.musl-x86_64.so.1

There a a couple of reasons for this (triggered by the unusual use of musl). I'm going to create a new bug report to track that separately.

Changed in snapcraft:
status: In Progress → Fix Committed
importance: Undecided → Low
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.