Closed christopherkeller closed 9 years ago
Hi! Thanks for the report!
This is similar to some other reports we have seen lately, and is likely an unintended downstream consequence of #8089. I plan to look into this tomorrow.
@christopherkeller could you post the output of brew cask doctor
?
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "#"] ==> Using container class Hbc::Container::Dmg for /Library/Caches/Homebrew/bitcoin-core-0.10.0.dmg
@phinze, @radeksimko, @ndr-qef, @claui (if you are around) I can't duplicate this issue, and it seems like more than one thing is going wrong simultaneously on the user's system, which makes it tough to reason out. Suggestions welcome.
The debug output quoted above indicates that the correct hdiutil
command did run (the argument wasn't really #
). That suggests something is wrong with inspect
. We actually called utf8_inspect
here which was a workaround for Ruby UTF-8 oddities. We also preserved a monkeypatch on inspect
from Homebrew which is likely intended to address the same issue.
And all of that would seem to be irrelevant to why the point of failure would be xattr
. I do have some memory that xattr
just happens to be the point in the process at which a permissions problem can sometimes manifest itself.
And, the exit status in the user's output is also rendered as #
. That's not a Pathname
, but should be a Process::Status
instance, and is rendered with plain inspect
For what is worth, I could reproduce in both my Mavericks and Yosemite VMs (which is why I labelled the issue). However, my inspect
output is fine.
Interestingly, cursory testing failed to find another :target
cask which fails on xattr
.
Printing stderr
suggests permission issues, as @rolandwalker guessed:
==> Executing: ["/usr/bin/xattr", "-w", "com.apple.metadata:kMDItemAlternateNames", "(\\\"Bitcoin Core.app\\\")", "#<Pathname:/Applications/Bitcoin Core.app>"]
==> xattr: [Errno 13] Permission denied: '/Applications/Bitcoin Core.app'
Permissions are possible I suppose, but it still fails if I install the symlink to /tmp via --appdir. Additionally, I can create files under /Applications via the command liine.
$ touch /Applications/foo $ ls -l /Applications/foo -rw-r--r-- 1 macadmin admin 0 Feb 21 13:51 /Applications/foo $ rm /Applications/foo
Here is the requested output:
$ brew cask doctor ==> OS X Release: 10.10 ==> OS X Release with Patchlevel: 10.10.2 ==> Hardware Architecture: intel-64 ==> Ruby Version: 2.0.0-p481 ==> Ruby Path: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby ==> Homebrew Version: 0.9.5 ==> Homebrew Executable Path: /usr/local/bin/brew ==> Homebrew Cellar Path: /usr/local/Cellar ==> Homebrew Repository Path: /usr/local ==> Homebrew Origin: https://github.com/Homebrew/homebrew ==> Homebrew-cask Version: 0.53.3 ==> Homebrew-cask Install Location: /usr/local/Cellar/brew-cask/0.53.3 ==> Homebrew-cask Staging Location: /opt/homebrew-cask/Caskroom ==> Homebrew-cask Cached Downloads: /Library/Caches/Homebrew /Library/Caches/Homebrew/Casks 4 files (warning: run "brew cask cleanup") 36.10 megs (warning: run "brew cask cleanup") ==> Homebrew-cask Default Tap Path: /usr/local/Library/Taps/caskroom/homebrew-cask ==> Homebrew-cask Alternate Cask Taps: /usr/local/Library/Taps/caskroom/homebrew-versions ==> Homebrew-cask Default Tap Cask Count: 2297 ==> Contents of $LOAD_PATH: /usr/local/Cellar/brew-cask/0.53.3/rubylib /Library/Ruby/Site/2.0.0 /Library/Ruby/Site/2.0.0/x86_64-darwin14 /Library/Ruby/Site/2.0.0/universal-darwin14 /Library/Ruby/Site /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin14 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin14 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin14 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14 ==> Contents of $RUBYLIB Environment Variable:==> Contents of $RUBYOPT Environment Variable: ==> Contents of $RUBYPATH Environment Variable: ==> Contents of $RBENV_VERSION Environment Variable: ==> Contents of $CHRUBY_VERSION Environment Variable: ==> Contents of $GEM_HOME Environment Variable: ==> Contents of $GEM_PATH Environment Variable: ==> Contents of $BUNDLE_PATH Environment Variable: ==> Contents of $PATH Environment Variable: PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/texbin:/usr/local/Library/ENV/scm" ==> Contents of $SHELL Environment Variable: SHELL="/bin/bash" ==> Contents of Locale Environment Variables: ==> Running As Privileged User: No
Thanks @christopherkeller!
We also confirmed in IRC that there are two apparently unrelated problems. The xattr
error can happen without the inspect
output mangling.
I recently ran into the same issue. Is there anything I can do to get bitcoin-core cask installer working?
Unfortunately, this is still an issue today it seems.
I just managed to reproduce that problem too in my Yosemite VM.
As mentioned above, permissions are really the reason:
==> Executing: ["/usr/bin/xattr", "-w", "com.apple.metadata:kMDItemAlternateNames", "(\"Bitcoin Core.app\")", "#<Pathname:/Users/vagrant/Applications/Bitcoin Core.app>"] ==> xattr: [Errno 13] Permission denied: '/Users/vagrant/Applications/Bitcoin Core.app'
this is output from ls -la
:
lrwxr-xr-x 1 vagrant staff 62 May 14 00:14 /Users/vagrant/Applications/Bitcoin Core.app -> /opt/homebrew-cask/Caskroom/bitcoin-core/0.10.1/Bitcoin-Qt.app
and now :tada: surprise surprise, output from ls -la /opt/homebrew-cask/Caskroom/bitcoin-core/0.10.1/
:
total 40
drwxr-xr-x 6 vagrant staff 204 May 14 00:19 .
drwxr-xr-x 3 vagrant staff 102 May 14 00:19 ..
-r-xr-xr-x 1 vagrant admin 15364 May 31 2013 .DS_Store
dr-xr-xr-x 3 vagrant admin 102 May 31 2013 .background
lrwxr-xr-x 1 vagrant admin 13 May 14 00:19 Applications -> /Applications
dr-xr-xr-x 3 vagrant admin 102 May 31 2013 Bitcoin-Qt.app
so as you can see, Bitcoin-Qt.app
is shipped with r-xr-xr-x
permissions, which means that even the owner cannot write into the file.
I managed to fix it like this:
diff --git a/lib/hbc/artifact/symlinked.rb b/lib/hbc/artifact/symlinked.rb
index bcaa1a3..2c57fa8 100644
--- a/lib/hbc/artifact/symlinked.rb
+++ b/lib/hbc/artifact/symlinked.rb
@@ -27,6 +27,9 @@ class Hbc::Artifact::Symlinked < Hbc::Artifact::Base
altnames.concat(', ') if altnames.length > 0
altnames.concat(%Q{"#{target.basename}"})
altnames = %Q{(#{altnames})}
+
+ @command.run!('/bin/chmod', :args => ['u=rwx', source])
+
@command.run!('/usr/bin/xattr',
:args => ['-w', attribute, altnames, target],
:print_stderr => false)
I will send a PR soon.
This patch works for me on a real Yosemite install - nice find! :clap:
$ vim /usr/local/Cellar/brew-cask/0.54.0/rubylib/hbc/artifact/symlinked.rb
$ rm -Rf ~/Applications/Bitcoin\ Core.app && brew cask install bitcoin-core
==> Downloading https://bitcoin.org/bin/bitcoin-core-0.10.1/bitcoin-0.10.1-osx.dmg
Already downloaded: /Library/Caches/Homebrew/bitcoin-core-0.10.1.dmg
==> Symlinking App 'Bitcoin-Qt.app' to '/Users/deizel/Applications/Bitcoin Core.app'
🍺 bitcoin-core staged at '/opt/homebrew-cask/Caskroom/bitcoin-core/0.10.1' (16 files, 24M)
The above patch solves the issue for me as well - thanks! :+1:
FYI - still waiting on the patch to be merged (#11200). The temporary fix is to apply the patch manually.
Yes, I’m aware.
:+1:
I might have same problem, even after updating homebrew-cask.
% brew cask install mikogo
==> Downloading http://download.mikogo4.com/mikogo.dmg
######################################################################## 100.0%
==> Symlinking App 'Mikogo-host.app' to '/Users/ken/Applications/Mikogo.app'
Error: Command failed to execute!
==> Failed command:
["/usr/bin/xattr", "-w", "com.apple.metadata:kMDItemAlternateNames", "(\\\"Mikogo.app\\\")", "#<Pathname:/Users/ken/Applications/Mikogo.app>"]
==> Output of failed command:
==> Exit status of failed command:
#<Process::Status: pid 99190 exit 1>
I have same error on bitcoin-core, too.
Installation fails before the package gets installed in the Caskroom directory, but opening it manually and dragging and dropping in /Applications seems to work just fine.