Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.44k stars 9.75k forks source link

SSL error when running `brew upgrade` but not when upgrading a specific package #3397

Closed mariosangiorgio closed 6 years ago

mariosangiorgio commented 7 years ago

Please always follow these steps:

To help us debug your issue please explain:

I was trying to upgrade all the packages. This failed because of a SSL error (curl: (51) SSL: certificate verification failed (result: 5)). I see this mentioned in other issues, but what's interesting is that if I upgrade packages individually everything works.

I copied the output of the two invocation of brew upgrade and brew upgrade imagemagick. I ran them back to back in the same shell and I haven't touched anything in between. This happened also with other packages.

~ brew upgrade
==> Upgrading 7 outdated packages, with result:
erlang 20.1.3, go 1.9.2, hugo 0.30.2, imagemagick 7.0.7-8, nginx 1.12.2_1, node 8.8.1, postgresql 10.0
==> Upgrading imagemagick
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.7-8.el_capi
==> Downloading from https://akamai.bintray.com/21/21c4555cdf967b4626768c453f7b0

curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "imagemagick"
Download failed: https://homebrew.bintray.com/bottles/imagemagick-7.0.7-8.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://dl.bintray.com/homebrew/mirror/imagemagick-7.0.7-8.tar.x
Already downloaded: /Users/mariosangiorgio/Library/Caches/Homebrew/imagemagick-7.0.7-8.tar.xz
^C^C

~ brew upgrade imagemagick
==> Upgrading 1 outdated package, with result:
imagemagick 7.0.7-8
==> Upgrading imagemagick
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.7-8.el_capi
==> Downloading from https://akamai.bintray.com/21/21c4555cdf967b4626768c453f7b0
######################################################################## 100.0%
==> Pouring imagemagick-7.0.7-8.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/imagemagick/7.0.7-8: 1,523 files, 23.2MB

I'm not sure what's the difference between the two commands, but they must be doing something slightly different since I can reliably observe this issue.

I also tried specifying multiple packages and they upgraded fine. Somehow the issue seems to be related only to brew upgrade without any package.

I don't have any relevant environmental variable set (e.g. SSL_CERT_FILE) and I removed all the expired certificates from my user's keychain but I have some in System Roots.

MikeMcQuaid commented 7 years ago

Can you still reproduce this now?

mariosangiorgio commented 7 years ago

Yes, I just tried and I am still seeing the same behaviour.

~ brew outdated
libtiff (4.0.8_4) < 4.0.8_5

~ brew upgrade
==> Upgrading 1 outdated package, with result:
libtiff 4.0.8_5
==> Upgrading libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.8_5.el_capitan.
==> Downloading from https://akamai.bintray.com/1a/1a6b89cb8cc27e38d178799ec5649

curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "libtiff"
Download failed: https://homebrew.bintray.com/bottles/libtiff-4.0.8_5.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://download.osgeo.org/libtiff/tiff-4.0.8.tar.gz
##########                                                                15.2%
^C^C

~ brew upgrade libtiff
==> Upgrading 1 outdated package, with result:
libtiff 4.0.8_5
==> Upgrading libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.8_5.el_capitan.
==> Downloading from https://akamai.bintray.com/1a/1a6b89cb8cc27e38d178799ec5649
######################################################################## 100.0%
==> Pouring libtiff-4.0.8_5.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libtiff/4.0.8_5: 245 files, 3.4MB
~
MikeMcQuaid commented 7 years ago

@mariosangiorgio What if you run HOMEBREW_ENV_FILTERING=1 brew update?

MikeMcQuaid commented 7 years ago

(Note: this a problem with your system/setup rather than Homebrew itself so closing for now but will keep helping you).

mengelbrecht commented 7 years ago

This has been happening for me too. I am also using macOS 10.11.6.

~ ∙ brew doctor
Your system is ready to brew.
~ ∙ brew config
HOMEBREW_VERSION: 1.3.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: 270b752f5d9d218bfbed6fe85b6974fa653fb25f
Last commit: 13 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: cc23516d7ea2839c6c54439d500910cad4c87a2e
Core tap last commit: 9 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: dual-core 64-bit penryn
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 8.0 build 800
Git: 2.15.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 9
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11

Somehow it is affected by the packages to install. It works when installing only jq. But when installing jq and restic it breaks:

~ ∙ brew install jq restic
==> Installing dependencies for jq: oniguruma
==> Installing jq dependency: oniguruma
==> Downloading https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509451120~hmac=bb807ee634124df758834490a7c388c9b25fb41bb58c6a4b44a1ce556dbc4bdc&response-content-disposition=attachment%3Bfilename%3D%22oniguru

curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "oniguruma"
Download failed: https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://github.com/kkos/oniguruma/releases/download/v6.6.1/onig-6.6.1.tar.gz
^C

~ ∙ brew install jq
==> Installing dependencies for jq: oniguruma
==> Installing jq dependency: oniguruma
==> Downloading https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509451152~hmac=ff508dd5d7ad1cc83b6d4d99c87ef2cdd26b7f17ccd55f6fa6055d6525c7d20b&response-content-disposition=attachment%3Bfilename%3D%22oniguru
######################################################################## 100.0%
==> Pouring oniguruma-6.6.1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/oniguruma/6.6.1: 17 files, 1.3MB
==> Installing jq
==> Downloading https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/16/16fd34adec21188f7e13655cde69289acf0a87f4241395357f1c4d47f492eda1?__gda__=exp=1509451154~hmac=cf36fc5316040dc47326d65494db22c27e6c8c8a599b0195dc87f59dbce4db5b&response-content-disposition=attachment%3Bfilename%3D%22jq-1.5_
######################################################################## 100.0%
==> Pouring jq-1.5_2.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/jq/1.5_2: 18 files, 958.2KB
mariosangiorgio commented 7 years ago

I'm not at my Mac at the moment, but I recall this started happening after I installed restic.

Could it be something related to that specific package? Since @mgee uses it too it could be related

This evening I'll give it a try setting HOMEBREW_ENV_FILTERING and I'll let you know how it goes.

mengelbrecht commented 7 years ago

I also recall this started after installing restic and tapping the restic/restic tap (but maybe it is only a coincidence).

HOMEBREW_ENV_FILTERING=1 does not fix it:

~ ∙ HOMEBREW_ENV_FILTERING=1 brew install jq restic
==> Installing dependencies for jq: oniguruma
==> Installing jq dependency: oniguruma
==> Downloading https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509467967~hmac=48410c535bfdf32427e28bb2ff5e7ff6fde44e69ffc853854a0a54b24539f61a&response-content-disposition=attachment%3Bfilename%3D%22oniguru

curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "oniguruma"
Download failed: https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://github.com/kkos/oniguruma/releases/download/v6.6.1/onig-6.6.1.tar.gz
^C
MikeMcQuaid commented 7 years ago

What does curl https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz output?

mengelbrecht commented 7 years ago

There is no output:

~ ∙ curl https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
~ ∙
ilovezfs commented 7 years ago

curl -OLv https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz

mengelbrecht commented 7 years ago
~ ∙ curl -OLv https://homebrew.bintray.com/bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 5.153.35.248...
* Connected to homebrew.bintray.com (5.153.35.248) port 443 (#0)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.bintray.com
* Server certificate: GeoTrust SSL CA - G3
* Server certificate: GeoTrust Global CA
> GET /bottles/oniguruma-6.6.1.el_capitan.bottle.tar.gz HTTP/1.1
> Host: homebrew.bintray.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 302
< Server: nginx
< Date: Tue, 31 Oct 2017 17:34:59 GMT
< Content-Length: 0
< Connection: keep-alive
< Location: https://akamai.bintray.com/a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509472019~hmac=9c5e647852ae2bd01a25d65e88ef90402ac851778cc2dfd46fa1e544e1e2086b&response-content-disposition=attachment%3Bfilename%3D%22oniguruma-6.6.1.el_capitan.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX19iv3ywvsxr9yakM9YJtk1ddEXBRGi8LyBzXrk54umEkyEzMsBZJhkn98-31-eQjW-biyC0okkOGZBf7rkejqlsb0CAcXpWJxTrYuZBWq7IJHuV64CbPx6KDhUs9EQmWNEcQK_7DL6EQA&response-X-Checksum-Sha1=9148e720988659be61f2aa8dc16489dd8eb6a4e7&response-X-Checksum-Sha2=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9&response-X-Checksum-Sha256=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9
<
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host homebrew.bintray.com left intact
* Issue another request to this URL: 'https://akamai.bintray.com/a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509472019~hmac=9c5e647852ae2bd01a25d65e88ef90402ac851778cc2dfd46fa1e544e1e2086b&response-content-disposition=attachment%3Bfilename%3D%22oniguruma-6.6.1.el_capitan.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX19iv3ywvsxr9yakM9YJtk1ddEXBRGi8LyBzXrk54umEkyEzMsBZJhkn98-31-eQjW-biyC0okkOGZBf7rkejqlsb0CAcXpWJxTrYuZBWq7IJHuV64CbPx6KDhUs9EQmWNEcQK_7DL6EQA&response-X-Checksum-Sha1=9148e720988659be61f2aa8dc16489dd8eb6a4e7&response-X-Checksum-Sha2=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9&response-X-Checksum-Sha256=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9'
*   Trying 104.102.10.73...
* Connected to akamai.bintray.com (104.102.10.73) port 443 (#1)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.bintray.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> GET /a4/a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9?__gda__=exp=1509472019~hmac=9c5e647852ae2bd01a25d65e88ef90402ac851778cc2dfd46fa1e544e1e2086b&response-content-disposition=attachment%3Bfilename%3D%22oniguruma-6.6.1.el_capitan.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX19iv3ywvsxr9yakM9YJtk1ddEXBRGi8LyBzXrk54umEkyEzMsBZJhkn98-31-eQjW-biyC0okkOGZBf7rkejqlsb0CAcXpWJxTrYuZBWq7IJHuV64CbPx6KDhUs9EQmWNEcQK_7DL6EQA&response-X-Checksum-Sha1=9148e720988659be61f2aa8dc16489dd8eb6a4e7&response-X-Checksum-Sha2=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9&response-X-Checksum-Sha256=a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9 HTTP/1.1
> Host: akamai.bintray.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< ETag: "781cd85460a9dd2835a33260e59be38c:1504461848.093855"
< Last-Modified: Wed, 30 Aug 2017 05:01:06 GMT
< Server: AkamaiNetStorage
< Content-Length: 385126
< X-Checksum-Sha2: a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9
< X-Checksum-Sha256: a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9
< X-Checksum-Sha1: 9148e720988659be61f2aa8dc16489dd8eb6a4e7
< Date: Tue, 31 Oct 2017 17:34:59 GMT
< Connection: keep-alive
< Content-Type: application/gzip
< content-disposition: attachment;filename="oniguruma-6.6.1.el_capitan.bottle.tar.gz"
< X-Checksum-Sha2: a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9
< X-Checksum-Sha256: a427aa562f87e2d3d0081e757993340fe150c4240c64f23376ecb1910c17c7a9
< X-Checksum-Sha1: 9148e720988659be61f2aa8dc16489dd8eb6a4e7
<
{ [15555 bytes data]
100  376k  100  376k    0     0   260k      0  0:00:01  0:00:01 --:--:--  260k
* Connection #1 to host akamai.bintray.com left intact
ilovezfs commented 7 years ago
env | grep -i curl

and

env | grep -i ss
mengelbrecht commented 7 years ago

No output for env | grep -i curl.

Output for env | grep -i ss with session id omitted.

ITERM_SESSION_ID=<omitted>
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.EuU9jPslr9/Listeners
TERM_SESSION_ID=<omitted>
ilovezfs commented 7 years ago

Yup I can reproduce this.

iMac-TMP:~ joe$ brew install jq restic -dv
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jq.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/restic/homebrew-restic/restic.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/oniguruma.rb
==> Downloading https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
/usr/bin/curl --show-error --user-agent Homebrew/1.3.6-150-g302bc8b (Macintosh; Intel Mac OS X 10.11.6) curl/7.43.0 --fail --location --remote-time --continue-at - --output /Users/joe/Library/Caches/Homebrew/jq-1.5_2.el_capitan.bottle.tar.gz.incomplete https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "jq"
Download failed: https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:331:in `rescue in fetch'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:328:in `fetch'
/usr/local/Homebrew/Library/Homebrew/resource.rb:115:in `fetch'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:866:in `pour'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:295:in `install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:337:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:227:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:225:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:225:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'
iMac-TMP:~ joe$ 
ilovezfs commented 7 years ago

Seems to be a problem with vendor ruby.

iMac-TMP:Homebrew joe$ brew install jq restic -dv
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jq.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/restic/homebrew-restic/restic.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/oniguruma.rb
==> Downloading https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
/usr/bin/curl --show-error --user-agent Homebrew/1.3.6-150-g302bc8b (Macintosh; Intel Mac OS X 10.11.6) curl/7.43.0 --fail --location --remote-time --continue-at - --output /Users/joe/Library/Caches/Homebrew/jq-1.5_2.el_capitan.bottle.tar.gz.incomplete https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "jq"
Download failed: https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:331:in `rescue in fetch'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:328:in `fetch'
/usr/local/Homebrew/Library/Homebrew/resource.rb:115:in `fetch'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:866:in `pour'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:295:in `install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:337:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:227:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:225:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:225:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'
iMac-TMP:Homebrew joe$ export HOMEBREW_RUBY_PATH=/usr/local/opt/ruby/bin/ruby
iMac-TMP:Homebrew joe$ brew install jq restic -dv
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jq.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/restic/homebrew-restic/restic.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/oniguruma.rb
==> Downloading https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
/usr/bin/curl --show-error --user-agent Homebrew/1.3.6-150-g302bc8b (Macintosh; Intel Mac OS X 10.11.6) curl/7.43.0 --fail --location --remote-time --continue-at - --output /Users/joe/Library/Caches/Homebrew/jq-1.5_2.el_capitan.bottle.tar.gz.incomplete https://homebrew.bintray.com/bottles/jq-1.5_2.el_capitan.bottle.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  382k  100  382k    0     0   523k      0 --:--:-- --:--:-- --:--:--  523k
==> Verifying jq-1.5_2.el_capitan.bottle.tar.gz checksum
==> Pouring jq-1.5_2.el_capitan.bottle.tar.gz
tar xzf /Users/joe/Library/Caches/Homebrew/jq-1.5_2.el_capitan.bottle.tar.gz
Changing install name in /usr/local/Cellar/jq/1.5_2/bin/jq
  from @@HOMEBREW_PREFIX@@/opt/oniguruma/lib/libonig.4.dylib
    to /usr/local/opt/oniguruma/lib/libonig.4.dylib
Changing dylib ID of /usr/local/Cellar/jq/1.5_2/lib/libjq.1.dylib
  from @@HOMEBREW_PREFIX@@/opt/jq/lib/libjq.1.dylib
    to /usr/local/opt/jq/lib/libjq.1.dylib
Changing install name in /usr/local/Cellar/jq/1.5_2/lib/libjq.1.dylib
  from @@HOMEBREW_PREFIX@@/opt/oniguruma/lib/libonig.4.dylib
    to /usr/local/opt/oniguruma/lib/libonig.4.dylib
==> Finishing up
ln -s ../Cellar/jq/1.5_2/bin/jq jq
ln -s ../Cellar/jq/1.5_2/include/jq.h jq.h
ln -s ../Cellar/jq/1.5_2/include/jv.h jv.h
ln -s ../../Cellar/jq/1.5_2/share/doc/jq jq
ln -s ../../../Cellar/jq/1.5_2/share/man/man1/jq.1 jq.1
ln -s ../Cellar/jq/1.5_2/lib/libjq.1.dylib libjq.1.dylib
ln -s ../Cellar/jq/1.5_2/lib/libjq.a libjq.a
ln -s ../Cellar/jq/1.5_2/lib/libjq.dylib libjq.dylib
/usr/bin/sandbox-exec -f /tmp/homebrew20171031-39028-sr6eoo.sb nice /usr/local/Cellar/ruby/2.4.2_1/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew -- /usr/local/Homebrew/Library/Homebrew/postinstall.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jq.rb -dv
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jq.rb
==> Summary
🍺  /usr/local/Cellar/jq/1.5_2: 18 files, 958.2KB
==> Installing restic from restic/restic
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/go.rb
/usr/bin/sandbox-exec -f /tmp/homebrew20171031-39032-k9qx8f.sb nice /usr/local/Cellar/ruby/2.4.2_1/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew -- /usr/local/Homebrew/Library/Homebrew/build.rb /usr/local/Homebrew/Library/Taps/restic/homebrew-restic/restic.rb --verbose --debug
/usr/local/Homebrew/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/restic/homebrew-restic/restic.rb
/usr/local/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/go.rb
==> Downloading https://github.com/restic/restic/releases/download/v0.7.3/restic-0.7.3.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/19205896/96492a6e-9e46-11e7-87cc-8bf7c6959648?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20171031%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171031T180024Z&X-Amz-Expires=300&X-Amz-Signature=f54f09427b75a78e7a97298aafbd4e4dfe92029fc09d35427ac3615ca8b34e31&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Drestic-0.7.3.tar.gz&response-content-type=application%2Foctet-stream
/usr/bin/curl --show-error --user-agent Homebrew/1.3.6-150-g302bc8b (Macintosh; Intel Mac OS X 10.11.6) curl/7.43.0 --fail --location --remote-time --continue-at - --output /Users/joe/Library/Caches/Homebrew/restic-0.7.3.tar.gz.incomplete https://github-production-release-asset-2e65be.s3.amazonaws.com/19205896/96492a6e-9e46-11e7-87cc-8bf7c6959648?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20171031%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171031T180024Z&X-Amz-Expires=300&X-Amz-Signature=f54f09427b75a78e7a97298aafbd4e4dfe92029fc09d35427ac3615ca8b34e31&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Drestic-0.7.3.tar.gz&response-content-type=application%2Foctet-stream
** Resuming transfer from byte position 3235840
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 32.2M  100 32.2M    0     0  3002k      0  0:00:11  0:00:11 --:--:-- 3977k
==> Verifying restic-0.7.3.tar.gz checksum
tar xzf /Users/joe/Library/Caches/Homebrew/restic-0.7.3.tar.gz
==> make
go run build.go
ilovezfs commented 7 years ago

This is being caused by the require 'securerandom' in the restic formula. Adding require 'securerandom' to any formula will break it if it uses a Bintray bottle.

iMac-TMP:homebrew-core joe$ git diff -- Formula/wget.rb 
diff --git a/Formula/wget.rb b/Formula/wget.rb
index 8e7b4d1be9..34f124826a 100644
--- a/Formula/wget.rb
+++ b/Formula/wget.rb
@@ -1,3 +1,5 @@
+require 'securerandom'
+
 class Wget < Formula
   desc "Internet file retriever"
   homepage "https://www.gnu.org/software/wget/"
iMac-TMP:homebrew-core joe$ brew install wget
==> Downloading https://homebrew.bintray.com/bottles/wget-1.19.2.el_capitan.bottle.tar.gz

curl: (51) SSL: certificate verification failed (result: 5)
Error: Failed to download resource "wget"
Download failed: https://homebrew.bintray.com/bottles/wget-1.19.2.el_capitan.bottle.tar.gz
iMac-TMP:homebrew-core joe$ 
ilovezfs commented 7 years ago

@MikeMcQuaid suggested checking the environment with and without the require 'securerandom', and sure enough:

Josephs-MacBook-Pro:~ joe$ diff env1 env2
42,43c42
< "__CF_USER_TEXT_ENCODING"=>"0x1F7:0x0:0x0",
< "SSL_CERT_FILE"=>"/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/libexec/cert.pem"}
---
> "__CF_USER_TEXT_ENCODING"=>"0x1F7:0x0:0x0"}
amyspark commented 7 years ago

https://github.com/Homebrew/homebrew-portable/commit/fe79635e5df13b25f4b3a7c8e491abcaf5304880 hacks SSL_CERT_FILE into the openssl module. Importing it (via securerandom) is what breaks curl later on. (I cannot reproduce this particular error in Sierra, even if manually executing cURL with SSL_CERT_FILE or the --cacert flag set.)

MikeMcQuaid commented 7 years ago

@amyspark Yeh, we'll likely need to fix that in a later bottle. However, given this doesn't affect Homebrew/homebrew-core formulae and there is a workaround we can do in Homebrew/brew (and can be done in formulae until then) we're unlikely to push a new version to everyone just for this.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.