Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 867031 - sys-apps/portage: PORTAGE_SCHEDULING_POLICY with pypy causes crash
Summary: sys-apps/portage: PORTAGE_SCHEDULING_POLICY with pypy causes crash
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 889328
Blocks:
  Show dependency tree
 
Reported: 2022-08-28 00:40 UTC by John Helmert III
Modified: 2023-01-15 22:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-08-28 00:40:50 UTC
After adding "PORTAGE_SCHEDULING_POLICY=idle" to make.conf, running emerge with pypy always crashes:

# emerge --info
Traceback (most recent call last):
  File "/usr/lib/python-exec/pypy3/emerge", line 60, in <module>
    retval = emerge_main()
  File "/usr/lib/pypy3.9/site-packages/_emerge/main.py", line 1294, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib/pypy3.9/site-packages/_emerge/actions.py", line 3511, in run_action
    apply_priorities(emerge_config.target_config.settings)
  File "/usr/lib/pypy3.9/site-packages/_emerge/actions.py", line 3057, in apply_priorities
    set_scheduling_policy(settings)
  File "/usr/lib/pypy3.9/site-packages/_emerge/actions.py", line 3108, in set_scheduling_policy
    "idle": os.SCHED_IDLE,
  File "/usr/lib/pypy3.9/site-packages/portage/__init__.py", line 328, in __getattribute__
    result = getattr(object.__getattribute__(self, "_mod"), attr)
AttributeError: module 'os' has no attribute 'SCHED_IDLE'

Prepending EPYTHON=python3.10 to the emerge command line fixes this.
Comment 1 Piotr Karbowski (RETIRED) gentoo-dev 2022-09-08 13:30:35 UTC
A valid report, after discussing with Floppym I will prepare a fix with static numbers of scheduling policies rather than os.XXX int objects that are missing in pypy.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-09-08 13:55:12 UTC
Would be nice to report this to pypy upstream (https://foss.heptapod.net/pypy/pypy).  They're very nice and I think they wouldn't have a problem adding the missing constants.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-12 10:39:58 UTC
Ping
Comment 4 Piotr Karbowski (RETIRED) gentoo-dev 2023-01-12 11:40:59 UTC
Pong.

Will prepare pull request this weekend. The fix will be to remove the os.NAME and use the int IDs from header, since python does not interface at all the SCHED_DEADLINE (sched 6).

Unless comments arrive, this is the kind of PR I will create.
Comment 5 Larry the Git Cow gentoo-dev 2023-01-14 21:05:12 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=7dfa05c4446d1d2290d4ba61520a8f6ee9e57332

commit 7dfa05c4446d1d2290d4ba61520a8f6ee9e57332
Author:     KARBOWSKI Piotr <slashbeast@gentoo.org>
AuthorDate: 2023-01-14 20:13:40 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-01-14 21:02:21 +0000

    SCHEDULING_POLICY: switch to scheduler policy IDs rather than aliases.
    
    The os.SCHED_* aliases are not reliable enough, the mainline Python lacks
    deadline, and the pypy lacks them all together. The IDs are not going to
    change, at most new would arrive, so it is safe to use it as is.
    
    By extension, the deadline policy was also added, since those originally
    were not present in aliases.
    
    Bug: https://bugs.gentoo.org/867031
    Closes: https://github.com/gentoo/portage/pull/976
    Signed-off-by: KARBOWSKI Piotr <slashbeast@gentoo.org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 cnf/make.conf.example  | 12 ++++++------
 lib/_emerge/actions.py | 12 +++++++-----
 man/make.conf.5        | 16 ++++++++--------
 3 files changed, 21 insertions(+), 19 deletions(-)
Comment 6 Larry the Git Cow gentoo-dev 2023-01-15 22:13:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e342b1cae0ba19e35d27fe523ce0331e1412e295

commit e342b1cae0ba19e35d27fe523ce0331e1412e295
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-15 22:13:26 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-15 22:13:26 +0000

    sys-apps/portage: add 3.0.44
    
    Closes: https://bugs.gentoo.org/889328
    Closes: https://bugs.gentoo.org/607696
    Closes: https://bugs.gentoo.org/867031
    Closes: https://bugs.gentoo.org/873202
    Closes: https://bugs.gentoo.org/888543
    Closes: https://bugs.gentoo.org/834038
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.44.ebuild | 288 +++++++++++++++++++++++++++++++++
 2 files changed, 289 insertions(+)