Open Bug 1301903 Opened 9 years ago Updated 3 years ago

bootstrap.py shouldn't use "sudo brew install" on OS X

Categories

(Firefox Build System :: Bootstrap Configuration, defect)

x86_64
macOS
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: andrewtrapani, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0 Build ID: 20160604131506 Steps to reproduce: From the instructions here, step 1 is to run bootstrap.py https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Mac_OS_X_Prerequisites On the OS X terminal in OS X 10.11.4: curl https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py > bootstrap.py The error occurs when running bootstrap and attempting to install some program: python bootstrap.py Also tried sudo python bootstrap.py, but that shouldn't be used and it didn't work. Version information: brew --version Homebrew 0.9.5 (git revision 9e90; last commit 2016-01-03) OS X 10.11.4 Actual results: WARNING: Improper use of the sudo command could lead to data loss or the deletion of important system files. Please double-check your typing when using sudo. Type "man sudo" for more information. To proceed, enter your password, or type Ctrl-C to abort. Password: Please choose the version of Firefox you want to build: 1. Firefox for Desktop Artifact Mode 2. Firefox for Desktop 3. Firefox for Android Artifact Mode 4. Firefox for Android Note on Artifact Mode: Firefox for Desktop and Android supports a fast build mode called artifact mode. Artifact mode downloads pre-built C++ components rather than building them locally, trading bandwidth for time. Artifact builds will be useful to many developers who are not working with compiled code. If you want to work on look-and-feel of Firefox, you want "Firefox for Desktop Artifact Mode". Similarly, if you want to work on the look-and-feel of Firefox for Android, you want "Firefox for Android Artifact Mode". To work on the Gecko technology platform, you would need to opt to full, non-artifact mode. Gecko is Mozilla's web rendering engine, similar to Edge, Blink, and WebKit. Gecko is implemented in C++ and JavaScript. If you want to work on web rendering, you want "Firefox for Desktop", or "Firefox for Android". If you don't know what you want, start with just Artifact Mode of the desired platform. Your builds will be much shorter than if you build Gecko as well. But don't worry! You can always switch configurations later. You can learn more about Artifact mode builds at https://developer.mozilla.org/en-US/docs/Artifact_builds. Your choice: 2 Looks like you have Homebrew installed. We will install all required packages via Homebrew. We are now installing all required packages via Homebrew. You will see a lot of output as packages are built. Error: Cowardly refusing to `sudo brew install` You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. Traceback (most recent call last): File "bootstrap.py", line 170, in <module> sys.exit(main(sys.argv)) File "bootstrap.py", line 161, in main dasboot.bootstrap() File "/tmp/tmpbD_LmU/mozboot/bootstrap.py", line 225, in bootstrap File "/tmp/tmpbD_LmU/mozboot/osx.py", line 188, in install_system_packages File "/tmp/tmpbD_LmU/mozboot/osx.py", line 324, in ensure_homebrew_system_packages File "/tmp/tmpbD_LmU/mozboot/osx.py", line 302, in _ensure_homebrew_packages File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '[u'/usr/local/bin/brew', u'install', u'mercurial']' returned non-zero exit status 1 ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Try out the failed command manually: sudo brew install mercurial Error: Cowardly refusing to `sudo brew install` You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. Expected results: It should not use sudo to run "brew install [app name]": brew install mercurial ==> Downloading https://homebrew.bintray.com/bottles/mercurial-3.6.2.el_capitan.bottle.tar.gz ######################################################################## 100.0% ==> Pouring mercurial-3.6.2.el_capitan.bottle.tar.gz ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completion has been installed to: /usr/local/share/zsh/site-functions Python modules have been installed and Homebrew's site-packages is not in your Python sys.path, so you will not be able to import the modules this formula installed. If you plan to develop with these modules, please run: mkdir -p /Users/user.name/Library/Python/2.7/lib/python/site-packages echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/user.name/Library/Python/2.7/lib/python/site-packages/homebrew.pth ==> Summary
Component: Untriaged → General
Product: Firefox → Developer Services
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
I only have insight to my local version of OS X and homebrew, so it may be something has changed recently on brew disallowing "sudo brew" explicitly.
Component: General → Build Config
Product: Developer Services → Core
There's more with attempting to install mercurial After I installed mercurial manually to version 3.9.1, I ran python bootstrap.py again and it complained about an old version of mercurial being installed (3.6.2) even though brew just installed 3.9.1: Your version of Mercurial (3.6.2) is not modern enough. (Older versions of Mercurial have known security vulnerabilities. Unless you are running a patched Mercurial version, you may be vulnerable. Traceback (most recent call last): File "bootstrap.py", line 170, in <module> sys.exit(main(sys.argv)) File "bootstrap.py", line 161, in main dasboot.bootstrap() File "/var/folders/8f/hgjns3s15hl29cb0d1b3b_8r0000gn/T/tmpJzhG9q/mozboot/bootstrap.py", line 230, in bootstrap File "/var/folders/8f/hgjns3s15hl29cb0d1b3b_8r0000gn/T/tmpJzhG9q/mozboot/base.py", line 372, in ensure_mercurial_modern File "/var/folders/8f/hgjns3s15hl29cb0d1b3b_8r0000gn/T/tmpJzhG9q/mozboot/osx.py", line 571, in upgrade_mercurial File "/var/folders/8f/hgjns3s15hl29cb0d1b3b_8r0000gn/T/tmpJzhG9q/mozboot/osx.py", line 561, in _upgrade_package File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[u'/usr/local/bin/brew', u'-v', u'upgrade', u'mercurial']' returned non-zero exit status 1 The command it tried to run manually entered results in an error, as expected: brew -v upgrade mercurial Error: mercurial 3.9.1 already installed Error: Kernel.exit
Can't edit my comments, so here is the final bit. Since the above fails, bootstrap.py cannot continue. Here is the terminal output on mercurial version: hg --version Mercurial Distributed SCM (version 3.9.1) (see https://mercurial-scm.org for more information) Copyright (C) 2005-2016 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The bootstrapper doesn't do `sudo brew` but if you `sudo bootstrap.py` that will cause `brew` to run as root and homebrew will complain. The Mercurial problems are possibly also related to running bootstrap.py as root. The room for improvement here is bootstrap.py failing fast if it is run as uid=0, at least on OS X.
Product: Core → Firefox Build System
Component: General → Bootstrap Configuration
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.