Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 584328

Summary: "AssertionError: C locale did not pass the test!" when ctypes unavailable
Product: Portage Development Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=571444
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 604854    
Attachments: Patch

Description Arfrever Frehtes Taifersar Arahesis 2016-05-27 13:32:26 UTC
Created attachment 435552 [details, diff]
Patch

Nonexistence of ctypes module is tolerated by pym/portage/util/_ctypes.py and pym/portage/util/locale.py.
portage.util.locale.check_locale() function has this documentation:
        """
        Check whether the locale is sane. Returns True if it is, prints
        warning and returns False if it is not. Returns None if the check
        can not be executed due to platform limitations.
        """

However portage.package.ebuild.config.config.environ() function treats None returned by portage.util.locale.check_locale() in the same way as False.
In situation when e.g. ctypes module is unavailable, it results in the following traceback:

Traceback (most recent call last):
  File "bin/emerge", line 50, in <module>
    retval = emerge_main()
  File "${portage_path}/pym/_emerge/main.py", line 1185, in emerge_main
    return run_action(emerge_config)
  File "${portage_path}/pym/_emerge/actions.py", line 3236, in run_action
    emerge_config.args, spinner)
  File "${portage_path}/pym/_emerge/actions.py", line 324, in action_build
    settings, trees, myopts, myparams, myaction, myfiles, spinner)
  File "${portage_path}/pym/_emerge/depgraph.py", line 9196, in backtrack_depgraph
    myaction, myfiles, spinner)
  File "${portage_path}/pym/_emerge/depgraph.py", line 9233, in _backtrack_depgraph
    success, favorites = mydepgraph.select_files(myfiles)
  File "${portage_path}/pym/_emerge/depgraph.py", line 3583, in select_files
    return self._select_files(args)
  File "${portage_path}/pym/_emerge/depgraph.py", line 3926, in _select_files
    return self._resolve(myfavorites)
  File "${portage_path}/pym/_emerge/depgraph.py", line 3990, in _resolve
    myroot, atom, onlydeps=onlydeps)
  File "${portage_path}/pym/_emerge/depgraph.py", line 5324, in _select_pkg_highest_available
    ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps, parent=parent)
  File "${portage_path}/pym/_emerge/depgraph.py", line 5536, in _select_pkg_highest_available_imp
    root, atom, onlydeps=onlydeps, parent=parent)
  File "${portage_path}/pym/_emerge/depgraph.py", line 5832, in _wrapped_select_pkg_highest_available_imp
    onlydeps=onlydeps):
  File "${portage_path}/pym/_emerge/depgraph.py", line 5242, in _iter_match_pkgs_atom
    installed=installed, onlydeps=onlydeps, myrepo=repo)
  File "${portage_path}/pym/_emerge/depgraph.py", line 6530, in _pkg
    metadata = zip(db_keys, db.aux_get(cpv, db_keys, myrepo=myrepo))
  File "${portage_path}/pym/portage/dbapi/porttree.py", line 532, in aux_get
    proc.start()
  File "${portage_path}/pym/_emerge/AsynchronousTask.py", line 30, in start
    self._start()
  File "${portage_path}/pym/_emerge/EbuildMetadataPhase.py", line 119, in _start
    fd_pipes=fd_pipes, returnpid=True)
  File "${portage_path}/pym/portage/package/ebuild/doebuild.py", line 798, in doebuild
    fd_pipes=fd_pipes, returnpid=returnpid)
  File "${portage_path}/pym/portage/package/ebuild/doebuild.py", line 178, in _spawn_phase
    returnpid=returnpid, logfile=logfile, **kwargs)
  File "${portage_path}/pym/portage/package/ebuild/doebuild.py", line 169, in _doebuild_spawn
    return spawn(cmd, settings, **portage._native_kwargs(kwargs))
  File "${portage_path}/pym/portage/package/ebuild/doebuild.py", line 1635, in spawn
    return spawn_func(mystring, env=mysettings.environ(),
  File "${portage_path}/pym/portage/package/ebuild/config.py", line 2803, in environ
    raise AssertionError("C locale did not pass the test!")
AssertionError: C locale did not pass the test!


I attach simple patch.
Comment 2 Zac Medico gentoo-dev 2017-02-10 18:47:35 UTC
Fixed in portage-2.3.3.