Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.75k stars 12.44k forks source link

Post install fails for shared-mime-info on mojave #38213

Closed Say-XKCD closed 5 years ago

Say-XKCD commented 5 years ago

I ran brew update and brew upgrade, and while the upgrade was running the shared mime-info package showed the following:

==> Pouring shared-mime-info-1.12.mojave.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

I tried the command as suggested and got the same result. The other packages installed successfully, so I believe this is an issue with the shared-mime-info code in particular.

I tried removing the downloaded packages (from ~/Library/Caches/Homebrew/downloads/) and running brew cleanup then repeated my update and upgrade commands, however still get this error.

The following is the output from brew doctor

$ brew doctor
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: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libEioPal.dylib
  /usr/local/lib/libTCMsgSrv2.dylib
  /usr/local/lib/libTCMsgSvr2.dylib

I have not removed them because it looks like those might be for my sound card, and I get a warning about permissions when I try (and I don't want to break anything). Below is the output from brew gist-logs

$ brew gist-logs shared-mime-info
Error: No logs.

I am able to reproduce this by running brew reinstall shared-mime-info

gmichokostas commented 5 years ago

I've got the same issue. Macos Mojave

brew postinstall shared-mime-info --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
==> An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ rb_file_s_symlink - (/usr/local/share/mime, /usr/local/Cellar/shared-mime-info/1.12/share/mim
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:359:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:359:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:1586:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:357:in `ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:380:in `ln_sf'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb:44:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1007:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:864:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1006:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:476:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:998:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:16:in `<main>'
fxcoudert commented 5 years ago

poke @tschoonj

chrisfinazzo commented 5 years ago

Also occurs on High Sierra. In my case, it's a dependency for Imagemagick. #38219 says this might be temporary, but I don't really know.

SheinH commented 5 years ago

@chrisfinazzo The bintray issue would only cause a 404, not a symlink error. I doubt that is the issue.

stek29 commented 5 years ago

This was the issue for me:

~
❯ ls -ld /usr/local/share/mime
lrwxr-xr-x 1 stek staff 34 Mar  3 00:42 /usr/local/share/mime -> ../Cellar/libheif/1.4.0/share/mime/

~
❯ brew unlink libheif
Unlinking /usr/local/Cellar/libheif/1.4.0... 12 symlinks removed

~
❯ brew postinstall -d shared-mime-info
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> /usr/local/Cellar/shared-mime-info/1.12/bin/update-mime-database /usr/local/

Looks like it's libheif issue.

I guess b3ea3ae80ae80570b1b7177246b0cac1789e14ee should've fixed it, but it didn't work for me.

(FYI this problem has occurred when I've ran brew upgrade)

stek29 commented 5 years ago

Oh and ofc:

❯ brew link libheif
Linking /usr/local/Cellar/libheif/1.4.0...
Error: Could not symlink share/mime/XMLnamespaces
Target /usr/local/share/mime/XMLnamespaces
already exists. You may want to remove it:
  rm '/usr/local/share/mime/XMLnamespaces'

To force the link and overwrite all conflicting files:
  brew link --overwrite libheif

To list all files that would be deleted:
  brew link --overwrite --dry-run libheif
Say-XKCD commented 5 years ago

@stek29 Thanks for posting that, it worked for me as well, though strangely didn't give the same error:

$ ls -ld /usr/local/share/mime
lrwxr-xr-x  1 user  admin  34  6 Mar 21:42 /usr/local/share/mime -> ../Cellar/libheif/1.4.0/share/mime

$ brew unlink libheif
Unlinking /usr/local/Cellar/libheif/1.4.0... 12 symlinks removed

$ brew postinstall shared-mime-info
==> Postinstalling shared-mime-info
==> /usr/local/Cellar/shared-mime-info/1.12/bin/update-mime-database /usr/local/share/mime

$ brew link libheif
Linking /usr/local/Cellar/libheif/1.4.0... 12 symlinks created

I have the following versions installed on macOS 10.14.3: shared-mime-info: stable 1.12 (bottled), HEAD ibheif: stable 1.4.0 (bottled)

stale[bot] commented 5 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.

thomascapote commented 5 years ago

Getting the same issue as @stek29 on High Sierra version 10.13.6 (17G5019).

titan:~$ brew postinstall shared-mime-info
==> Postinstalling shared-mime-info
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

titan:~$ ls -ld /usr/local/share/mime
lrwxr-xr-x  1 thomascapote  admin  34 Apr 14 13:18 /usr/local/share/mime -> ../Cellar/libheif/1.4.0/share/mime

titan:~$ brew unlink libheif
Unlinking /usr/local/Cellar/libheif/1.4.0... 12 symlinks removed

titan:~$ brew postinstall shared-mime-info
==> Postinstalling shared-mime-info
==> /usr/local/Cellar/shared-mime-info/1.12/bin/update-mime-database /usr/local/

titan:~$ brew link libheif
Linking /usr/local/Cellar/libheif/1.4.0... 
Error: Could not symlink share/mime/XMLnamespaces
Target /usr/local/share/mime/XMLnamespaces
already exists. You may want to remove it:
  rm '/usr/local/share/mime/XMLnamespaces'

To force the link and overwrite all conflicting files:
  brew link --overwrite libheif

To list all files that would be deleted:
  brew link --overwrite --dry-run libheif

Result of brew doctor:

titan:~$ brew doctor
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: You have the following deprecated, official taps tapped:
  Homebrew/homebrew-fuse
Untap them with `brew untap`.

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libnnz11.dylib
  /usr/local/lib/libociei.dylib
  /usr/local/lib/libocijdbc11.dylib

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  libheif

titan:~$ 
sl1pkn07 commented 5 years ago

in homebrew-kde/kde tap, i make a patch for any package generate the mimeinfo when run "make install" for avoid the creation the file XMLnamespaces, and point it to post_install script to run it the command for generate it

for example: https://github.com/KDE-mac/homebrew-kde/blob/30a57ba1e2a197c417091a7c428cc3e27b78e351/Formula/kf5-kcoreaddons.rb

edit: i've update it for more sane method instead off patch, but the fix is the same

stale[bot] commented 5 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.

kansaichris commented 5 years ago

I just ran into this issue on macOS Mojave 10.4.5:

==> Upgrading shared-mime-info 
==> Installing dependencies for shared-mime-info: glib
==> Installing shared-mime-info dependency: glib
==> Downloading https://homebrew.bintray.com/bottles/glib-2.60.4_1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/c4/c4090feb90bb9973ca852b6983a3f6db0b7c4242c3e2720168e39b2a5f9
######################################################################## 100.0%
==> Pouring glib-2.60.4_1.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/glib/2.60.4_1: 429 files, 15.2MB
==> Installing shared-mime-info
==> Downloading https://homebrew.bintray.com/bottles/shared-mime-info-1.12_1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/aa/aa8d4c56a94505b37c58935aee01777f87623a4ca9ad9e01276103cce87
######################################################################## 100.0%
==> Pouring shared-mime-info-1.12_1.mojave.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
==> Summary
🍺  /usr/local/Cellar/shared-mime-info/1.12_1: 85 files, 4.4MB
Removing: /usr/local/Cellar/shared-mime-info/1.12... (85 files, 4.4MB)

Here's the output from brew doctor:

$ brew doctor
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: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libulockmgr.1.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
  /usr/local/lib/libulockmgr.la

Manually running the post-install step doesn't appear to work:

$ brew postinstall shared-mime-info
==> Postinstalling shared-mime-info
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

Here's the same command with more verbose output:

$ brew -v postinstall shared-mime-info
==> Postinstalling shared-mime-info
/usr/bin/sandbox-exec -f /private/tmp/homebrew20190620-58786-15gdov5.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/simplecov-cobertura-1.3.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/ruby-macho-2.2.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rubocop-rspec-1.33.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rubocop-performance-1.3.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rubocop-0.69.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/unicode-display_width-1.6.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-wait-0.0.9/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-retry-0.6.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-its-1.3.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-3.8.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-mocks-3.8.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-expectations-3.8.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-core-3.8.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rspec-support-3.8.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/ronn-0.7.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rdiscount-2.2.0.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/rdiscount-2.2.0.1:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/rainbow-3.0.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/plist-3.5.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/parser-2.6.3.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/parallel_tests-2.29.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/parallel-1.17.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/mustache-1.1.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/mechanize-2.7.6/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/webrobots-0.1.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/ntlm-http-0.1.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/nokogiri-1.10.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.10.3:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/mini_portile2-2.4.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/net-http-persistent-3.0.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/net-http-digest_auth-1.4.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/mime-types-3.2.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/mime-types-data-3.2019.0331/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/jaro_winkler-1.5.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/http-cookie-1.0.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/hpricot-0.8.6/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/hpricot-0.8.6:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/domain_name-0.5.20180417/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/unf-0.1.4/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/unf_ext-0.0.7.6/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/unf_ext-0.0.7.6:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/diff-lcs-1.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/coveralls-0.8.23/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/thor-0.20.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/term-ansicolor-1.7.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/tins-1.20.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/simplecov-0.16.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/simplecov-html-0.10.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/docile-1.3.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/json-2.2.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.2.0:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/connection_pool-2.2.2/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/backports-3.15.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/ast-2.4.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/activesupport-5.2.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/tzinfo-1.2.5/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/thread_safe-0.3.6/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/minitest-5.11.3/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/i18n-1.6.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.3.0/gems/concurrent-ruby-1.1.5/lib:/Library/Ruby/Site/2.3.0:/Library/Ruby/Site/2.3.0/x86_64-darwin18:/Library/Ruby/Site/2.3.0/universal-darwin18:/Library/Ruby/Site:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin18:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/universal-darwin18:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/x86_64-darwin18:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18:/usr/local/Homebrew/Library/Homebrew -- /usr/local/Homebrew/Library/Homebrew/postinstall.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb -v
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
SMillerDev commented 5 years ago

This is the issue I'm having on mojave. Is /usr/local/share/mime a required location as far as anyone knows? Otherwise I'll make a PR to remove the symlinking.

==> An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ rb_file_s_symlink - (/usr/local/share/mime, /usr/local/Cellar/shared-mime-info/1.12_1/
kansaichris commented 5 years ago

Any updates on this?

kansaichris commented 5 years ago

Has this issue been fixed?

alebcay commented 5 years ago

This is also blocking #42845.

alebcay commented 5 years ago

This is also blocking #43986.

kansaichris commented 5 years ago

Just ran into this issue again with version 1.14 on Mojave:

==> Installing shared-mime-info
==> Downloading https://homebrew.bintray.com/bottles/shared-mime-info-1.14.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ba/ba411303e33f5745d6e82dc750935d66904c5cc57350b83b69f76ee1450
######################################################################## 100.0%
==> Pouring shared-mime-info-1.14.mojave.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

Here's the output from brew postinstall shared-mime-info:

==> Postinstalling shared-mime-info
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
pgrenaud commented 5 years ago

Same issue here, Mojave 10.14.6:

==> Upgrading shared-mime-info
==> Downloading https://homebrew.bintray.com/bottles/shared-mime-info-1.14.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ba/ba411303e33f5745d6e82dc750935d66904c5cc57350b83b69f76ee14502f3a9?__gda__=exp=1570454649~hmac=19b95b3d195c23e79f896e6555454446372eb58bf3f416e67a97812c1f8e3b76&response-content-disposition=attachment%3Bfilename%3D%22shared-mime-info-1.14.mojave.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX19cEin41nUrD-Pfl2DJMm85ybFPxEVBBJ3rDZ6q7sltRAcwNZHIIpbALuqLESngtn9-DfF1VYOwr0HMp2har25lrl0Q_AfQ-TtfVO9rvwDOzQJ5u5RRkB8-ANiAY79nJlMgxpFM232ffQ&response-X-Checksum-Sha1=7dd4020985f22ca3d3f92d1839f980db91549bff&response-X-Checksum-Sha2=ba411303e33f5745d6e82dc750935d66904c5cc57350b83b69f76ee14502f3a9
==> Pouring shared-mime-info-1.14.mojave.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

Running brew postinstall --debug shared-mime-info with the debug option:

/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
==> An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ rb_file_s_symlink - (/usr/local/share/mime, /usr/local/Cellar/shared-mime-info/1.14/share/mime/mime)

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:359:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:359:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:1586:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:357:in `ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:380:in `ln_sf'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb:45:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1009:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:866:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1008:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:479:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1000:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:18:in `<main>'

That is odd. Looking more closely:

$ ls -l /usr/local/share/mime
lrwxr-xr-x 1 pgrenaud admin 34 Sep 11 11:43 /usr/local/share/mime -> ../Cellar/libheif/1.5.1/share/mime
$ ls -l /usr/local/Cellar/libheif/1.5.1/share/mime
total 32K
-rw-r--r-- 1 pgrenaud staff   0 Sep 11 11:43 XMLnamespaces
-rw-r--r-- 1 pgrenaud staff  22 Sep 11 11:43 aliases
-rw-r--r-- 1 pgrenaud staff   0 Sep 11 11:43 generic-icons
-rw-r--r-- 1 pgrenaud staff 128 Sep 11 11:43 globs
-rw-r--r-- 1 pgrenaud staff 134 Sep 11 11:43 globs2
-rw-r--r-- 1 pgrenaud staff   0 Sep 11 11:43 icons
drwxr-xr-x 3 pgrenaud staff  96 Sep 11 11:43 image
-rw-r--r-- 1 pgrenaud staff  12 Sep 11 11:43 magic
-rw-r--r-- 1 pgrenaud staff 276 Sep 11 11:43 mime.cache
drwxr-xr-x 3 pgrenaud staff  96 Aug 29 12:42 packages
-rw-r--r-- 1 pgrenaud staff   0 Sep 11 11:43 subclasses
-rw-r--r-- 1 pgrenaud staff  16 Sep 11 11:43 treemagic
-rw-r--r-- 1 pgrenaud staff  11 Sep 11 11:43 types
-rw-r--r-- 1 pgrenaud staff   5 Sep 11 11:43 version
$ ls -l /usr/local/Cellar/shared-mime-info/1.14/share/mime/mime
ls: cannot access '/usr/local/Cellar/shared-mime-info/1.14/share/mime/mime': No such file or directory
$ ls -l /usr/local/Cellar/shared-mime-info/1.14/share/mime
lrwxr-xr-x 1 pgrenaud staff 21 Oct  7 09:12 /usr/local/Cellar/shared-mime-info/1.14/share/mime -> /usr/local/share/mime

The file /usr/local/Cellar/shared-mime-info/1.14/share/mime/mime does not exists. The path appear to be invalid. It should be /usr/local/Cellar/shared-mime-info/1.14/share/mime.

Can the package maintenainers look into this?

pgrenaud commented 5 years ago

@stek29 @Say-XKCD and @thomascapote are right. I didn't read properly this issue.

shared-mime-info and libheif are conflicting with each other. If we unlink libheif and run the postinstall for shared-mime-info:

$ brew unlink libheif
Unlinking /usr/local/Cellar/libheif/1.5.1... 25 symlinks removed
$ brew postinstall -d shared-mime-info
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> /usr/local/Cellar/shared-mime-info/1.14/bin/update-mime-database /usr/local/share/mime
$ ll /usr/local/share/mime/
total 308K
-rw-r--r--   1 pgrenaud admin 1.6K Oct  7 11:15 XMLnamespaces
-rw-r--r--   1 pgrenaud admin  11K Oct  7 11:15 aliases
drwxr-xr-x 436 pgrenaud admin  14K Oct  7 11:15 application
drwxr-xr-x  58 pgrenaud admin 1.9K Oct  7 11:15 audio
drwxr-xr-x   7 pgrenaud admin  224 Oct  7 11:15 font
-rw-r--r--   1 pgrenaud admin  17K Oct  7 11:15 generic-icons
-rw-r--r--   1 pgrenaud admin  29K Oct  7 11:15 globs
-rw-r--r--   1 pgrenaud admin  32K Oct  7 11:15 globs2
-rw-r--r--   1 pgrenaud admin    0 Oct  7 11:15 icons
drwxr-xr-x  95 pgrenaud admin 3.0K Oct  7 11:15 image
drwxr-xr-x   9 pgrenaud admin  288 Oct  7 11:15 inode
-rw-r--r--   1 pgrenaud admin  28K Oct  7 11:15 magic
drwxr-xr-x   9 pgrenaud admin  288 Oct  7 11:15 message
lrwxr-xr-x   1 pgrenaud admin   21 Oct  7 11:15 mime -> /usr/local/share/mime
-rw-r--r--   1 pgrenaud admin 133K Oct  7 11:15 mime.cache
drwxr-xr-x   5 pgrenaud admin  160 Oct  7 11:15 model
drwxr-xr-x  11 pgrenaud admin  352 Oct  7 11:15 multipart
drwxr-xr-x   3 pgrenaud admin   96 Oct  7 11:15 packages
-rw-r--r--   1 pgrenaud admin  16K Oct  7 11:15 subclasses
drwxr-xr-x 126 pgrenaud admin 4.0K Oct  7 11:15 text
-rw-r--r--   1 pgrenaud admin 1.2K Oct  7 11:15 treemagic
-rw-r--r--   1 pgrenaud admin  18K Oct  7 11:15 types
-rw-r--r--   1 pgrenaud admin    5 Oct  7 11:15 version
drwxr-xr-x  32 pgrenaud admin 1.0K Oct  7 11:15 video
drwxr-xr-x  21 pgrenaud admin  672 Oct  7 11:15 x-content
drwxr-xr-x   3 pgrenaud admin   96 Oct  7 11:15 x-epoc
$ ll /usr/local/share/mime/mime
lrwxr-xr-x 1 pgrenaud admin 21 Oct  7 11:15 /usr/local/share/mime/mime -> /usr/local/share/mime

The postinstall step of shared-mime-info creates a symlink at /usr/local/share/mime/mime pointing to /usr/local/share/mime, which seems totally wrong. If we force link libheif:

$ brew link --overwrite libheif
Linking /usr/local/Cellar/libheif/1.5.1... 25 symlinks created
$ ll /usr/local/share/mime
total 0
lrwxr-xr-x   1 pgrenaud admin   51 Oct  7 11:19 XMLnamespaces -> ../../Cellar/libheif/1.5.1/share/mime/XMLnamespaces
lrwxr-xr-x   1 pgrenaud admin   45 Oct  7 11:19 aliases -> ../../Cellar/libheif/1.5.1/share/mime/aliases
drwxr-xr-x 436 pgrenaud admin  14K Oct  7 11:15 application
drwxr-xr-x  58 pgrenaud admin 1.9K Oct  7 11:15 audio
drwxr-xr-x   7 pgrenaud admin  224 Oct  7 11:15 font
lrwxr-xr-x   1 pgrenaud admin   51 Oct  7 11:19 generic-icons -> ../../Cellar/libheif/1.5.1/share/mime/generic-icons
lrwxr-xr-x   1 pgrenaud admin   43 Oct  7 11:19 globs -> ../../Cellar/libheif/1.5.1/share/mime/globs
lrwxr-xr-x   1 pgrenaud admin   44 Oct  7 11:19 globs2 -> ../../Cellar/libheif/1.5.1/share/mime/globs2
lrwxr-xr-x   1 pgrenaud admin   43 Oct  7 11:19 icons -> ../../Cellar/libheif/1.5.1/share/mime/icons
drwxr-xr-x  95 pgrenaud admin 3.0K Oct  7 11:19 image
drwxr-xr-x   9 pgrenaud admin  288 Oct  7 11:15 inode
lrwxr-xr-x   1 pgrenaud admin   43 Oct  7 11:19 magic -> ../../Cellar/libheif/1.5.1/share/mime/magic
drwxr-xr-x   9 pgrenaud admin  288 Oct  7 11:15 message
lrwxr-xr-x   1 pgrenaud admin   21 Oct  7 11:15 mime -> /usr/local/share/mime
lrwxr-xr-x   1 pgrenaud admin   48 Oct  7 11:19 mime.cache -> ../../Cellar/libheif/1.5.1/share/mime/mime.cache
drwxr-xr-x   5 pgrenaud admin  160 Oct  7 11:15 model
drwxr-xr-x  11 pgrenaud admin  352 Oct  7 11:15 multipart
drwxr-xr-x   4 pgrenaud admin  128 Oct  7 11:19 packages
lrwxr-xr-x   1 pgrenaud admin   48 Oct  7 11:19 subclasses -> ../../Cellar/libheif/1.5.1/share/mime/subclasses
drwxr-xr-x 126 pgrenaud admin 4.0K Oct  7 11:15 text
lrwxr-xr-x   1 pgrenaud admin   47 Oct  7 11:19 treemagic -> ../../Cellar/libheif/1.5.1/share/mime/treemagic
lrwxr-xr-x   1 pgrenaud admin   43 Oct  7 11:19 types -> ../../Cellar/libheif/1.5.1/share/mime/types
lrwxr-xr-x   1 pgrenaud admin   45 Oct  7 11:19 version -> ../../Cellar/libheif/1.5.1/share/mime/version
drwxr-xr-x  32 pgrenaud admin 1.0K Oct  7 11:15 video
drwxr-xr-x  21 pgrenaud admin  672 Oct  7 11:15 x-content
drwxr-xr-x   3 pgrenaud admin   96 Oct  7 11:15 x-epoc

The content of /usr/local/share/mime seems better, even though we have the leftover mime link. But, I still have no clue which one is right and it is definitely not normal that both package symlink into the same location.

pgoodall commented 5 years ago

I'm not going to rehash everything above, but is this a problem with shared-mime-info, or libheif? Agree with @pgrenaud that the symlink seems odd.

sl1pkn07 commented 5 years ago

I think the problem is shared-mime-info iself when is executed under the make install or cmake install process under the homebrew sandbox. I fix those errors in the KDE tap by editing the cmakefile scripts (all kde project is cmake based) avoiding the execution of shared-mime-info and do run it in the post-install function

kansaichris commented 5 years ago

Just ran into this issue again with version 1.15 on Mojave:

==> Upgrading shared-mime-info 
==> Downloading https://homebrew.bintray.com/bottles/shared-mime-info-1.15.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/1b/1be57687d8aef14d6bc95be0a02a5dfdbce4bf859ea057c93e3ff8545c7
######################################################################## 100.0%
==> Pouring shared-mime-info-1.15.mojave.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`

Here's the output from brew postinstall --debug shared-mime-info:

/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
==> An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ rb_file_s_symlink 
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:363:in `symlink'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:363:in `block in ln_s'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1571:in `fu_each_src_dest0'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:361:in `ln_s'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:380:in `ln_sf'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb:45:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1010:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:867:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1009:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:475:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1001:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:18:in `<main>'
fxcoudert commented 5 years ago

If you're seeing this issue in a reproducible fashion, can you try to apply https://github.com/Homebrew/homebrew-core/pull/46307 and report whether it fixes your issue?

fxcoudert commented 5 years ago

This should be fixed

kansaichris commented 5 years ago

Nice! ✨

Unfortunately, I just ran brew update, brew upgrade, and brew postinstall shared-mime-info (in that order), but the error appears to persist. Am I missing a step, or do I need to wait for the update to propagate to all the Homebrew package caches and/or CDNs?

fxcoudert commented 5 years ago

Can you post the debug output from brew postinstall shared-mime-info? Also, it's not really supposed to be run multiple times, once the formula is already installed, so maybe that's it.

kansaichris commented 5 years ago

Hmm…maybe. Here's the debug output:

$ brew postinstall --debug shared-mime-info
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
==> Postinstalling shared-mime-info
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall shared-mime-info`
==> An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ rb_sysopen - /usr/local/share
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1386:in `initialize'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1386:in `open'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1386:in `block in copy_file'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1385:in `open'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1385:in `copy_file'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:492:in `copy_file'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:419:in `block in cp'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1557:in `block in fu_each_src_dest'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1566:in `block in fu_each_src_dest0'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1564:in `each'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1564:in `fu_each_src_dest0'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:1555:in `fu_each_src_dest'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/fileutils.rb:418:in `cp'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/shared-mime-info.rb:54:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1010:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:867:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1009:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:475:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1001:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:18:in `<main>'

It looks like the error is now occurring with rb_sysopen instead of rb_file_s_symlink.