Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 767913 - sys-apps/portage: call os.getpid() lazily in portage.getpid() in order to eliminate portage.process.spawn post os.fork() os.getpid()
Summary: sys-apps/portage: call os.getpid() lazily in portage.getpid() in order to el...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 766117
Blocks:
  Show dependency tree
 
Reported: 2021-01-30 01:31 UTC by Zac Medico
Modified: 2021-03-31 20:54 UTC (History)
0 users

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 Zac Medico gentoo-dev 2021-01-30 01:31:30 UTC
In portage.process.spawn it calls portage._ForkWatcher.hook(portage._ForkWatcher) after os.fork() in order to ensure that any portage.getpid() calls will work correctly (a pre_exec function could conceivably call portage.getpid()). The hook call introduces an unnecessary os.getpid() call in cases here portage.getpid() will not be called after fork. The unnecessary os.getpid() call can by avoided if we make portage.getpid() call os.getpid() lazily.
Comment 2 Larry the Git Cow gentoo-dev 2021-02-08 04:55:32 UTC
The bug has been referenced in the following commit(s):

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

commit ef43dd8ef64ded5f0627b7b8e84ef21262012902
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-01-30 12:44:19 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-02-08 04:47:20 +0000

    portage.getpid: call os.getpid() lazily
    
    Call os.getpid() lazily, which eliminates getpid calls when possible
    after os.fork() in the portage.process module.
    
    Bug: https://bugs.gentoo.org/767913
    Reviewed-by: Brian Dolbec <dolsen@gentoo.org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 3 Larry the Git Cow gentoo-dev 2021-02-22 13:54:42 UTC
The bug has been referenced in the following commit(s):

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

commit 6b98e103aa15da331d647a8f65a45bb3bb4e3197
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-02-22 13:46:04 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-02-22 13:54:29 +0000

    sys-apps/portage: Bump to version 3.0.15
    
     #715112 default enable FEATURES=binpkg-multi-instance
     #756778 content-hash distfiles layout
     #766459 emirrordist: prevent distfiles_db _pkg_str pickle problems
     #766767 emaint --fix merges: add -y, --yes option
     #766773 emerge: disable --autounmask-license by default
     #767913 portage.getpid: call os.getpid() lazily
     #770712 PopenProcess: use call_soon for _async_waipid in _start
     #771549 prevent USE="${USE} ..." misbehavior
    
    Bug: https://bugs.gentoo.org/766117
    Bug: https://bugs.gentoo.org/715112
    Bug: https://bugs.gentoo.org/756778
    Bug: https://bugs.gentoo.org/766459
    Bug: https://bugs.gentoo.org/766767
    Bug: https://bugs.gentoo.org/766773
    Bug: https://bugs.gentoo.org/767913
    Bug: https://bugs.gentoo.org/770712
    Bug: https://bugs.gentoo.org/771549
    Package-Manager: Portage-3.0.15, Repoman-3.0.2
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.15.ebuild | 268 +++++++++++++++++++++++++++++++++
 2 files changed, 269 insertions(+)