Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non zero exit status for brew bundle after "Error: xyz already installed" #369

Closed
AlJohri opened this issue Sep 25, 2018 · 11 comments
Closed

Comments

@AlJohri
Copy link

AlJohri commented Sep 25, 2018

My brew bundle is erroring out with a non-zero exit status after "Error: xyz already installed". I thought it would return exit code 0?

screen shot 2018-09-25 at 6 19 02 pm

build: https://travis-ci.org/WPMedia/laptop/builds/433174490
script: https://github.com/WPMedia/laptop/blob/master/mac

The script has a trap defined that looks like:

trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT

and the brew bundle command looks like:

brew update
brew bundle --file=- <<EOF
.....
EOF

I saw a few other issues that were similar: #313, #258,

any ideas what's happening here?

@jacobbednarz
Copy link
Member

Looks like we're hitting

puts Formatter.error("#{verb} #{entry.name} has failed!")
and subsequently failing out at

Digging a little further in, the error message of Error: ... already installed looks to be coming from Homebrew itself which suggests it's detected the packages are already installed on the system. Have you confirmed if these three packages are already available in the CI environment? You might need to uninstall/clean the env before running this script if that's the case.

@AlJohri
Copy link
Author

AlJohri commented Sep 25, 2018

Yes, I believe these packages are preinstalled on Travis.

My understanding was that brew bundle will upgrade these packages (or silently ignore them). In either case, I think it should not return a non-zero error status.

Am I misunderstanding this?

@MikeMcQuaid
Copy link
Member

This means that this tool is already installed but not by Homebrew Cask. That is, rightfully, an error because Homebrew Cask doesn't know what version it is or if it's working.

@AlJohri
Copy link
Author

AlJohri commented Sep 26, 2018

@MikeMcQuaid Postgres, python, and pyenv are not installed through homebrew cask

@MikeMcQuaid
Copy link
Member

Sorry misread. Are they linked? What’s your brew doctor and brew outdated output?

@MikeMcQuaid MikeMcQuaid reopened this Sep 26, 2018
@AlJohri
Copy link
Author

AlJohri commented Oct 1, 2018

@MikeMcQuaid I added the output of those commands to this CI build: https://travis-ci.org/WPMedia/laptop/jobs/433491261

It failed with the same issue as before. I copied the relevant portions below:

brew doctor

notably, this also returns an exit code status of 1. I ran ran brew doctor || true to make CI push through. might make sense to return exit code status 0 unless its some fairly serious issue?

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.

brew outdated

automake (1.16.1) < 1.16.1_1
carthage (0.29.0) < 0.30.1
cgal (4.12) < 4.12.1
cmake (3.11.4) < 3.12.2
coreutils (8.29) < 8.30
freexl (1.0.5) < 1.0.5_1
gdal (2.3.0) < 2.3.1_2
gdbm (1.15) < 1.18
geos (3.6.2) < 3.6.3
giflib (5.1.4) < 5.1.4_1
git (2.18.0) < 2.19.0_1
gnupg (2.2.8) < 2.2.10
gnutls (3.5.18) < 3.5.19
go (1.10.3) < 1.11
libgpg-error (1.31) < 1.32
libpng (1.6.34) < 1.6.35
libpq (10.4) < 10.5
libssh (0.7.5) < 0.8.1
libtiff (4.0.9_3) < 4.0.9_4
libyaml (0.1.7) < 0.2.1
mercurial (4.6.1) < 4.7.1
msgpack (3.0.1) < 3.1.1
node (10.5.0_1) < 10.11.0
npth (1.5) < 1.6
numpy (1.14.5) < 1.15.1
openssl (1.0.2o_2) < 1.0.2p
openssl@1.1 (1.1.0h) < 1.1.1
p11-kit (0.23.12) < 0.23.14
postgis (2.4.4_1) < 2.5.0
postgresql (10.4) < 10.5
proj (5.1.0) < 5.2.0
pyenv (1.2.4) < 1.2.7
python (3.6.5_1) < 3.7.0
readline (7.0.3_1) < 7.0.5
sqlite (3.24.0) < 3.25.2
swiftlint (0.26.0) < 0.27.0
tmate (2.2.1_3) < 2.2.1_4

brew info

Below is the installation info for pyenv, python, and postgresql which errored out in the brew bundle output above.

brew info pyenv --json=v1

[{"name":"pyenv","full_name":"pyenv","oldname":null,"aliases":[],"versioned_formulae":[],"desc":"Python version management","homepage":"https://github.com/pyenv/pyenv","versions":{"stable":"1.2.7","devel":null,"head":"HEAD","bottle":true},"revision":0,"version_scheme":1,"bottle":{"stable":{"rebuild":0,"cellar":":any","prefix":"/usr/local","root_url":"https://homebrew.bintray.com/bottles","files":{"mojave":{"url":"https://homebrew.bintray.com/bottles/pyenv-1.2.7.mojave.bottle.tar.gz","sha256":"91995c220edec23af2798e302e3a197bee2c9a153dffb7f51e3a7308120b0a54"},"high_sierra":{"url":"https://homebrew.bintray.com/bottles/pyenv-1.2.7.high_sierra.bottle.tar.gz","sha256":"44c787de32fd6e1d17a79e6e927a20cfd175056948f0ad1bb621a6c2f06b8534"},"sierra":{"url":"https://homebrew.bintray.com/bottles/pyenv-1.2.7.sierra.bottle.tar.gz","sha256":"20c3dd22f4baa8b4557229483258d0c65bfefe8e4546c0a15a948e17ad51f315"},"el_capitan":{"url":"https://homebrew.bintray.com/bottles/pyenv-1.2.7.el_capitan.bottle.tar.gz","sha256":"86182bb87c253e24eb02a5c621e9a393c36dc9411678afb61dd934f6847237d5"}}}},"keg_only":false,"options":[],"build_dependencies":[],"dependencies":["autoconf","openssl","pkg-config","readline"],"recommended_dependencies":[],"optional_dependencies":[],"requirements":[],"conflicts_with":[],"caveats":null,"installed":[{"version":"1.2.4","used_options":[],"built_as_bottle":true,"poured_from_bottle":true,"runtime_dependencies":[{"full_name":"autoconf","version":"2.69"},{"full_name":"pkg-config","version":"0.29.2"},{"full_name":"openssl","version":"1.0.2o"},{"full_name":"readline","version":"7.0.3"}],"installed_as_dependency":false,"installed_on_request":true}],"linked_keg":"1.2.4","pinned":false,"outdated":true}]

brew info python --json=v1

[{"name":"python","full_name":"python","oldname":"python3","aliases":["python3","python@3"],"versioned_formulae":["python@2"],"desc":"Interpreted, interactive, object-oriented programming language","homepage":"https://www.python.org/","versions":{"stable":"3.7.0","devel":null,"head":"HEAD","bottle":true},"revision":0,"version_scheme":0,"bottle":{"stable":{"rebuild":5,"cellar":"/usr/local/Cellar","prefix":"/usr/local","root_url":"https://homebrew.bintray.com/bottles","files":{"mojave":{"url":"https://homebrew.bintray.com/bottles/python-3.7.0.mojave.bottle.5.tar.gz","sha256":"600501d78904da7b5cbbf0d6e42d0028be2a9f85bdeb3b97724982c6453705ab"},"high_sierra":{"url":"https://homebrew.bintray.com/bottles/python-3.7.0.high_sierra.bottle.5.tar.gz","sha256":"3d55617b68b1cb58415159b31a29193e0b8c08e3726030f756d40a65107a46ce"},"sierra":{"url":"https://homebrew.bintray.com/bottles/python-3.7.0.sierra.bottle.5.tar.gz","sha256":"5720eaec832c06608ce60bf366dfb772f7ad5b1bf869f6f4d0f62636b9194d48"},"el_capitan":{"url":"https://homebrew.bintray.com/bottles/python-3.7.0.el_capitan.bottle.5.tar.gz","sha256":"19bbe7ade52e031cbf7e2b6d0d7ebce204c51fd7fae3d675c06fffdd29cdccae"}}}},"keg_only":false,"options":[{"option":"--with-tcl-tk","description":"Use Homebrew's Tk instead of macOS Tk (has optional Cocoa and threads support)"}],"build_dependencies":["pkg-config","sphinx-doc"],"dependencies":["gdbm","openssl","readline","sqlite","xz"],"recommended_dependencies":[],"optional_dependencies":["tcl-tk"],"requirements":[],"conflicts_with":[],"caveats":"Python has been installed as\n  /usr/local/bin/python3\n\nUnversioned symlinks `python`, `python-config`, `pip` etc. pointing to\n`python3`, `python3-config`, `pip3` etc., respectively, have been installed into\n  /usr/local/opt/python/libexec/bin\n\nIf you need Homebrew's Python 2.7 run\n  brew install python@2\n\nPip, setuptools, and wheel have been installed. To update them run\n  pip3 install --upgrade pip setuptools wheel\n\nYou can install Python packages with\n  pip3 install <package>\nThey will install into the site-package directory\n  /usr/local/lib/python3.7/site-packages\n\nSee: https://docs.brew.sh/Homebrew-and-Python\n","installed":[{"version":"3.6.5_1","used_options":[],"built_as_bottle":true,"poured_from_bottle":true,"runtime_dependencies":[{"full_name":"gdbm","version":"1.15"},{"full_name":"openssl","version":"1.0.2o"},{"full_name":"readline","version":"7.0.3"},{"full_name":"sqlite","version":"3.24.0"},{"full_name":"xz","version":"5.2.4"}],"installed_as_dependency":true,"installed_on_request":false}],"linked_keg":"3.6.5_1","pinned":false,"outdated":true}]

brew info postgresql --json=v1

[{"name":"postgresql","full_name":"postgresql","oldname":null,"aliases":["postgres","postgresql@10"],"versioned_formulae":["postgresql@9.4","postgresql@9.5","postgresql@9.6"],"desc":"Object-relational database system","homepage":"https://www.postgresql.org/","versions":{"stable":"10.5","devel":null,"head":"HEAD","bottle":true},"revision":0,"version_scheme":0,"bottle":{"stable":{"rebuild":1,"cellar":"/usr/local/Cellar","prefix":"/usr/local","root_url":"https://homebrew.bintray.com/bottles","files":{"mojave":{"url":"https://homebrew.bintray.com/bottles/postgresql-10.5.mojave.bottle.1.tar.gz","sha256":"4a8a8b196a2d8eec90d8d1db38986af58427033a4819b670638e4a4113f81631"},"high_sierra":{"url":"https://homebrew.bintray.com/bottles/postgresql-10.5.high_sierra.bottle.1.tar.gz","sha256":"b41e5c816f6827ef75fa91b4ccffbe432ec2dfdf33c6757f7272c8744face3a6"},"sierra":{"url":"https://homebrew.bintray.com/bottles/postgresql-10.5.sierra.bottle.1.tar.gz","sha256":"cff481b53df41d58ac4bf5911757c36959643c0b87566bb172bd33c9b3d65d39"},"el_capitan":{"url":"https://homebrew.bintray.com/bottles/postgresql-10.5.el_capitan.bottle.1.tar.gz","sha256":"abd8104c82358d6067399b8001aec86738d2aced1a0c78cd1c9cb33b129098a5"}}}},"keg_only":false,"options":[{"option":"--without-perl","description":"Build without Perl support"},{"option":"--without-tcl","description":"Build without Tcl support"},{"option":"--with-dtrace","description":"Build with DTrace support"},{"option":"--with-python","description":"Enable PL/Python3 (incompatible with --with-python@2)"},{"option":"--with-python@2","description":"Enable PL/Python2"}],"build_dependencies":["pkg-config"],"dependencies":["icu4c","openssl","readline"],"recommended_dependencies":[],"optional_dependencies":["python","python@2"],"requirements":[],"conflicts_with":["postgres-xc"],"caveats":"To migrate existing data from a previous major version of PostgreSQL run:\n  brew postgresql-upgrade-database\n","installed":[{"version":"10.4","used_options":[],"built_as_bottle":true,"poured_from_bottle":true,"runtime_dependencies":[{"full_name":"openssl","version":"1.0.2o"},{"full_name":"readline","version":"7.0.3"}],"installed_as_dependency":false,"installed_on_request":true}],"linked_keg":"10.4","pinned":false,"outdated":true}]

@MikeMcQuaid
Copy link
Member

might make sense to return exit code status 0 unless its some fairly serious issue?

Sorry, that exit code is intentional.

What just doing the equivalent of brew upgrade pyenv output inside and outside brew bundle? Can you reproduce this on a non-Travis CI machine?

@AlJohri
Copy link
Author

AlJohri commented Oct 1, 2018

Running locally, I get:

$ brew upgrade pyenv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from dae47914c to 1f5309902.
Updated 4 taps (homebrew/cask-versions, homebrew/core, homebrew/cask, homebrew/cask-drivers).
==> New Formulae
bundletool                     geant4                         mallet                         stanford-corenlp
==> Updated Formulae
pandoc ✔            babel               faas-cli            kubernetes-cli      pixz                smlnj
rabbitmq ✔          eslint              glances             libopkele           pulumi              swiftformat
ammonite-repl       evince              grv                 libssh              quicktype           swiftgen
ansible             exiftool            ipython             opencv              rom-tools           terragrunt
==> Deleted Formulae
redis@2.8

Error: pyenv 1.2.7 already installed
$ echo "$?"
1

@MikeMcQuaid
Copy link
Member

Can I see the non-JSON brew info output for them (or can you pretty print the output)? It looks like something may be partially unlinked.

@AlJohri
Copy link
Author

AlJohri commented Nov 9, 2018

hi @MikeMcQuaid, just following up here. small update, adding:

before_script:
  - brew services restart postgresql

to the travis.yml file caused the postgres to change from:

Error: postgresql 10.5 already installed
Installing postgresql has failed!

to

Using postgresql

which is great! Now I just need this same behavior with python/pyenv.

Pretty Printed JSONs

These are the same JSONs as above, just pretty printed.

pyenv

[{
	"name": "pyenv",
	"full_name": "pyenv",
	"oldname": null,
	"aliases": [],
	"versioned_formulae": [],
	"desc": "Python version management",
	"homepage": "https://github.com/pyenv/pyenv",
	"versions": {
		"stable": "1.2.7",
		"devel": null,
		"head": "HEAD",
		"bottle": true
	},
	"revision": 0,
	"version_scheme": 1,
	"bottle": {
		"stable": {
			"rebuild": 0,
			"cellar": ":any",
			"prefix": "/usr/local",
			"root_url": "https://homebrew.bintray.com/bottles",
			"files": {
				"mojave": {
					"url": "https://homebrew.bintray.com/bottles/pyenv-1.2.7.mojave.bottle.tar.gz",
					"sha256": "91995c220edec23af2798e302e3a197bee2c9a153dffb7f51e3a7308120b0a54"
				},
				"high_sierra": {
					"url": "https://homebrew.bintray.com/bottles/pyenv-1.2.7.high_sierra.bottle.tar.gz",
					"sha256": "44c787de32fd6e1d17a79e6e927a20cfd175056948f0ad1bb621a6c2f06b8534"
				},
				"sierra": {
					"url": "https://homebrew.bintray.com/bottles/pyenv-1.2.7.sierra.bottle.tar.gz",
					"sha256": "20c3dd22f4baa8b4557229483258d0c65bfefe8e4546c0a15a948e17ad51f315"
				},
				"el_capitan": {
					"url": "https://homebrew.bintray.com/bottles/pyenv-1.2.7.el_capitan.bottle.tar.gz",
					"sha256": "86182bb87c253e24eb02a5c621e9a393c36dc9411678afb61dd934f6847237d5"
				}
			}
		}
	},
	"keg_only": false,
	"options": [],
	"build_dependencies": [],
	"dependencies": ["autoconf", "openssl", "pkg-config", "readline"],
	"recommended_dependencies": [],
	"optional_dependencies": [],
	"requirements": [],
	"conflicts_with": [],
	"caveats": null,
	"installed": [{
		"version": "1.2.4",
		"used_options": [],
		"built_as_bottle": true,
		"poured_from_bottle": true,
		"runtime_dependencies": [{
			"full_name": "autoconf",
			"version": "2.69"
		}, {
			"full_name": "pkg-config",
			"version": "0.29.2"
		}, {
			"full_name": "openssl",
			"version": "1.0.2o"
		}, {
			"full_name": "readline",
			"version": "7.0.3"
		}],
		"installed_as_dependency": false,
		"installed_on_request": true
	}],
	"linked_keg": "1.2.4",
	"pinned": false,
	"outdated": true
}]

python

[{
	"name": "python",
	"full_name": "python",
	"oldname": "python3",
	"aliases": ["python3", "python@3"],
	"versioned_formulae": ["python@2"],
	"desc": "Interpreted, interactive, object-oriented programming language",
	"homepage": "https://www.python.org/",
	"versions": {
		"stable": "3.7.0",
		"devel": null,
		"head": "HEAD",
		"bottle": true
	},
	"revision": 0,
	"version_scheme": 0,
	"bottle": {
		"stable": {
			"rebuild": 5,
			"cellar": "/usr/local/Cellar",
			"prefix": "/usr/local",
			"root_url": "https://homebrew.bintray.com/bottles",
			"files": {
				"mojave": {
					"url": "https://homebrew.bintray.com/bottles/python-3.7.0.mojave.bottle.5.tar.gz",
					"sha256": "600501d78904da7b5cbbf0d6e42d0028be2a9f85bdeb3b97724982c6453705ab"
				},
				"high_sierra": {
					"url": "https://homebrew.bintray.com/bottles/python-3.7.0.high_sierra.bottle.5.tar.gz",
					"sha256": "3d55617b68b1cb58415159b31a29193e0b8c08e3726030f756d40a65107a46ce"
				},
				"sierra": {
					"url": "https://homebrew.bintray.com/bottles/python-3.7.0.sierra.bottle.5.tar.gz",
					"sha256": "5720eaec832c06608ce60bf366dfb772f7ad5b1bf869f6f4d0f62636b9194d48"
				},
				"el_capitan": {
					"url": "https://homebrew.bintray.com/bottles/python-3.7.0.el_capitan.bottle.5.tar.gz",
					"sha256": "19bbe7ade52e031cbf7e2b6d0d7ebce204c51fd7fae3d675c06fffdd29cdccae"
				}
			}
		}
	},
	"keg_only": false,
	"options": [{
		"option": "--with-tcl-tk",
		"description": "Use Homebrew's Tk instead of macOS Tk (has optional Cocoa and threads support)"
	}],
	"build_dependencies": ["pkg-config", "sphinx-doc"],
	"dependencies": ["gdbm", "openssl", "readline", "sqlite", "xz"],
	"recommended_dependencies": [],
	"optional_dependencies": ["tcl-tk"],
	"requirements": [],
	"conflicts_with": [],
	"caveats": "Python has been installed as\n  /usr/local/bin/python3\n\nUnversioned symlinks `python`, `python-config`, `pip` etc. pointing to\n`python3`, `python3-config`, `pip3` etc., respectively, have been installed into\n  /usr/local/opt/python/libexec/bin\n\nIf you need Homebrew's Python 2.7 run\n  brew install python@2\n\nPip, setuptools, and wheel have been installed. To update them run\n  pip3 install --upgrade pip setuptools wheel\n\nYou can install Python packages with\n  pip3 install <package>\nThey will install into the site-package directory\n  /usr/local/lib/python3.7/site-packages\n\nSee: https://docs.brew.sh/Homebrew-and-Python\n",
	"installed": [{
		"version": "3.6.5_1",
		"used_options": [],
		"built_as_bottle": true,
		"poured_from_bottle": true,
		"runtime_dependencies": [{
			"full_name": "gdbm",
			"version": "1.15"
		}, {
			"full_name": "openssl",
			"version": "1.0.2o"
		}, {
			"full_name": "readline",
			"version": "7.0.3"
		}, {
			"full_name": "sqlite",
			"version": "3.24.0"
		}, {
			"full_name": "xz",
			"version": "5.2.4"
		}],
		"installed_as_dependency": true,
		"installed_on_request": false
	}],
	"linked_keg": "3.6.5_1",
	"pinned": false,
	"outdated": true
}]

postgresql

[{
	"name": "postgresql",
	"full_name": "postgresql",
	"oldname": null,
	"aliases": ["postgres", "postgresql@10"],
	"versioned_formulae": ["postgresql@9.4", "postgresql@9.5", "postgresql@9.6"],
	"desc": "Object-relational database system",
	"homepage": "https://www.postgresql.org/",
	"versions": {
		"stable": "10.5",
		"devel": null,
		"head": "HEAD",
		"bottle": true
	},
	"revision": 0,
	"version_scheme": 0,
	"bottle": {
		"stable": {
			"rebuild": 1,
			"cellar": "/usr/local/Cellar",
			"prefix": "/usr/local",
			"root_url": "https://homebrew.bintray.com/bottles",
			"files": {
				"mojave": {
					"url": "https://homebrew.bintray.com/bottles/postgresql-10.5.mojave.bottle.1.tar.gz",
					"sha256": "4a8a8b196a2d8eec90d8d1db38986af58427033a4819b670638e4a4113f81631"
				},
				"high_sierra": {
					"url": "https://homebrew.bintray.com/bottles/postgresql-10.5.high_sierra.bottle.1.tar.gz",
					"sha256": "b41e5c816f6827ef75fa91b4ccffbe432ec2dfdf33c6757f7272c8744face3a6"
				},
				"sierra": {
					"url": "https://homebrew.bintray.com/bottles/postgresql-10.5.sierra.bottle.1.tar.gz",
					"sha256": "cff481b53df41d58ac4bf5911757c36959643c0b87566bb172bd33c9b3d65d39"
				},
				"el_capitan": {
					"url": "https://homebrew.bintray.com/bottles/postgresql-10.5.el_capitan.bottle.1.tar.gz",
					"sha256": "abd8104c82358d6067399b8001aec86738d2aced1a0c78cd1c9cb33b129098a5"
				}
			}
		}
	},
	"keg_only": false,
	"options": [{
		"option": "--without-perl",
		"description": "Build without Perl support"
	}, {
		"option": "--without-tcl",
		"description": "Build without Tcl support"
	}, {
		"option": "--with-dtrace",
		"description": "Build with DTrace support"
	}, {
		"option": "--with-python",
		"description": "Enable PL/Python3 (incompatible with --with-python@2)"
	}, {
		"option": "--with-python@2",
		"description": "Enable PL/Python2"
	}],
	"build_dependencies": ["pkg-config"],
	"dependencies": ["icu4c", "openssl", "readline"],
	"recommended_dependencies": [],
	"optional_dependencies": ["python", "python@2"],
	"requirements": [],
	"conflicts_with": ["postgres-xc"],
	"caveats": "To migrate existing data from a previous major version of PostgreSQL run:\n  brew postgresql-upgrade-database\n",
	"installed": [{
		"version": "10.4",
		"used_options": [],
		"built_as_bottle": true,
		"poured_from_bottle": true,
		"runtime_dependencies": [{
			"full_name": "openssl",
			"version": "1.0.2o"
		}, {
			"full_name": "readline",
			"version": "7.0.3"
		}],
		"installed_as_dependency": false,
		"installed_on_request": true
	}],
	"linked_keg": "10.4",
	"pinned": false,
	"outdated": true
}]

@MikeMcQuaid
Copy link
Member

The best debugging now would be brew bundle check --verbose. I'm afraid as this doesn't seem to be a widespread issue I can't do 1:1 support here.

@lock lock bot added the outdated label Jan 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants