Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 736334 - sys-apps/portage: sqlite cache module is not fork-safe
Summary: sys-apps/portage: sqlite cache module is not fork-safe
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Repoman (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 448462 733180
  Show dependency tree
 
Reported: 2020-08-08 01:23 UTC by Zac Medico
Modified: 2020-09-18 19:09 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 2020-08-08 01:23:22 UTC
For the purposes of parallel repoman (bug 448462), cache modules like sqlite will need support for fork safety. In a forked process, it's not even safe to call sqlite3_close() on a file descriptor that was opened in a parent process:

https://www.sqlite.org/howtocorrupt.html
Comment 2 Larry the Git Cow gentoo-dev 2020-08-09 03:02:01 UTC
The bug has been referenced in the following commit(s):

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

commit d4f212def0dcba58e8a146daf8da7b481491de39
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-08-08 01:00:50 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-08-09 02:41:43 +0000

    sqlite: fork safety (bug 736334)
    
    Use a separate connection instance for each pid, since
    it is not safe to use a connection created in a parent
    process.
    
    See: https://www.sqlite.org/howtocorrupt.html
    Bug: https://bugs.gentoo.org/736334
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/cache/sqlite.py           |  9 +++++----
 lib/portage/tests/dbapi/test_auxdb.py | 38 ++++++++++++++++++++++++++++++-----
 2 files changed, 38 insertions(+), 9 deletions(-)
Comment 3 Larry the Git Cow gentoo-dev 2020-08-09 06:28:01 UTC
The bug has been referenced in the following commit(s):

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

commit 5c2610ab321d23a1f1d70cc7a550225c1213dbfa
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-08-09 06:21:51 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-08-09 06:24:00 +0000

    sys-apps/portage: Bump to version 3.0.2
    
     #711174 Identified and fixed some FEATURES=compress-build-logs
             corruption issues
     #734990 Fix sync-rcu to recover from removed sync-rcu-store-dir
     #735626 Add example postsync hook to call egencache
             --update-pkg-desc-index
     #736334 Add fork safety to sqlite cache module
    
    Bug: https://bugs.gentoo.org/733180
    Bug: https://bugs.gentoo.org/711174
    Bug: https://bugs.gentoo.org/734990
    Bug: https://bugs.gentoo.org/735626
    Bug: https://bugs.gentoo.org/736334
    Package-Manager: Portage-3.0.2, Repoman-2.3.23
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest             |   1 +
 sys-apps/portage/portage-3.0.2.ebuild | 263 ++++++++++++++++++++++++++++++++++
 2 files changed, 264 insertions(+)