Homebrew-cask: uninstall script / system_command: breaks without sudo

Created on 17 Nov 2017  路  5Comments  路  Source: Homebrew/homebrew-cask

Reported in: https://github.com/caskroom/homebrew-cask/pull/40897#discussion_r151635666

Reproduced by removing sudo: true from gpg-suite

https://github.com/caskroom/homebrew-cask/blob/6f813cd469c77b172aaba56c8ec6555219cf87c9/Casks/gpg-suite.rb#L26-L29

Without sudo the uninstall should fail with:

==> Running uninstall script /usr/local/Caskroom/gpg-suite/2017.1/Uninstall.app/Contents/Resources/GPG Suite Uninstaller.app/Contents/Resources/uninstall.sh
==> touch: /Library/Application Support/GPGTools/okscript: Permission denied
==> uninstall must be run as root!
Error: Command failed to execute!

==> Failed command:
/usr/local/Caskroom/gpg-suite/2017.1/Uninstall.app/Contents/Resources/GPG\ Suite\ Uninstaller.app/Contents/Resources/uninstall.sh

==> Standard Output of failed command:


==> Standard Error of failed command:
touch: /Library/Application Support/GPGTools/okscript: Permission denied
uninstall must be run as root!


==> Exit status of failed command:
#<Process::Status: pid 4934 exit 1>
Error: Uninstall incomplete.

But instead it fails with:

==> Running uninstall script /usr/local/Caskroom/gpg-suite/2017.1/Uninstall.app/Contents/Resources/GPG Suite Uninstaller.app/Contents/Resources/uninstall.sh
Error: No such file or directory - /usr/local/Caskroom/gpg-suite/2017.1/Uninstall.app/Contents/Resources/GPG
Follow the instructions here:
  https://github.com/caskroom/homebrew-cask#reporting-bugs
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/open3.rb:199:in `spawn'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/open3.rb:199:in `popen_run'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/open3.rb:95:in `popen3'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:88:in `each_output_line'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:24:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb:199:in `uninstall_script'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb:53:in `block in dispatch_uninstall_directives'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb:50:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb:50:in `dispatch_uninstall_directives'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb:7:in `uninstall_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:384:in `block in uninstall_artifacts'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:381:in `uninstall_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:370:in `uninstall'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:22:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:12:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:12:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:97:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:167:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:131:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

git bisect lead me to https://github.com/Homebrew/brew/pull/3362/commits/2eb366ff386674bcd2eec760fdaef25dff665063

Most helpful comment

Thanks for following it up @commitay

All 5 comments

Thanks for following it up @commitay

Is it just me or does gpg-suite need to have the spaces escaped?

Based on my testing with screens-connect, \ escaping was ignored and treated the same way as the non-escaped value @SConaway

Ok. I wasn't sure.

Was this page helpful?
0 / 5 - 0 ratings