Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828999 - www-client/firefox-95, 96, 97: Will fail to build if build host has installed dev-python/pip and at least one broken but unrelated Python package.
Summary: www-client/firefox-95, 96, 97: Will fail to build if build host has installed...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2021-12-12 14:08 UTC by Piotr Karbowski (RETIRED)
Modified: 2022-02-10 17:09 UTC (History)
8 users (show)

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


Attachments
Disable pip check at configure (c001-disable-pip-check.patch,568 bytes, patch)
2021-12-12 19:38 UTC, Fabio Scaccabarozzi
Details | Diff
ffx.patch (ffx.patch,466 bytes, patch)
2021-12-14 11:12 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Karbowski (RETIRED) gentoo-dev 2021-12-12 14:08:25 UTC
This was first reported in https://bugs.gentoo.org/828604 but then shifted onto another package and the actual issue was marked as non-issue.

The Firefox's 'mach' script have check that if 'pip' module is installed, it will run 'pip check' and fail the build if any Python package installed on system have problem with dependencies.

This check does not make much of sense since for once, it does go around unrelated packages, dev-python/pip is not even dependency of firefox ending on the fact that the state of unrelated package on build system must not have any effect on the actual build. This is a QA issue.

While I can agree that if any Python package have broken dependencies those needs to be solved, by no means I'd agree that firefox does not needs to be fixed.

The whole 'pip' logic should be patched out of the build system.
Comment 1 Piotr Karbowski (RETIRED) gentoo-dev 2021-12-12 14:10:05 UTC
The related failure log:

Traceback (most recent call last):
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/./mach", line 167, in <module>
    main(sys.argv[1:])
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/./mach", line 159, in main
    mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/./mach", line 146, in check_and_get_mach
    return load_mach(dir_path, mach_path)
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/./mach", line 134, in load_mach
    return mach_initialize.initialize(dir_path)
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/build/mach_initialize.py", line 291, in initialize
    _activate_python_environment(topsrcdir)
  File "/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0/build/mach_initialize.py", line 233, in _activate_python_environment
    raise Exception(
Exception: According to "pip check", the current Python environment has package-compatibility issues.
 * ERROR: www-client/firefox-95.0::gentoo failed (configure phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 127:  Called src_configure
 *   environment, line 5560:  Called die
 * The specific snippet of code:
 *       ./mach configure || die
 *
 * If you need support, post the output of `emerge --info '=www-client/firefox-95.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/firefox-95.0::gentoo'`.
 * The complete build log is located at '/var/portage/tmp/portage/www-client/firefox-95.0/temp/build.log'.
 * The ebuild environment file is located at '/var/portage/tmp/portage/www-client/firefox-95.0/temp/environment'.
 * Working directory: '/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0'
 * S: '/var/portage/tmp/portage/www-client/firefox-95.0/work/firefox-95.0'
 *
 * The following package has failed to build, install, or execute postinst:
 *
 *  (www-client/firefox-95.0:0/95::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/portage/tmp/portage/www-client/firefox-95.0/temp/build.log'
 *
Comment 2 Fabio Scaccabarozzi 2021-12-12 19:38:30 UTC
Created attachment 758715 [details, diff]
Disable pip check at configure

Dropping the patch in /etc/portage/patches allows to compile Firefox 95.
The patch turns the `if has_pip:` into `if False:`, letting the logic fallback to default behavior of a system without pip.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-12-14 11:12:35 UTC
Created attachment 758913 [details, diff]
ffx.patch

I'd do something like this instead, to kill the first invocation of pip already.
Comment 4 Piotr Karbowski (RETIRED) gentoo-dev 2021-12-15 12:32:36 UTC
@mozilla team any comment from you?
Comment 5 Joonas Niilola gentoo-dev 2021-12-15 17:12:10 UTC
I've yet to reproduce this personally.... I see upstream has done a lot of pip-related work for 96, some may hold an "upstream-approved" patch. 

I'd like to reproduce this and check if (some) upstream patch works better, since they're going to land in 96. However, just a reminder for everyone, you can utilize /etc/portage/patches with the provided patches in here.
Comment 6 Harris Landgarten 2021-12-15 17:45:58 UTC
I hit this bug during the boost-1.78 rebuilds. After the long rebuilds finished, I emerged firefox and the pip issue disappeared
Comment 7 Piotr Karbowski (RETIRED) gentoo-dev 2021-12-15 18:00:44 UTC
It is irrelevant what kind of work upstream does around pip. It is a QA violation to have a build process acting in different way depending on configuration or installation of other, unrelated packages on the build host.

Asking users to use eapply_user because the in-tree ebuild does not follow QA regulations is not something that I'd expect here.
Comment 8 Joonas Niilola gentoo-dev 2021-12-16 18:00:10 UTC
Can someone throw me some pip commands to break "pip check" so I can test a fix, or can someone with broken pip deps try exporting:
  MOZ_AUTOMATION=0
before building firefox-95?


(In reply to Piotr Karbowski from comment #7)
> It is irrelevant what kind of work upstream does around pip. 

Even if they fix the issue, which btw was reported 3 months ago?

> 
> Asking users to use eapply_user because the in-tree ebuild does not follow
> QA regulations is not something that I'd expect here.

It was just a note to get past this while it's being worked on, definitely not a permanent solution. I'd also not like to carry this patch into each release, so prefer to have it sorted by upstream. 

Firefox-95.0.1 is out and I'd like to get steps to reproduce this, so we can see if it's already fixed upstream, or do we need to do something for the 95.0.1 ebuild. Patch will obviously be included for that one if nothing else worked.
Comment 9 Joonas Niilola gentoo-dev 2021-12-16 18:21:24 UTC
(In reply to Joonas Niilola from comment #8)
>   MOZ_AUTOMATION=0
> before building firefox-95?

Well that doesn't seem to work out even for me.

> 
> Firefox-95.0.1 is out and I'd like to get steps to reproduce this, so we can
> see if it's already fixed upstream, or do we need to do something for the
> 95.0.1 ebuild. Patch will obviously be included for that one if nothing else
> worked.

Aaand unfortunately it looks like the pip work is done to 96 as I said before... Still I'd like to reproduce and check it for *sure*.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-16 21:09:52 UTC
You need to install something with dependencies inconsistent with e.g its requirements.txt. pysnmp may work.
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-12-16 21:21:13 UTC
First (adjust for your Python version used for build):

$ find /usr/lib/python3.10 -name requires.txt

Take a random file, open it, add frobnicate on top and:

$ python3.10 -m pip check
django 4.0 requires frobnicate, which is not installed.

(note: i'm just saying how to break "pip check", I haven't tested it against the Firefox ebuild)
Comment 12 Joonas Niilola gentoo-dev 2021-12-17 09:06:50 UTC
^ Worked perfectly, thanks! Never used pip in my life before.
Comment 13 Larry the Git Cow gentoo-dev 2021-12-17 09:06:57 UTC
The bug has been closed via the following commit(s):

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

commit 9b9c3e8c24ff1f44f62ddb98f5fb93d3eab323fa
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2021-12-17 08:47:50 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2021-12-17 09:06:49 +0000

    www-client/firefox: add 95.0.1
    
     - include a patch from mgorny to disable fatal pip invocation in
       case pip is found, and "pip check" fails sanity check.
    
    Closes: https://bugs.gentoo.org/828999
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest                        |   98 ++
 .../firefox-95-fix-fatal-pip-invocation.patch      |   13 +
 www-client/firefox/firefox-95.0.1.ebuild           | 1240 ++++++++++++++++++++
 3 files changed, 1351 insertions(+)
Comment 14 Piotr Karbowski (RETIRED) gentoo-dev 2022-01-11 21:43:22 UTC
The www-client/firefox-96.0 again fails on the 'pip check'. Why was this change not carried over to new firefox?
Comment 15 Larry the Git Cow gentoo-dev 2022-01-12 07:20:59 UTC
The bug has been closed via the following commit(s):

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

commit eadb5bdabd2b3c9b629a3fae492999ce7287cc72
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2022-01-12 07:18:26 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-01-12 07:20:53 +0000

    www-client/firefox: fix fatal pip check invocation in 96.0
    
    Closes: https://bugs.gentoo.org/828999
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/firefox-96.0.ebuild | 1 +
 1 file changed, 1 insertion(+)
Comment 16 Joonas Niilola gentoo-dev 2022-01-12 07:23:25 UTC
I see what happened here. Both me and whissi hosted the patchset with identical name, but doing "repoman manifest" in the gentoo dev repo first downloaded whissi's which didn't include updated patch (since mozilla moved the check to another file). However whissi found a better way to deal with it with a simple env variable, that doesn't need patching. This is what we asked from mozilla, but they didn't link the commit to that bug.
Comment 17 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-01-12 08:03:42 UTC
This sounds like a pretty dysfunctional team to me.
Comment 18 Piotr Karbowski (RETIRED) gentoo-dev 2022-02-09 22:49:10 UTC
www-client/firefox-97.0: fails again.

Guys, this is 3rd major Firefox update that is again failing on the same thing. I am really done with it, I will join mozilla project and fix it myself this and every next time.
Comment 19 Larry the Git Cow gentoo-dev 2022-02-09 23:21:10 UTC
The bug has been closed via the following commit(s):

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

commit 2ecd527b97c3966044d4828ac44cfcbc882ad789
Author:     Piotr Karbowski <slashbeast@gentoo.org>
AuthorDate: 2022-02-09 23:19:27 +0000
Commit:     Piotr Karbowski <slashbeast@gentoo.org>
CommitDate: 2022-02-09 23:20:33 +0000

    www-client/firefox: 97.0: stub pip check.
    
    Closes: https://bugs.gentoo.org/828999
    Signed-off-by: Piotr Karbowski <slashbeast@gentoo.org>

 www-client/firefox/files/firefox-skip-pip-check.patch | 14 ++++++++++++++
 www-client/firefox/firefox-97.0.ebuild                |  3 +++
 2 files changed, 17 insertions(+)
Comment 20 Joonas Niilola gentoo-dev 2022-02-10 05:52:39 UTC
(In reply to Piotr Karbowski from comment #18)
> www-client/firefox-97.0: fails again.
> 
> Guys, this is 3rd major Firefox update that is again failing on the same
> thing. I am really done with it, I will join mozilla project and fix it
> myself this and every next time.

Thanks, help is more than welcome! I don't personally even use rapid release so am really glad if someone else wants to bump it. 

I don't think the patch approach is the best in the longterm *if* the alternative works, because the patch needs to be rewritten for each release (not that it's a huge patch). Can you try the method suggested here first? 
https://bugs.gentoo.org/832975#c14

Just FYI, as you can see from that bug, my pip check is busted but Firefox-97.0 still builds fine.
Comment 21 Larry the Git Cow gentoo-dev 2022-02-10 17:09:58 UTC
The bug has been referenced in the following commit(s):

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

commit 87e4d048cf7c2c53963be2a7224791c8a28218a3
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2022-02-10 17:01:12 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-02-10 17:09:08 +0000

    www-client/firefox: 97.0 fixes
    
     - also export the 2nd MACH_SYSTEM_ASSERTED_COMPATIBLE variable,
     - disable sandbox feature with ppc64, as it's currently only
       supported for amd64, arm, arm64 and x86,
     - include the skip-pip-check.patch in the full patch set.
    
    Bug: https://bugs.gentoo.org/832975
    Bug: https://bugs.gentoo.org/828999
    Closes: https://bugs.gentoo.org/833001
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest                           |  2 +-
 www-client/firefox/files/firefox-skip-pip-check.patch | 14 --------------
 www-client/firefox/firefox-97.0.ebuild                | 16 +++++++++++-----
 3 files changed, 12 insertions(+), 20 deletions(-)