Commit graph

25 commits

Author SHA1 Message Date
Roland Walker
4991f655c6 comment typo 2014-11-15 12:27:11 -05:00
Roland Walker
aa4b112a90 Handle permissions corner cases on uninstall
* unset BSD file flags if present
* attempt ownership change if permissions changes fail

fixes #6699
fixes #6752
2014-10-23 12:07:05 -04:00
Roland Walker
0e7be245be Return Cask::SystemCommand::Result object
from Cask::SystemCommand.run

* stderr and stdout are now separated, though both are available
* :print_stderr is made the default, closer to previous behavior
* exit status can be read from the result object
* plist parsing is more naturally handled in the result object.
  The :plist argument to the run method was removed.
* whitespace
2014-09-27 08:59:08 -04:00
Roland Walker
e795a56850 Delete special files (eg symlinks) from pkg BOMs
`pkgutil --only-files` plus `pkgutil --only-dirs` does not
cover all files in the BOM.

Closes #5491
2014-07-29 07:55:07 -04:00
Roland Walker
96dfc573b1 Merge pull request #2672 from rolandwalker/lsb_no_delete_safety
BUGFIX: don't try autocleanup inside system dirs
2014-03-03 09:30:09 -05:00
Victor Robertson
7f5fbf448c Process SystemCommand arguments in list format
Previously, SystemCommand commands and arguments were processed as
strings which caused problems during shell interpretation if the
arguments were not escaped properly.  Now all commands are expressed
as arrays and no longer require their arguments to be escaped.
Additionally, stderr and stdout could have been interleaved in the
past and now they are always separated.
2014-02-07 06:27:05 -06:00
Roland Walker
4b87101f1f doubledash hygiene for external cmd: chmod 2014-01-31 13:05:09 -05:00
Roland Walker
d8a7e5aad9 doubledash hygiene for external cmd: rmdir 2014-01-31 13:05:09 -05:00
Roland Walker
a7f1bc6693 doubledash hygiene for external cmd: rm 2014-01-31 13:05:09 -05:00
Roland Walker
98f93c45bc Merge pull request #2670 from rolandwalker/relative_readlink_safety
BUGFIX: readlink requires chdir for relative links
2014-01-29 06:27:44 -08:00
Roland Walker
82504947e9 BUGFIX: readlink requires chdir for relative links
Fixes #2650 (although there is more work to be done).  The issue is that
path.readlink.exist? returned false for all relative links, because readlink
reads relative to the current working directory.  This caused relative
symlinks such as /usr/bin/tar to be deleted, because package mosh identified
/usr/bin as one of its container directories.

The simplest fix is not to use readlink at all, because path.exist?
will tell us what we want to know, independent of current dir.
2014-01-29 09:23:42 -05:00
Roland Walker
216444849e Add copious debugging with --debug
- add new file "cask/utils.rb" analogous to "utils.rb" in Homebrew
- define odebug and odumpcask, analogs of ohai and friends, but
  which only give output when --debug is in effect
- move the debug setting from an instance variable in Cask::CLI
  to a method Cask.debug, defined in "lib/cask/options.rb", which
  was added in #2276. (Perhaps options.rb should be merged back
  into Cask::CLI).
- sprinkle odebug statements liberally throughout the codebase
- update tests
2014-01-28 10:15:43 -05:00
Roland Walker
1efe356038 BUGFIX: don't try autocleanup inside system dirs
This safety feature addresses #2650 somewhat indirectly.
A list of system directories is defined.  When the uninstall
process encounters a "system directory" it does not touch that
directory at all
- no chmod on that dir
- no search for broken symlinks in that dir
- no cleanup of .DS_Store files in that dir
Explictly listed files from a pkg receipts are not affected by
this change.  Individual files will still be removed, even if
those files are in a special "system directory"
2014-01-27 19:18:14 -05:00
Roland Walker
cfee08ab9e uninstall files in chunks of 500.
This is intended to address #2122.
2013-12-31 19:47:31 -05:00
Paul Hinze
0c6e97b8fd use absolute paths for all commands
closes #2029
2013-12-14 08:48:40 -06:00
Paul Hinze
0a0c4a2d8a remove use of caller 2013-12-13 08:56:59 -06:00
Jonah Ruiz
c92890ecc9 Refactor similar method structure in dirs and files into one for re-use.
By using the name of the method calling fs_command we remove duplication
2013-12-13 04:14:54 -04:00
phinze
02d1543a24 sudo the rmdir on pkg uninstall
fixes an issue we've hit where chmod 777 is insufficient to allow
Pathname#rmdir to work properly.

refs #1374
2013-10-31 19:33:48 -05:00
phinze
7ae7a18932 fixes to pkg uninstaller to prevent madness
- do not remove *all* symlinks from referenced dirs, only broken ones
 - restore dir permission after use so we don't leave behind 777 dirs
 - add some better testing around `Cask::Pkg`
 - clean up `FakeSystemCommand` interface in tests

refs #1274
2013-10-24 14:56:29 -05:00
phinze
c85ef168fc require most commands to succeed; cleanup on install failure
- add `run!` method which raises if command does not succeed
- use `run!` when the command we are running must succeed for things to
  move forward. this should help produce clearer error messages in
  failure scenarios.
- move caveats earlier in the install process so reports can be made
  about potential failures
- remove the destination tree on cask install failure, so the cask will
  not be considered installed
2013-10-20 16:52:51 -05:00
Benjamin Hawkes-Lewis
ec18210887 Remove .DS_Store files when uninstalling packages
.DS_Store files (http://en.wikipedia.org/wiki/.DS_Store) may litter
directories installed with pkgutil preventing them testing as empty and
getting deleted. Delete them along with symlinks.
2013-09-23 11:54:49 +01:00
phinze
a9cd8e7101 fix a few bugs around recent changes
- re-added a lost nil guard on `Dmg` containers
 - `FakeSystemCommand` was still returning an array of split lines
   instead of a string, even though its real counterpart switched to
   string when install/uninstall landed
 - flushed out an alfred cli bug
 - moved plist parsing down to SystemCommand layer
2013-09-22 14:44:31 -05:00
phinze
711e44b405 reverse default for SystemCommand's print option
we were setting it to false basically everywhere and it was getting
a little silly
2013-09-22 13:44:29 -05:00
Paul Hinze
357c49162c when uninstalling pkgs; sudo chmod before examining
this helps avoid a situation (which happened with `wav-tap`) where the
non-priveleged ruby code gets permision denied errors while examining the
contents of directories using `Pathname`.
2013-09-22 08:20:18 -05:00
phinze
171456dc98 support for install/uninstall
accepts a single argument, which is a relative path to a pkg
inside the extracted Cask; homebrew-cask will attempt to install this
pkg after the Cask is extracted via `installer`

because of the many different ways uninstallers work, this
has several features:

 - `:script`: a script in the Cask which serves as an uninstaller (e.g.
   Vagrant, VirtualBox), uses `:args`, and `:input` keys to interact
   with said script
 - `:pkgutil`: a regexp which captures all package_ids installed by this
   cask; homebrew-cask will list all files installed under these ids and
   remove them
 - `:launchctl`: a list of bundle_ids for services that should be
   removed by homebrew-cask
 - `:files`: a fallback list of files to manually remove; helps when
   uninstallers miss something

refs #661
2013-07-21 22:01:38 -05:00